OpenCV for Unity  2.6.2
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.10.0/index.html ) for the details of the argument of the method.
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
OpenCVForUnity.ObjdetectModule.BarcodeDetector Class Reference
Inheritance diagram for OpenCVForUnity.ObjdetectModule.BarcodeDetector:
OpenCVForUnity.ObjdetectModule.GraphicalCodeDetector OpenCVForUnity.DisposableOpenCVObject OpenCVForUnity.DisposableObject

Public Member Functions

 BarcodeDetector ()
 Initialize the BarcodeDetector. More...
 
 BarcodeDetector (string prototxt_path, string model_path)
 Initialize the BarcodeDetector. More...
 
bool decodeWithType (Mat img, Mat points, List< string > decoded_info, List< string > decoded_type)
 Decodes barcode in image once it's found by the detect() method. More...
 
bool detectAndDecodeWithType (Mat img, List< string > decoded_info, List< string > decoded_type, Mat points)
 Both detects and decodes barcode. More...
 
bool detectAndDecodeWithType (Mat img, List< string > decoded_info, List< string > decoded_type)
 Both detects and decodes barcode. More...
 
double getDownsamplingThreshold ()
 Get detector downsampling threshold. More...
 
BarcodeDetector setDownsamplingThreshold (double thresh)
 Set detector downsampling threshold. More...
 
void getDetectorScales (MatOfFloat sizes)
 Returns detector box filter sizes. More...
 
BarcodeDetector setDetectorScales (MatOfFloat sizes)
 Set detector box filter sizes. More...
 
double getGradientThreshold ()
 Get detector gradient magnitude threshold. More...
 
BarcodeDetector setGradientThreshold (double thresh)
 Set detector gradient magnitude threshold. More...
 
- Public Member Functions inherited from OpenCVForUnity.ObjdetectModule.GraphicalCodeDetector
IntPtr getNativeObjAddr ()
 
bool detect (Mat img, Mat points)
 Detects graphical code in image and returns the quadrangle containing the code. More...
 
string decode (Mat img, Mat points, Mat straight_code)
 Decodes graphical code in image once it's found by the detect() method. More...
 
string decode (Mat img, Mat points)
 Decodes graphical code in image once it's found by the detect() method. More...
 
string detectAndDecode (Mat img, Mat points, Mat straight_code)
 Both detects and decodes graphical code. More...
 
string detectAndDecode (Mat img, Mat points)
 Both detects and decodes graphical code. More...
 
string detectAndDecode (Mat img)
 Both detects and decodes graphical code. More...
 
bool detectMulti (Mat img, Mat points)
 Detects graphical codes in image and returns the vector of the quadrangles containing the codes. More...
 
bool decodeMulti (Mat img, Mat points, List< string > decoded_info, List< Mat > straight_code)
 Decodes graphical codes in image once it's found by the detect() method. More...
 
bool decodeMulti (Mat img, Mat points, List< string > decoded_info)
 Decodes graphical codes in image once it's found by the detect() method. More...
 
bool detectAndDecodeMulti (Mat img, List< string > decoded_info, Mat points, List< Mat > straight_code)
 Both detects and decodes graphical codes. More...
 
bool detectAndDecodeMulti (Mat img, List< string > decoded_info, Mat points)
 Both detects and decodes graphical codes. More...
 
bool detectAndDecodeMulti (Mat img, List< string > decoded_info)
 Both detects and decodes graphical codes. More...
 
- Public Member Functions inherited from OpenCVForUnity.DisposableObject
void Dispose ()
 
void ThrowIfDisposed ()
 

Static Public Member Functions

static new BarcodeDetector __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.ObjdetectModule.GraphicalCodeDetector
static GraphicalCodeDetector __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.DisposableObject
static IntPtr ThrowIfNullIntPtr (IntPtr ptr)
 

Protected Member Functions

override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.ObjdetectModule.GraphicalCodeDetector
override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject
 DisposableOpenCVObject ()
 
 DisposableOpenCVObject (IntPtr ptr)
 
 DisposableOpenCVObject (bool isEnabledDispose)
 
 DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableObject
 DisposableObject ()
 
 DisposableObject (bool isEnabledDispose)
 

Additional Inherited Members

- Properties inherited from OpenCVForUnity.DisposableObject
bool IsDisposed [get, protected set]
 
bool IsEnabledDispose [get, set]
 

Constructor & Destructor Documentation

◆ BarcodeDetector() [1/2]

OpenCVForUnity.ObjdetectModule.BarcodeDetector.BarcodeDetector ( )

Initialize the BarcodeDetector.

◆ BarcodeDetector() [2/2]

OpenCVForUnity.ObjdetectModule.BarcodeDetector.BarcodeDetector ( string  prototxt_path,
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

Member Function Documentation

◆ __fromPtr__()

static new BarcodeDetector OpenCVForUnity.ObjdetectModule.BarcodeDetector.__fromPtr__ ( IntPtr  addr)
static

◆ decodeWithType()

bool OpenCVForUnity.ObjdetectModule.BarcodeDetector.decodeWithType ( Mat  img,
Mat  points,
List< string >  decoded_info,
List< string >  decoded_type 
)

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() [1/2]

bool OpenCVForUnity.ObjdetectModule.BarcodeDetector.detectAndDecodeWithType ( Mat  img,
List< string >  decoded_info,
List< string >  decoded_type,
Mat  points 
)

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

◆ detectAndDecodeWithType() [2/2]

bool OpenCVForUnity.ObjdetectModule.BarcodeDetector.detectAndDecodeWithType ( Mat  img,
List< string >  decoded_info,
List< string >  decoded_type 
)

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

◆ Dispose()

override void OpenCVForUnity.ObjdetectModule.BarcodeDetector.Dispose ( bool  disposing)
protectedvirtual

◆ getDetectorScales()

void OpenCVForUnity.ObjdetectModule.BarcodeDetector.getDetectorScales ( MatOfFloat  sizes)

Returns detector box filter sizes.

Parameters
sizesoutput parameter for returning the sizes.

◆ getDownsamplingThreshold()

double OpenCVForUnity.ObjdetectModule.BarcodeDetector.getDownsamplingThreshold ( )

Get detector downsampling threshold.

Returns
detector downsampling threshold

◆ getGradientThreshold()

double OpenCVForUnity.ObjdetectModule.BarcodeDetector.getGradientThreshold ( )

Get detector gradient magnitude threshold.

Returns
detector gradient magnitude threshold.

◆ setDetectorScales()

BarcodeDetector OpenCVForUnity.ObjdetectModule.BarcodeDetector.setDetectorScales ( MatOfFloat  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()

BarcodeDetector OpenCVForUnity.ObjdetectModule.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()

BarcodeDetector OpenCVForUnity.ObjdetectModule.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: