Kinect Z depth Range selector problem

Mar 31, 2011 at 3:27pm

Kinect Z depth Range selector problem

Hello!
I am having one heck of a time tackling this problem. I am using the Kinect to do some basic hand tracking on people standing in front of an installation. The problem is that the threshold I need to isolate their hands is on an odd angle because I have to put the Kinect almost on ground level, so when i try to find the appropriate range it finds their hands and legs in the same plane. I made a simple patch using the wonderful jit.freenect.grab object and some of the demo patches that allows me to select a range within the Kinect data, but I need to be able to control the angle as well. Another way to explain what I am trying to do is be able to select a different threshold range on each horizontal line in the matrix in order to shift the threshold to a line that is perpendicular to ground level, NOT perpendicular to the kinect.

Any help is appeciated, I have attached an image that may help explain my problem.

Thanks!

[attachment=158205,2001]

#55966
Mar 31, 2011 at 4:32pm

Is it not possible to tilt the camera so that the feet (and possibly lower body) are out of the cameras range?

If that is not possible then to continue with your illustrated method you probably need to be scaling/multiplying the depth data suitably from top to bottom of the image (effectively a grayscale). Maybe with another equal sized matrix via jit. op for example that so the upper part of the scene is interpreted at a closer depth ( assuming something closer is indicated by a higher value x>1.) and the lower range is gradually de-emphasized ( x<1.).

#201096
Mar 31, 2011 at 10:14pm

Spectro,

I cant tilt it higher, or the plane becomes completely un-useable.

but as far as the second thought: Thank you, that is a really great solution! I am having problems with it however (I’m kind of an idiot when it comes to this stuff). What operator do I run it through? I have attached what I have so far, which seems to work right at boot up, but it stops working when I try to adjust the gradient. I have attached the new patch.

Thoughts?

#201097
Mar 31, 2011 at 11:47pm

your drawing is kind of odd
because the cone is symetrical from the camera
this is important for the following

if you drawing is in the plane x y

Goto http://openkinect.org/wiki/Main_Page
and find the formula to go from the cone to realspace
then translate your coordonnates ( x = x – x_offset ) to have the center
where you want your plane (green)
then do a rotation ( of the angle between your to plane )
xr = x * cos (angle ) – y * sin( angle )
yr = x * sin( angle ) + y * cos( angle )
the sign of xr give you which side of the plane you are

hope it help

#201098
Apr 1, 2011 at 3:23am

Sorry but I don’t really have too much time to get very deeply into this right now…

I think Maa’s suggestions will probably result in a more technically correct /useable transformation if you can implement it compared to the method I suggested (which may stil work anyway).

As far as your posted example goes – It appears there are two issues: jit.gradient works from left to right (rather than top to bottom as you require) so the resulting greyscale matrix needs to be rotated somehow, and 2: swapping inputs to the jit.op doing the scaling enables adjustments to the gradient without interrupting the process (also maybe try using @ op *)

HTH

#201099
Apr 4, 2011 at 3:40pm

my patch here gives you a perspective corrected 3d mesh of the kinect’s depth map. you can rotate it to make up for the camera angle and then do your tracking stuff.

http://dtr.noisepages.com/2011/02/2-methods-for-undistorting-the-kinect-depth-map-in-maxjitter/

#201100

You must be logged in to reply to this topic.