Table of Contents

Class Dictionary

Namespace
OpenCvSharp.Aruco
Assembly
OpenCvSharp.dll

Dictionary/Set of markers. It contains the inner codification

public class Dictionary : CvObject, IDisposable
Inheritance
Dictionary
Implements
Inherited Members

Constructors

Dictionary()

Creates an empty dictionary.

public Dictionary()

Dictionary(Mat, int, int)

Basic ArUco dictionary constructor

public Dictionary(Mat bytesList, int markerSize, int maxCorrectionBits = 0)

Parameters

bytesList Mat

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

markerSize int

ArUco marker size in units

maxCorrectionBits int

maximum number of bits that can be corrected

Properties

BytesList

Marker code information

public Mat BytesList { get; }

Property Value

Mat

MarkerSize

Number of bits per dimension.

public int MarkerSize { get; set; }

Property Value

int

MaxCorrectionBits

Maximum number of bits that can be corrected.

public int MaxCorrectionBits { get; set; }

Property Value

int

Methods

GenerateImageMarker(int, int, OutputArray, int)

Generate a canonical marker image

public void GenerateImageMarker(int id, int sidePixels, OutputArray img, int borderBits = 1)

Parameters

id int
sidePixels int
img OutputArray
borderBits int

GetBitsFromByteList(Mat, int, int)

Transform list of bytes to matrix of bits

public static Mat GetBitsFromByteList(Mat byteList, int markerSize, int rotationId = 0)

Parameters

byteList Mat
markerSize int
rotationId int

Returns

Mat

GetByteListFromBits(Mat)

Transform matrix of bits to list of bytes in the 4 rotations

public static Mat GetByteListFromBits(Mat bits)

Parameters

bits Mat

Returns

Mat

GetDistanceToId(InputArray, int, bool)

Returns the distance of the input bits to the specific id. If allRotations is true, the four possible bits rotation are considered

public int GetDistanceToId(InputArray bits, int id, bool allRotations = true)

Parameters

bits InputArray
id int
allRotations bool

Returns

int

GetMarkerBits(int, int)

Get ground truth bits float

public Mat GetMarkerBits(int markerId, int rotationId = 0)

Parameters

markerId int
rotationId int

Returns

Mat

Identify(Mat, out int, out int, double)

Given a matrix of bits. Returns whether if marker is identified or not. It returns by reference the correct id (if any) and the correct rotation

public bool Identify(Mat onlyBits, out int idx, out int rotation, double maxCorrectionRate)

Parameters

onlyBits Mat
idx int
rotation int
maxCorrectionRate double

Returns

bool

Identify(Mat, out int, out int, double, float)

Given a matrix of pixel ratio ranging from 0 to 1. Returns whether if marker is identified or not. It returns by reference the correct id (if any) and the correct rotation

public bool Identify(Mat onlyCellPixelRatio, out int idx, out int rotation, double maxCorrectionRate, float validBitIdThreshold)

Parameters

onlyCellPixelRatio Mat
idx int
rotation int
maxCorrectionRate double
validBitIdThreshold float

acceptable threshold when comparing the detected marker to the dictionary during marker identification.

Returns

bool

ReadDictionary(FileNode)

Read a new dictionary from FileNode.

public bool ReadDictionary(FileNode fn)

Parameters

fn FileNode

the FileNode to read the dictionary from.

Returns

bool

WriteDictionary(FileStorage, string)

Write a dictionary to FileStorage, format is the same as in ReadDictionary().

public void WriteDictionary(FileStorage fs, string name = "")

Parameters

fs FileStorage

the FileStorage to write the dictionary to.

name string

name of the node to write.