ArUco Tutorial
ArUco Tutorial
Introduction
An ArUco marker is a 5x5 grid that is black and white in color. ArUco markers
are based on Hamming code. In the grid, the first, third and fifth columns
represent parity bits. The second and fourth columns represent the data bits.
Hence, there are ten total data bits. So the maximum number of markers that can
be encoded are-
210 = 1024
Encoding
Let us consider the number 650. Its binary representation is 1010001010. There
are two data bits in each row.
Now, each row is encoded separately using slightly modified Hamming code. The
first and third parity bits are calculated using even parity while the second parity
bit uses odd parity. We get the following encoded values-
Data bit 2 Parity bit 3 Data bit 1 Parity bit 2 Parity bit1
0 0 1 0 1
0 0 1 0 1
0 0 0 1 0
0 0 1 0 1
0 0 1 0 1
We rearrange the bits in each row and get the following result: If the cell value is
0, color it black; if value is 1, color it white. This will give us the ArUco marker
Now, after finding the translational vector (tvec) and rotational vector (rvec), we
need to extract the required information from them. The distance from camera is
acquired from the Z-coordinate in the tvec. This is because we assume the object
is always on Z=0 plane and the camera is put at a distance from it. The x-
coordinate in tvec denotes the displacement between the origin object and camera
axis in x-direction. The angle is obtained from rvec. But first, we need to convert
it into a rotation matrix(R). This is done using open cv functions. After obtaining
the matrix, we compare it to the rotational matrix of y-axis.
Applications
Resources
http://www.uco.es/investiga/grupos/ava/node/26
http://iplimage.com/blog/create-markers-aruco/
http://terpconnect.umd.edu/~jwelsh12/enes100/markergen.html