I am currently trying to write a simple AR application, in particular, I am trying to calculate the translation between two square markers, similar to how they do it on this website below: Artoolkit
The markers I use are the same size (100 mm x 100 mm), and my image does not have camera distortion (I am using a test image at the moment).
My process currently performs the following steps:
- Detecting markers from an image and extracting angles.
- Launch Co-planar POSIT based on marker angles.
- Given 2 marker conversions (A and B), calculate Inverse (A) * B
- Decompose capture of markers B x, y and z relative to marker A.
The problem is that my results seem to be completely disconnected. The screen of the program is shown below:

Orange squares are corners, I checked them and they are correct.
I overlapped the axes with XNA. I use AForge.net for coplanar POSITION. Image of 640x480. Coplanar posit knows that the markers are 100 mm and the focal length is 640.
The exact code I run for this in C # is:
private void computePOSIT() { matrixes.Clear(); AForge.Math.Matrix3x3 matrix; AForge.Math.Vector3 trans; foreach (Marker m in markers) { AForge.Point[] points = new AForge.Point[4]; for (int i = 0; i < 4; i++) { points[i] = new AForge.Point(m.corners[i].X-320 ,240 - m.corners[i].Y); } posit.EstimatePose(points, out matrix, out trans); float yaw, pitch, roll; matrix.ExtractYawPitchRoll(out yaw, out pitch, out roll); Matrix rotation = Matrix.CreateFromYawPitchRoll(-yaw, -pitch, roll); Matrix translation = Matrix.CreateTranslation(new Vector3(trans.X, trans.Y, -trans.Z)); Matrix complete = rotation * translation; List<Matrix> all = new List<Matrix>(); all.Add(rotation); all.Add(translation); all.Add(complete); matrixes.Add(all); } Matrix res = Matrix.Invert(matrixes[0][4]) * matrixes[1][5]; Vector3 scaleR; Vector3 translationR; Quaternion rotationR; res.Decompose(out scaleR, out rotationR, out translationR); }
The resulting matrix shows that:
Translation: X: -402.2295 Y: 191.7873 Z: -135.3166} RotationR: {X: 0.007288148 Y: -0.4478231 Z: -0.5093549 W: 0.734819} scaleR: 1,1,1
Update: I fixed the POSIT problem and now the axes are aligned correctly, however the translation problem does not exist yet. Has my math correctly developed a relative translation?