so the depthmap gives back the Z-value for each pixel in mm
(millimeters). Thus if you want to get the full 3D position (X,Y,Z) of a
pixel (u,v), then use following formula:
XnUInt64 F_;
XnDouble pixel_size_;
// get the focal length in mm (ZPS = zero plane distance)
depth_.GetIntProperty ("ZPD", F_)
// get the pixel size in mm ("ZPPS" = pixel size at zero plane)
depth_.GetRealProperty ("ZPPS", pixel_size_)
X = (u - 320) * depth_md_[k] * pixel_size_ * 0.001 / F_;
Y = (v - 240) * depth_md_[k] * pixel_size_ * 0.001 / F_;
Z = depth_md_[k] * 0.001; // from mm in meters!
I hope this helps you,
Suat
Tamir,
If you can shows us a code sample that uses that (I looked at it, but the documentation doesn't specify what the input
is), we can take a look at it to see if it's more efficient than the current way we do it in the ROS drivers. It would
be awesome to take that part of the driver out and replace it with OpenNI calls. :)
Thanks,
Radu.
--
http://pointclouds.org
Radu,
I think this may be referring to ConvertRealWorldToProjective (and
vice versa) in openni/include/ni/XnCppWrapper.h? It's used in samples
like Players.
- Ken
--
You received this message because you are subscribed to the Google Groups "OpenNI" group.
To post to this group, send email to openn...@googlegroups.com.
To unsubscribe from this group, send email to openni-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/openni-dev?hl=en.
On 12/12/2010 10:58 AM, Tamir Berliner wrote:
> Yeap, Ken is right. Thanks!
>
> Sent from a mobile device
>
> On Dec 12, 2010, at 8:52 PM, "Ken Conley" <k...@willowgarage.com <mailto:k...@willowgarage.com>> wrote:
>
>> On Sun, Dec 12, 2010 at 10:46 AM, Radu Bogdan Rusu
>> <ru...@willowgarage.com <mailto:ru...@willowgarage.com>> wrote:
>>>
>>> On 12/11/2010 04:52 AM, tamirb wrote:
>>>>
>>>> I'm not near my computer, but I'm pretty sure this is supported 'out
>>>> of the box'. Search for realworld (convert2realworld) or real world
>>>> transform in the documentation of openni or NITE and you should find a
>>>> function that takes an (x,y,z) coordinate of (pixel, pixel, mm) and
>>>> converts it to (mm,mm,mm) whereas the sensor is at (0,0,0)
>>>>
>>>> Ill try to get a better answer when I'm next to a computer (I'm from
>>>> my mobile)
>>>
>>> Tamir,
>>>
>>> If you can shows us a code sample that uses that (I looked at it, but the
>>> documentation doesn't specify what the input is), we can take a look at it
>>> to see if it's more efficient than the current way we do it in the ROS
>>> drivers. It would be awesome to take that part of the driver out and replace
>>> it with OpenNI calls. :)
>>
>> Radu,
>>
>> I think this may be referring to ConvertRealWorldToProjective (and
>> vice versa) in openni/include/ni/XnCppWrapper.h? It's used in samples
>> like Players.
>>
>> - Ken
>>
>> --
>> You received this message because you are subscribed to the Google Groups "OpenNI" group.
>> To post to this group, send email to openn...@googlegroups.com <mailto:openn...@googlegroups.com>.
>> To unsubscribe from this group, send email to openni-dev+...@googlegroups.com
>> <mailto:openni-dev+...@googlegroups.com>.