EstervQrCode 1.1.1
Library for qr code manipulation
Public Member Functions | List of all members
cv::barcode::BarcodeDetector Class Reference

#include <barcode.hpp>

Inheritance diagram for cv::barcode::BarcodeDetector:
cv::GraphicalCodeDetector

Public Member Functions

CV_WRAP BarcodeDetector ()
 Initialize the BarcodeDetector. More...
 
CV_WRAP BarcodeDetector (CV_WRAP_FILE_PATH const std::string &prototxt_path, CV_WRAP_FILE_PATH const std::string &model_path)
 Initialize the BarcodeDetector. More...
 
 ~BarcodeDetector ()
 
CV_WRAP bool decodeWithType (InputArray img, InputArray points, CV_OUT std::vector< std::string > &decoded_info, CV_OUT std::vector< std::string > &decoded_type) const
 Decodes barcode in image once it's found by the detect() method. More...
 
CV_WRAP bool detectAndDecodeWithType (InputArray img, CV_OUT std::vector< std::string > &decoded_info, CV_OUT std::vector< std::string > &decoded_type, OutputArray points=noArray()) const
 Both detects and decodes barcode. More...
 
CV_WRAP double getDownsamplingThreshold () const
 Get detector downsampling threshold. More...
 
CV_WRAP BarcodeDetectorsetDownsamplingThreshold (double thresh)
 Set detector downsampling threshold. More...
 
CV_WRAP void getDetectorScales (CV_OUT std::vector< float > &sizes) const
 Returns detector box filter sizes. More...
 
CV_WRAP BarcodeDetectorsetDetectorScales (const std::vector< float > &sizes)
 Set detector box filter sizes. More...
 
CV_WRAP double getGradientThreshold () const
 Get detector gradient magnitude threshold. More...
 
CV_WRAP BarcodeDetectorsetGradientThreshold (double thresh)
 Set detector gradient magnitude threshold. More...
 
- Public Member Functions inherited from cv::GraphicalCodeDetector
CV_DEPRECATED_EXTERNAL GraphicalCodeDetector ()
 
 GraphicalCodeDetector (const GraphicalCodeDetector &)=default
 
 GraphicalCodeDetector (GraphicalCodeDetector &&)=default
 
GraphicalCodeDetectoroperator= (const GraphicalCodeDetector &)=default
 
GraphicalCodeDetectoroperator= (GraphicalCodeDetector &&)=default
 
CV_WRAP bool detect (InputArray img, OutputArray points) const
 Detects graphical code in image and returns the quadrangle containing the code. More...
 
CV_WRAP std::string decode (InputArray img, InputArray points, OutputArray straight_code=noArray()) const
 Decodes graphical code in image once it's found by the detect() method. More...
 
CV_WRAP std::string detectAndDecode (InputArray img, OutputArray points=noArray(), OutputArray straight_code=noArray()) const
 Both detects and decodes graphical code. More...
 
CV_WRAP bool detectMulti (InputArray img, OutputArray points) const
 Detects graphical codes in image and returns the vector of the quadrangles containing the codes. More...
 
CV_WRAP bool decodeMulti (InputArray img, InputArray points, CV_OUT std::vector< std::string > &decoded_info, OutputArrayOfArrays straight_code=noArray()) const
 Decodes graphical codes in image once it's found by the detect() method. More...
 
CV_WRAP bool detectAndDecodeMulti (InputArray img, CV_OUT std::vector< std::string > &decoded_info, OutputArray points=noArray(), OutputArrayOfArrays straight_code=noArray()) const
 Both detects and decodes graphical codes. More...
 

Additional Inherited Members

- Protected Attributes inherited from cv::GraphicalCodeDetector
Ptr< Impl > p
 

Constructor & Destructor Documentation

◆ BarcodeDetector() [1/2]

CV_WRAP cv::barcode::BarcodeDetector::BarcodeDetector ( )

Initialize the BarcodeDetector.

◆ BarcodeDetector() [2/2]

CV_WRAP cv::barcode::BarcodeDetector::BarcodeDetector ( CV_WRAP_FILE_PATH const std::string prototxt_path,
CV_WRAP_FILE_PATH const std::string model_path 
)

Initialize the BarcodeDetector.

Parameters allow to load optional Super Resolution DNN model for better quality.

Parameters
prototxt_pathprototxt file path for the super resolution model
model_pathmodel file path for the super resolution model

◆ ~BarcodeDetector()

cv::barcode::BarcodeDetector::~BarcodeDetector ( )

Member Function Documentation

◆ decodeWithType()

CV_WRAP bool cv::barcode::BarcodeDetector::decodeWithType ( InputArray  img,
InputArray  points,
CV_OUT std::vector< std::string > &  decoded_info,
CV_OUT std::vector< std::string > &  decoded_type 
) const

Decodes barcode in image once it's found by the detect() method.

Parameters
imggrayscale or color (BGR) image containing bar code.
pointsvector of rotated rectangle vertices found by detect() method (or some other algorithm). For N detected barcodes, the dimensions of this array should be [N][4]. Order of four points in vector<Point2f> is bottomLeft, topLeft, topRight, bottomRight.
decoded_infoUTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded.
decoded_typevector strings, specifies the type of these barcodes
Returns
true if at least one valid barcode have been found

◆ detectAndDecodeWithType()

CV_WRAP bool cv::barcode::BarcodeDetector::detectAndDecodeWithType ( InputArray  img,
CV_OUT std::vector< std::string > &  decoded_info,
CV_OUT std::vector< std::string > &  decoded_type,
OutputArray  points = noArray() 
) const

Both detects and decodes barcode.

Parameters
imggrayscale or color (BGR) image containing barcode.
decoded_infoUTF8-encoded output vector of string(s) or empty vector of string if the codes cannot be decoded.
decoded_typevector of strings, specifies the type of these barcodes
pointsoptional output vector of vertices of the found barcode rectangle. Will be empty if not found.
Returns
true if at least one valid barcode have been found

◆ getDetectorScales()

CV_WRAP void cv::barcode::BarcodeDetector::getDetectorScales ( CV_OUT std::vector< float > &  sizes) const

Returns detector box filter sizes.

Parameters
sizesoutput parameter for returning the sizes.

◆ getDownsamplingThreshold()

CV_WRAP double cv::barcode::BarcodeDetector::getDownsamplingThreshold ( ) const

Get detector downsampling threshold.

Returns
detector downsampling threshold

◆ getGradientThreshold()

CV_WRAP double cv::barcode::BarcodeDetector::getGradientThreshold ( ) const

Get detector gradient magnitude threshold.

Returns
detector gradient magnitude threshold.

◆ setDetectorScales()

CV_WRAP BarcodeDetector& cv::barcode::BarcodeDetector::setDetectorScales ( const std::vector< float > &  sizes)

Set detector box filter sizes.

Adjusts the value and the number of box filters used in the detect step. The filter sizes directly correlate with the expected line widths for a barcode. Corresponds to expected barcode distance. If the downsampling limit is increased, filter sizes need to be adjusted in an inversely proportional way.

Parameters
sizesbox filter sizes, relative to minimum dimension of the image (default [0.01, 0.03, 0.06, 0.08])

◆ setDownsamplingThreshold()

CV_WRAP BarcodeDetector& cv::barcode::BarcodeDetector::setDownsamplingThreshold ( double  thresh)

Set detector downsampling threshold.

By default, the detect method resizes the input image to this limit if the smallest image size is is greater than the threshold. Increasing this value can improve detection accuracy and the number of results at the expense of performance. Correlates with detector scales. Setting this to a large value will disable downsampling.

Parameters
threshdownsampling limit to apply (default 512)
See also
setDetectorScales

◆ setGradientThreshold()

CV_WRAP BarcodeDetector& cv::barcode::BarcodeDetector::setGradientThreshold ( double  thresh)

Set detector gradient magnitude threshold.

Sets the coherence threshold for detected bounding boxes. Increasing this value will generate a closer fitted bounding box width and can reduce false-positives. Values between 16 and 1024 generally work, while too high of a value will remove valid detections.

Parameters
threshgradient magnitude threshold (default 64).

The documentation for this class was generated from the following file: