Skip to content

aruco_Dictionary

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

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

ARGUMENTSConstructor or factory
CLASSaruco_Dictionary
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.

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// So bytesList.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;
bytesList

bits for all ArUco markers in dictionary see memory layout in the class description

_markerSize

ArUco marker size in units

maxcorr

maximum number of bits that can be corrected

Returns

The aruco_Dictionary result.

static getByteListFromBits

Transform matrix of bits to list of bytes with 4 marker rotations

getByteListFromBits(bits: Mat): Mat;
bits

bits argument (Mat).

Returns

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;
byteList

byte list argument (Mat).

markerSize

marker size argument (number).

rotationId

rotation id argument (number).

Returns

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;
Returns

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;
fn

fn argument (FileNode).

Returns

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;
fs

fs argument (FileStorage).

name

name 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;
onlyBits

only bits argument (Mat).

maxCorrectionRate

max correction rate argument (number).

Returns

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;
onlyCellPixelRatio

only cell pixel ratio argument (Mat).

maxCorrectionRate

max correction rate argument (number).

validBitIdThreshold

valid bit id threshold argument (number).

Returns

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;
bits

bits argument (Mat).

id

id argument (number).

allRotations

all rotations argument (boolean).

Returns

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;
id

id argument (number).

sidePixels

side pixels argument (number).

_img

Output destination, filled by the native operation. img argument (Mat).

borderBits

border 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;
markerId

marker id argument (number).

rotationId

rotation id argument (number).

Returns

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.