Skip to content

GraphicalCodeDetector

objdetectclassOpenCV 5.0.0
import { GraphicalCodeDetector } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSConstructor or factory
CLASSGraphicalCodeDetector
RETURN TYPEOwned native handle
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Native object: release it with using or delete(). Factories can return null; check before calling methods.

graphical code detector value in the OpenCV API.

Constructors and members

clone

Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.

clone(): this;
Returns

The this result.

detect

Detects graphical code in image and returns the quadrangle containing the code.

detect(img: Mat, points: Mat): boolean;
img

grayscale or color (BGR) image containing (or not) graphical code.

points

Output destination, filled by the native operation. Output vector of vertices of the minimum-area quadrangle containing the code.

Returns

The boolean result.

decode

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

 Returns UTF8-encoded output string or empty string if the code cannot be decoded.
decode(img: Mat, points: Mat, straight_code: Mat): string;
2 available overloads
decode(img: Mat, points: Mat): string;
decode(img: Mat, points: Mat, straight_code: Mat): string;
img

grayscale or color (BGR) image containing graphical code.

points

Quadrangle vertices found by detect() method (or some other algorithm).

straight_code

Output destination, filled by the native operation. The optional output image containing binarized code, will be empty if not found.

Returns

The string result.

detectAndDecode

Both detects and decodes graphical code

detectAndDecode(img: Mat, points: Mat, straight_code: Mat): string;
3 available overloads
detectAndDecode(img: Mat): string;
detectAndDecode(img: Mat, points: Mat): string;
detectAndDecode(img: Mat, points: Mat, straight_code: Mat): string;
img

grayscale or color (BGR) image containing graphical code.

points

Output destination, filled by the native operation. optional output array of vertices of the found graphical code quadrangle, will be empty if not found.

straight_code

Output destination, filled by the native operation. The optional output image containing binarized code

Returns

The string result.

detectMulti

Detects graphical codes in image and returns the vector of the quadrangles containing the codes.

detectMulti(img: Mat, points: Mat): boolean;
img

grayscale or color (BGR) image containing (or not) graphical codes.

points

Output destination, filled by the native operation. Output vector of vector of vertices of the minimum-area quadrangle containing the codes.

Returns

The boolean result.

decodeMulti

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

decodeMulti(img: Mat, points: Mat, decoded_info: StringVector, straight_code: MatVector): boolean;
2 available overloads
decodeMulti(img: Mat, points: Mat, decoded_info: StringVector): boolean;
decodeMulti(img: Mat, points: Mat, decoded_info: StringVector, straight_code: MatVector): boolean;
img

grayscale or color (BGR) image containing graphical codes.

points

vector of Quadrangle vertices found by detect() method (or some other algorithm).

decoded_info

Output destination, filled by the native operation. UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded.

straight_code

Output destination, filled by the native operation. The optional output vector of images containing binarized codes

Returns

The boolean result.

detectAndDecodeMulti

Both detects and decodes graphical codes

detectAndDecodeMulti(img: Mat, decoded_info: StringVector, points: Mat, straight_code: MatVector): boolean;
3 available overloads
detectAndDecodeMulti(img: Mat, decoded_info: StringVector): boolean;
detectAndDecodeMulti(img: Mat, decoded_info: StringVector, points: Mat): boolean;
detectAndDecodeMulti(img: Mat, decoded_info: StringVector, points: Mat, straight_code: MatVector): boolean;
img

grayscale or color (BGR) image containing graphical codes.

decoded_info

Output destination, filled by the native operation. UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded.

points

Output destination, filled by the native operation. optional output vector of vertices of the found graphical code quadrangles. Will be empty if not found.

straight_code

Output destination, filled by the native operation. The optional vector of images containing binarized codes

  • If there are QR codes encoded with a Structured Append mode on the image and all of them detected and decoded correctly, method writes a full message to position corresponds to 0-th code in a sequence. The rest of QR codes from the same sequence have empty string.
Returns

The boolean result.

detectAndDecodeBytes

Both detects and decodes graphical code

detectAndDecodeBytes(img: Mat, points: Mat, straight_code: Mat): ucharVector;
3 available overloads
detectAndDecodeBytes(img: Mat): ucharVector;
detectAndDecodeBytes(img: Mat, points: Mat): ucharVector;
detectAndDecodeBytes(img: Mat, points: Mat, straight_code: Mat): ucharVector;
img

grayscale or color (BGR) image containing graphical code.

points

Output destination, filled by the native operation. optional output array of vertices of the found graphical code quadrangle, will be empty if not found.

straight_code

Output destination, filled by the native operation. The optional output image containing binarized code

Returns

The ucharVector result. Release returned native handles with using or delete(), including handles nested in results.

decodeBytes

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

 Returns UTF8-encoded output string or empty string if the code cannot be decoded.
decodeBytes(img: Mat, points: Mat, straight_code: Mat): ucharVector;
2 available overloads
decodeBytes(img: Mat, points: Mat): ucharVector;
decodeBytes(img: Mat, points: Mat, straight_code: Mat): ucharVector;
img

grayscale or color (BGR) image containing graphical code.

points

Quadrangle vertices found by detect() method (or some other algorithm).

straight_code

Output destination, filled by the native operation. The optional output image containing binarized code, will be empty if not found.

Returns

The ucharVector result. Release returned native handles with using or delete(), including handles nested in results.

decodeBytesMulti

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

decodeBytesMulti(img: Mat, points: Mat, decoded_info: std__vector_ucharVector, straight_code: MatVector): boolean;
2 available overloads
decodeBytesMulti(img: Mat, points: Mat, decoded_info: std__vector_ucharVector): boolean;
decodeBytesMulti(img: Mat, points: Mat, decoded_info: std__vector_ucharVector, straight_code: MatVector): boolean;
img

grayscale or color (BGR) image containing graphical codes.

points

vector of Quadrangle vertices found by detect() method (or some other algorithm).

decoded_info

Output destination, filled by the native operation. UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded.

straight_code

Output destination, filled by the native operation. The optional output vector of images containing binarized codes

Returns

The boolean result.

detectAndDecodeBytesMulti

Both detects and decodes graphical codes

detectAndDecodeBytesMulti(img: Mat, decoded_info: std__vector_ucharVector, points: Mat, straight_code: MatVector): boolean;
3 available overloads
detectAndDecodeBytesMulti(img: Mat, decoded_info: std__vector_ucharVector): boolean;
detectAndDecodeBytesMulti(img: Mat, decoded_info: std__vector_ucharVector, points: Mat): boolean;
detectAndDecodeBytesMulti(img: Mat, decoded_info: std__vector_ucharVector, points: Mat, straight_code: MatVector): boolean;
img

grayscale or color (BGR) image containing graphical codes.

decoded_info

Output destination, filled by the native operation. UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded.

points

Output destination, filled by the native operation. optional output vector of vertices of the found graphical code quadrangles. Will be empty if not found.

straight_code

Output destination, filled by the native operation. The optional vector of images containing binarized codes

  • If there are QR codes encoded with a Structured Append mode on the image and all of them detected and decoded correctly, method writes a full message to position corresponds to 0-th code in a sequence. The rest of QR codes from the same sequence have empty string.
Returns

The boolean result.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.