Hi Homer,<br><br>DisparityImage stores the disparity data as a binary blob (uint8[] data), but the disparities are floats. If you're using OpenCV, you can get a nice view of the data like this:<br><br><span style="font-family: courier new,monospace;">const cv::Mat_<float> dmat(disparity_msg->image.height,<br>
                           disparity_msg->image.width,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">                           (float*)&disparity_msg->image.data[0],<br>
                           disparity_msg->image.step);</span><br><br>Then do dmat(x,y) as Daniel said.<br><br>Cheers,<br>Patrick<br><br><div class="gmail_quote">On Wed, Feb 2, 2011 at 7:14 PM, Daniel Maturana <span dir="ltr"><<a href="mailto:dimatura@gmail.com">dimatura@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">It is in the image itself, that is the disparity at position x,y is at<br>
image(x,y). You could also use the Z value of the points in the point<br>
cloud.<br>
Daniel<br>
<br>
On Wed, Feb 2, 2011 at 8:28 PM, Homer Manalo<br>
<div><div></div><div class="h5"><<a href="mailto:homer.manalo@roboteknik.com">homer.manalo@roboteknik.com</a>> wrote:<br>
> Anyone knows how to get d(disparity) from the DisparityImage.msg?<br>
><br>
> On Wed, Feb 2, 2011 at 5:33 PM, Homer Manalo <<a href="mailto:homer.manalo@roboteknik.com">homer.manalo@roboteknik.com</a>><br>
> wrote:<br>
>><br>
>> According to the documentation of DisparityImage.msg:<br>
>><br>
>> <a href="http://www.ros.org/doc/api/stereo_msgs/html/msg/DisparityImage.html" target="_blank">http://www.ros.org/doc/api/stereo_msgs/html/msg/DisparityImage.html</a><br>
>><br>
>> depth can be calculated by Z=fT/d, so far I can get the minimum distance:<br>
>><br>
>>         distance = data.f*data.T/data.max_disparity<br>
>>     print "Minimum distance:", distance, "meters"<br>
>><br>
>>         Minimum distance: 0.430558934726 meters<br>
>><br>
>> How do you get d(disparity) here?<br>
>><br>
>> On Wed, Feb 2, 2011 at 11:37 AM, Homer Manalo<br>
>> <<a href="mailto:homer.manalo@roboteknik.com">homer.manalo@roboteknik.com</a>> wrote:<br>
>>><br>
>>> Ok, so I need to manually extract this? Or is there a command to show<br>
>>> this up? Which one is it contained:<br>
>>><br>
>>> [sensor_msgs/PointCloud2]:<br>
>>> Header header<br>
>>>   uint32 seq<br>
>>>   time stamp<br>
>>>   string frame_id<br>
>>> uint32 height<br>
>>> uint32 width<br>
>>> sensor_msgs/PointField[] fields<br>
>>>   uint8 INT8=1<br>
>>>   uint8 UINT8=2<br>
>>>   uint8 INT16=3<br>
>>>   uint8 UINT16=4<br>
>>>   uint8 INT32=5<br>
>>>   uint8 UINT32=6<br>
>>>   uint8 FLOAT32=7<br>
>>>   uint8 FLOAT64=8<br>
>>>   string name<br>
>>>   uint32 offset<br>
>>>   uint8 datatype<br>
>>>   uint32 count<br>
>>> bool is_bigendian<br>
>>> uint32 point_step<br>
>>> uint32 row_step<br>
>>> uint8[] data<br>
>>> bool is_dense<br>
>>><br>
>>> [stereo_msgs/DisparityImage]:<br>
>>> Header header<br>
>>>   uint32 seq<br>
>>>   time stamp<br>
>>>   string frame_id<br>
>>> sensor_msgs/Image image<br>
>>>   Header header<br>
>>>     uint32 seq<br>
>>>     time stamp<br>
>>>     string frame_id<br>
>>>   uint32 height<br>
>>>   uint32 width<br>
>>>   string encoding<br>
>>>   uint8 is_bigendian<br>
>>>   uint32 step<br>
>>>   uint8[] data<br>
>>> float32 f<br>
>>> float32 T<br>
>>> sensor_msgs/RegionOfInterest valid_window<br>
>>>   uint32 x_offset<br>
>>>   uint32 y_offset<br>
>>>   uint32 height<br>
>>>   uint32 width<br>
>>> float32 min_disparity<br>
>>> float32 max_disparity<br>
>>> float32 delta_d<br>
>>><br>
>>><br>
>>> Thanks,<br>
>>> Homer<br>
>>><br>
>>> On Wed, Feb 2, 2011 at 11:17 AM, Daniel Maturana <<a href="mailto:dimatura@gmail.com">dimatura@gmail.com</a>><br>
>>> wrote:<br>
>>>><br>
>>>> Both the the disparity and the points2 messages have the information<br>
>>>> you need. Note that your camera should be calibrated.<br>
>>>> best,<br>
>>>> Daniel<br>
>>>><br>
>>>> On Tue, Feb 1, 2011 at 8:13 PM, Homer Manalo<br>
>>>> <<a href="mailto:homer.manalo@roboteknik.com">homer.manalo@roboteknik.com</a>> wrote:<br>
>>>> > I've actually used it for viewing disparity and rectifying images.<br>
>>>> > What<br>
>>>> > topic exactly are you referring to?<br>
>>>> ><br>
>>>> > Homer<br>
>>>> ><br>
>>>> > On Tue, Feb 1, 2011 at 11:43 PM, Daniel Maturana <<a href="mailto:dimatura@gmail.com">dimatura@gmail.com</a>><br>
>>>> > wrote:<br>
>>>> >><br>
>>>> >> Try <a href="http://www.ros.org/wiki/stereo_image_proc" target="_blank">http://www.ros.org/wiki/stereo_image_proc</a>.<br>
>>>> >> Daniel<br>
>>>> >><br>
>>>> >> On Tue, Feb 1, 2011 at 4:13 AM, Homer Manalo<br>
>>>> >> <<a href="mailto:homer.manalo@roboteknik.com">homer.manalo@roboteknik.com</a>> wrote:<br>
>>>> >> > Are there packages that convert stereo data into real world<br>
>>>> >> > measurements<br>
>>>> >> > -<br>
>>>> >> > how far an object is from camera?<br>
>>>> >> ><br>
>>>> >> > Thanks,<br>
>>>> >> > Homer<br>
>>>> >> ><br>
>>>> >> > _______________________________________________<br>
>>>> >> > ros-users mailing list<br>
>>>> >> > <a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
>>>> >> > <a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
>>>> >> ><br>
>>>> >> ><br>
>>>> >> _______________________________________________<br>
>>>> >> ros-users mailing list<br>
>>>> >> <a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
>>>> >> <a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
>>>> ><br>
>>>> ><br>
>>><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> ros-users mailing list<br>
> <a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
> <a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
><br>
><br>
_______________________________________________<br>
ros-users mailing list<br>
<a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
<a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
</div></div></blockquote></div><br>