# SimpleOpenNI: Check if user hand is in specific area on image

Concerning our Microsoft Kinect project, we need some help.

We control a robot with our movements tracked by the Kinect sensor. We display the depth image of the Kinect sensor on our screen, so we see what the sensor is acutally tracking.

Now we want to implement a feature that a user can turn the robot on and off by moving the hand on a specific area drawed on this depth image. You can see this in the image below. The problem now is, that the coordinates of this "on-drawed" ellipse obviously are relative in the 3d-space. I know that there must be any possibility to translate the X-, Y- and Z-coordinates of the hand in the 2d-space, but honestly, I have no idea how to do this. I imagine a kind of "tunnel" from the point of view of the sensor, like in the picture below, which the user must hit.

I hope that somebody can help us here.

• You could also create a 2d buffer (similar to your output image) for a certain depth and only use the pixels of your hand to find the centroid and determine if it's with in your circle. This of course only works if you hold your hand towards the camera. If the cam sees your complete body the centroid would be around your belly. – Sidar Jan 16 '13 at 22:32

## 1 Answer

We found a solution by using the DiABlu NXTComm's function

convertRealWorldToProjective(PVector world, PVector proj);


whichs converts the coordinates like desired. However, even if our problem now is solved, I still wonder how this convertion works in a mathematical way.