Offset 2D marker position?

Duchain
Posts: 8
Joined: Thu Mar 09, 2017 6:00 am

Offset 2D marker position?

Postby Duchain » Thu Apr 06, 2017 7:07 pm

Is there a way to offset the position of the marker as shown in the image below?

Image

I'm looking for something similar to how each marker is off set in:

https://artoolkit.org/documentation/dok ... rker_multi

to create a cube multimarker, but for a single 2d marker. I don't think I will have an issue with doing the maths myself, just wondering if it's already built in somewhere?

Thanks!

MrDaniel
Posts: 381
Joined: Wed Nov 18, 2015 9:07 pm

Re: Offset 2D marker position?

Postby MrDaniel » Sun Apr 09, 2017 2:08 pm

Hello Duchain,

With the multimarker approach you can apply the transform afterwards.

From the Documentation

So for example, if marker 0 in the example was rotated by angle theta about the X axis then the matrix would change to:

1.0000 0.0000 0.0000 0.0000
0.0000 cos(theta) -sin(theta) 0.0000
0.0000 sin(theta) cos(theta) 0.0000
As a further example, consider marker 01 in the cube example. Its definition is:

\#marker 2
01
40.0
1.0000 0.0000 0.0000 0.0000
0.0000 0.0000 1.0000 30.0000
0.0000 -1.0000 0.0000 -30.0000
This tells us that the origin of marker 01 is offset +30 mm in the direction of the multimarker set's y axis, and -30 mm in the direction of the multimarker set's z axis. Finally, it is rotated by -90 degrees (in a right-hand sense) around the multimarker set's positive x axis.


So your marker will need to be translated in the Z direction. So the marker center is at the joint/pivot position of the mechanical arm, with the marker created and offset in the z direction but the required length.

Hint: Your markers appear to be bending slightly, i think you need some thicker backing card if you want a good result.

Duchain
Posts: 8
Joined: Thu Mar 09, 2017 6:00 am

Re: Offset 2D marker position?

Postby Duchain » Tue Apr 11, 2017 7:01 am

Hi MrDaniel,

thanks for the reply

So what you are saying is to set each of the 2d barcodes up as their own multimarker and then create a config.dat file for each one?

MrDaniel
Posts: 381
Joined: Wed Nov 18, 2015 9:07 pm

Re: Offset 2D marker position?

Postby MrDaniel » Tue Apr 11, 2017 5:34 pm

You can relate them in 3D space using the multimarker. Or have them as separate files.

I would have single files as it might be easier to manage as the code gets more abstract.

Duchain
Posts: 8
Joined: Thu Mar 09, 2017 6:00 am

Re: Offset 2D marker position?

Postby Duchain » Sun Apr 16, 2017 6:42 pm

Got it working as you said MrDaniel(and I have started using thicker backing card).

I have run into and issue now though where the polygons I am drawing to represent axis are being culled. Can you advise, is there an option somewhere I can disable so that the polygons are always drawn/visible?

Here is a video I took to show what I mean:

https://www.youtube.com/watch?v=O5085qpDxhE&feature=youtu.be

Thanks for the help!


Here is the config.dat file incase you need to see it too:

#the number of patterns to be recognized
6

#marker 1
06
30.0
-1.0000 0.0000 0.0000 -75.0000
0.0000 1.0000 0.0000 0.0000
0.0000 0.0000 -1.0000 -20.0000

#marker 2
07
30.0
0.0000 0.0000 -1.0000 -95.0000
0.0000 1.0000 0.0000 0.0000
1.0000 0.0000 0.0000 0.0000

#marker 3
08
30.0
1.0000 0.0000 0.0000 -75.0000
0.0000 1.0000 0.0000 0.0000
0.0000 0.0000 1.0000 20.0000

#marker 4
09
30.0
-1.0000 0.0000 0.0000 75.0000
0.0000 1.0000 0.0000 0.0000
0.0000 0.0000 -1.0000 -20.0000

#marker 5
10
30.0
0.0000 0.0000 1.0000 95.0000
0.0000 1.0000 0.0000 0.0000
-1.0000 0.0000 0.0000 0.0000

#marker 6
11
30.0
1.0000 0.0000 0.0000 75.0000
0.0000 1.0000 0.0000 0.0000
0.0000 0.0000 1.0000 20.0000

MrDaniel
Posts: 381
Joined: Wed Nov 18, 2015 9:07 pm

Re: Offset 2D marker position?

Postby MrDaniel » Mon Apr 17, 2017 1:03 pm

The video link doesn't seem to go anywhere, do you have another URL?

Duchain
Posts: 8
Joined: Thu Mar 09, 2017 6:00 am

Re: Offset 2D marker position?

Postby Duchain » Mon Apr 17, 2017 6:04 pm

apologies, does this one work ok?

https://youtu.be/O5085qpDxhE

MrDaniel
Posts: 381
Joined: Wed Nov 18, 2015 9:07 pm

Re: Offset 2D marker position?

Postby MrDaniel » Tue Apr 18, 2017 1:39 pm

Now that is cool!

So when the arm is facing away, the arrows do not appear.

You could try disabling GL_FACE_CULL

glDisable(GL_CULL_FACE);

This is from a backface culling issue from another forum..

http://www.linuxquestions.org/questions ... gl-275229/

Duchain
Posts: 8
Joined: Thu Mar 09, 2017 6:00 am

Re: Offset 2D marker position?

Postby Duchain » Tue Apr 18, 2017 6:22 pm

Thanks :)

I should have mentioned that's what I initially thought too and I have that line included in my draw code but it seems more specific to the artoolkit implementation.

I am guessing that it doesn't draw anything within areas that are covered by where it thinks that markers are, after it does the translation specified in the config.dat files.

Here is an image to show what I mean, I have added the green squares myself as a representation of where Artoolkit has placed the "phantom" markers:

http://imgur.com/a/fCxmX

MrDaniel
Posts: 381
Joined: Wed Nov 18, 2015 9:07 pm

Re: Offset 2D marker position?

Postby MrDaniel » Wed Apr 19, 2017 1:06 pm

Are any other models being draw into the scene?

Also depth test, potentially this could be the issue so disable the depth test.

glDisable(GL_DEPTH_TEST);

Duchain
Posts: 8
Joined: Thu Mar 09, 2017 6:00 am

Re: Offset 2D marker position?

Postby Duchain » Wed Apr 19, 2017 3:03 pm

Depth test sorted it.

Thank you very much!


Return to “ARToolKit for Desktop v5.x”

Who is online

Users browsing this forum: No registered users and 2 guests