Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ARToolkit - Position of marker

I'm using the ARToolkit for android and try to write a text over the detected marker. I want to do this using a simple TextView. So I'm only using ARToolkit to find the marker.

But how can I find out where in my camera-preview the marker is right no (I need the coordinates), so I can but the TextView over the marker?

Thanks in advance !

like image 345
ossi Avatar asked Nov 25 '25 17:11

ossi


1 Answers

Both comments are correct, ARToolkit returns both a Projection Matrix and a Transformation Matrix. Both are designed to be used with OpenGL, not with a standard Android view. The projection matrix is to be applied to the camera and the transformation one is to be applied to the object (pose matrix)

If you only want to display text, I recommend you to use the Unity plugin and then use the Unity UI components to add a canvas and a text attached to the marker. Those components are already designed to be 3D objects (if you go that way, remember to set the canvas to "World Space".

The other options you have are:

a) Render the text into a texture and draw it on a Quad, you can do that based on the example that has a cube.

b) Do some matrix calculations using both matrix and the apply transformations to the TextView on position and rotation using a transformation Matrix (the Android class). Although is possible, the math involved is rather complex. If you want it to just float looking at the camera, setTranslationX, Y and Z should be enough.

c) Link a 3D engine with text rendering capability to ARToolkit. I've done that with jPCT-AE. While this works, it takes quite a lot of work. I plan to write about it soon.

like image 136
shalafi Avatar answered Nov 28 '25 07:11

shalafi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!