3D points for certain depth map pixels

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

3D points for certain depth map pixels

Jack14
Hi!

Suppose I would do some sort of activity recognition on the depth map produced by my kinect, which would result in identified foreground and background pixels.
If I now wanted to know to which 3D points my foreground pixels relate to, how would I do that? I need some way of calculating the 3D points for certain pixels of the depth map...

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: 3D points for certain depth map pixels

antithing
This post has NOT been accepted by the mailing list yet.
Hi... I need to do a similar thing, I have a vector of 2d pixel coordinates, and am trying to get the 3d coordinates for those pixels of the depth map. Did you have any luck solving this? Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: 3D points for certain depth map pixels

kwaegel
Administrator
This post was updated on .
antithing wrote
Hi... I need to do a similar thing, I have a vector of 2d pixel coordinates, and am trying to get the 3d coordinates for those pixels of the depth map. Did you have any luck solving this? Thanks!
I'm not sure if PCL exposes this conversion directly, but the equations are pretty simple given the camera calibration values (Cx, Cy, Fx, Fy):

inverse_focal_length = 1.f / Fx;  // Fx ~= Fy
pt.z = depth_map[depth_idx] * 0.001f; // mm to meter conversion
pt.x = (pixel.x - Cx) * pt.z * inverse_focal_length;
pt.y = (pixel.y - Cy) * pt.z * inverse_focal_length;

Referenced code.

It gets more complicated if you need to account for lens distortion.