1

What basically we have is modelview matrix of an OpenGL object,which gives us Rotation and Translation vectors,using these we get the real position with some calculations:

-R*t, where R is [0 4 8; 1 5 9; 2 6 10] matrix and t is [12 13 14] column vector.

In OpenCV we have screen coordinates x,y of the fingertip.

Now we need some method to compare this x,y of screen with OpenGL's real world coordinates to see which object did finger hit. We have tried gluUnProject but it did not return correct real world coordinates from the x,y.

What is the method to try here,this is using ARToolKit and OpenCV together,so modelview matrices change based on markers of AR. Also we are using ARToolkit camera module.

genpfault
  • 51,148
  • 11
  • 85
  • 139
Sameer Bagga
  • 155
  • 2
  • 3
  • 11

1 Answers1

2

Well, let me see: You've got two knowns for a system of 3 linear independent equations. So you're literally missing some information. You have a free parameter z, and if you think about it, what this gives you is not a position in space, but a ray into it (from the camera into some direction to infinity). You can gluUnProject for z=0 and z=1, which gives you two points on the ray. Then you can use that ray to test if it crosses some of your objects.

Or you do it other way round: You project each object's bounding volume to screen space (x,y) and test of your finger coordinates get in touch with it. I'd do the later.

datenwolf
  • 159,371
  • 13
  • 185
  • 298