Find distance between ArMarker and camera in ArToolkit's android java SDK -
how calculate distance betweeen smartphone camera , artoolkit marker. tried transformation matrix of marker vector value zero.
float [] pmatrix = artoolkit.getinstance().getprojectionmatrix(); float x = pmatrix[3]; float y = pmatrix[7]; float z = pmatrix[11];
x, y , z zero.
i think looking @ wrong positions in matrix. camera x,y,z inside last column of transformation matrix:
querymarkertransformation(int markerid); returns float array 16 values. values represent opengl style transformation matrix. first 4 values represent first column of matrix. i.e: float[16] = [0.24218401, 0.9598883, 0.14125957, 0.0, -0.8614648, 0.2801126, -0.42357886, 0.0, -0.44614935, -0.019116696, 0.8947546, 0.0, 23.678268, -6.4265084, -298.65326, 1.0] matrix looks like: 0.24218401 -0.8614648 -0.44614935 23.678268 0.9598883 0.2801126 -0.019116696 -6.4265084 0.14125957 -0.42357886 0.8947546 -298.65326 0.0 0.0 0.0 1.0 last column represents x,y,z in camera coordinate system.
the source here: https://www.hitl.washington.edu/artoolkit/documentation/tutorialcamera.htm believe. (but somehow cannot reach url right now)
now reading projection matrix, not transformation matrix. (https://github.com/artoolkit/artoolkit5/blob/master/androidstudioprojects/arsimpleproj/arsimple/src/main/java/org/artoolkit/ar/samples/arsimple/simplerenderer.java#l98)
if tracked down correctly value [14] should give distance marker.
update: wrote down more detailed explanation here: http://augmentmy.world/artoolkit-distance-between-camera-and-marker
Comments
Post a Comment