I am currently trying to use the AndAR app (I downloaded the full one, not the sample) to calculate the camera's position in relation to the marker.
From what I've read, you get the transformation matrix in the CustomObject.java's draw method with getTransMatrix().
Basically now you have a double[16] vector in which the 3rd, 7th and 11th position give you the (X,y,z) coordinates of the center of the marker in the camera coordinate system.
Also from what I've understood, you then inverse this matrix with the following line:
ARToolkit.arUtilMatInv(getTransMatrix(),v2), where v2 will be the inverted matrix.
My main problem is that it gives me wrong values (I measured, so I know).
The x is always with an offset of +120 milimeters and the z is always more that it should be.
As for the signs of the values... It's kinda random.
From what I know, a marker has only one unchangeable coordinate system. For example, z the z axis is always perpendicular to the marker plane, and the x,y are on the marker plane.
The problem is that when I try to get the position from the inverted matrix and the camera is, let's say, at negative x and positive y coordinates, sometimes the positions are OK sign-wise, but at other times, they're completely messed up.
I've also noticed that sometimes when it comes to position, the x and y values get inverted. This just unnerves me because I don't know what causes this. Is it the methods? Is the detection that unreliable?
I need to get the correct positions because I'm making a tracking app using these markers.
Can anyone please help me?