aruco_Dictionary
import { aruco_Dictionary } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Native object: release it with using or delete(). Factories can return null; check before calling methods.
Dictionary is a set of unique ArUco markers of the same size
bytesList storing as 2-dimensions Mat with 4-th channels (CV_8UC4 type was used) and contains the marker codewords where:
- bytesList.rows is the dictionary size
- each marker is encoded using
nbytes = ceil(markerSize*markerSize/8.)bytes - each row contains all 4 rotations of the marker, so its length is
4*nbytes - the byte order in the bytesList[i] row:
//bytes without rotation/bytes with rotation 1/bytes with rotation 2/bytes with rotation 3//SobytesList.ptr(i)[k*nbytes + j]is the j-th byte of i-th marker, in its k-th rotation.
Note: Python bindings generate matrix with shape of bytesList dictionary_size x nbytes x 4,
but it should be indexed like C++ version. Python example for j-th byte of i-th marker, in its k-th rotation:
aruco_dict.bytesList[id].ravel()[k*nbytes + j]
Constructors and members
static new
maximum number of bits that can be corrected
new(bytesList: Mat, _markerSize: number, maxcorr: number): aruco_Dictionary;3 available overloads
new(): aruco_Dictionary;new(bytesList: Mat, _markerSize: number): aruco_Dictionary;new(bytesList: Mat, _markerSize: number, maxcorr: number): aruco_Dictionary;bytesListbits for all ArUco markers in dictionary see memory layout in the class description
_markerSizeArUco marker size in units
maxcorrmaximum number of bits that can be corrected
The aruco_Dictionary result.
static getByteListFromBits
Transform matrix of bits to list of bytes with 4 marker rotations
getByteListFromBits(bits: Mat): Mat;bitsbits argument (Mat).
The Mat result. Release returned native handles with using or delete(), including handles nested in results.
static getBitsFromByteList
Transform list of bytes to matrix of bits
getBitsFromByteList(byteList: Mat, markerSize: number, rotationId: number): Mat;2 available overloads
getBitsFromByteList(byteList: Mat, markerSize: number): Mat;getBitsFromByteList(byteList: Mat, markerSize: number, rotationId: number): Mat;byteListbyte list argument (Mat).
markerSizemarker size argument (number).
rotationIdrotation id argument (number).
The Mat result. Release returned native handles with using or delete(), including handles nested in results.
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;The this result.
bytesList
marker code information. See class description for more details
bytesList: Mat;markerSize
number of bits per dimension
markerSize: number;maxCorrectionBits
maximum number of bits that can be corrected
maxCorrectionBits: number;readDictionary
Read a new dictionary from FileNode.
Dictionary example in YAML format:\n nmarkers: 35\n markersize: 6\n maxCorrectionBits: 5\n marker_0: "101011111011111001001001101100000000"\n ...\n marker_34: "011111010000111011111110110101100101"
readDictionary(fn: FileNode): boolean;fnfn argument (FileNode).
The boolean result.
writeDictionary
Write a dictionary to FileStorage, format is the same as in readDictionary().
writeDictionary(fs: FileStorage, name: EmbindString): void;2 available overloads
writeDictionary(fs: FileStorage): void;writeDictionary(fs: FileStorage, name: EmbindString): void;fsfs argument (FileStorage).
namename argument (EmbindString).
identify
Given a matrix of bits. Returns whether if marker is identified or not.
Returns reference to the marker id in the dictionary (if any) and its rotation.
identify(onlyBits: Mat, maxCorrectionRate: number): aruco_Dictionary_identifyResult;onlyBitsonly bits argument (Mat).
maxCorrectionRatemax correction rate argument (number).
The aruco_Dictionary_identifyResult result. Scalar output parameters are returned as named fields in this object. Release returned native handles with using or delete(), including handles nested in results.
identify1
Given a matrix of pixel ratio raging from 0 to 1. Returns whether if marker is identified or not.
Returns reference to the marker id in the dictionary (if any) and its rotation.
identify1(onlyCellPixelRatio: Mat, maxCorrectionRate: number, validBitIdThreshold: number): aruco_Dictionary_identify1Result;onlyCellPixelRatioonly cell pixel ratio argument (Mat).
maxCorrectionRatemax correction rate argument (number).
validBitIdThresholdvalid bit id threshold argument (number).
The aruco_Dictionary_identify1Result result. Scalar output parameters are returned as named fields in this object. Release returned native handles with using or delete(), including handles nested in results.
getDistanceToId
Returns Hamming distance of the input bits to the specific id.
If allRotations flag is set, the four possible marker rotations are considered
getDistanceToId(bits: Mat, id: number, allRotations: boolean): number;2 available overloads
getDistanceToId(bits: Mat, id: number): number;getDistanceToId(bits: Mat, id: number, allRotations: boolean): number;bitsbits argument (Mat).
idid argument (number).
allRotationsall rotations argument (boolean).
The number result.
generateImageMarker
Generate a canonical marker image
generateImageMarker(id: number, sidePixels: number, _img: Mat, borderBits: number): void;2 available overloads
generateImageMarker(id: number, sidePixels: number, _img: Mat): void;generateImageMarker(id: number, sidePixels: number, _img: Mat, borderBits: number): void;idid argument (number).
sidePixelsside pixels argument (number).
_imgOutput destination, filled by the native operation. img argument (Mat).
borderBitsborder bits argument (number).
getMarkerBits
Get ground truth bits float
getMarkerBits(markerId: number, rotationId: number): Mat;2 available overloads
getMarkerBits(markerId: number): Mat;getMarkerBits(markerId: number, rotationId: number): Mat;markerIdmarker id argument (number).
rotationIdrotation id argument (number).
The Mat result. Release returned native handles with using or delete(), including handles nested in results.
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.