[ros-users] Stereo, distance measurement

Homer Manalo homer.manalo at roboteknik.com
Thu Feb 3 12:13:24 UTC 2011


Thanks very much though I'm fairly new to c++ and python so I don't much
understand what I need to do here so I guess I need to study c++ and python
more. I can actually get the disparity data but I get integers (actually
string, I learned later that uint8 in python is string, then just converted
it) which Patrick said their floats. I'm not sure how to get the Z value
from pointcloud, when I print the data it's much like the disparity data
ranging from 0-255, I guess it's attributable to my lack of programming
skills. I suggest that a standard msg for distance would be created
something like /stereo/Distance ;-). I'll still be working on this until I
get it right. thanks

On Thu, Feb 3, 2011 at 11:25 AM, Patrick Mihelich <mihelich at willowgarage.com
> wrote:

> Hi Homer,
>
> 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:
>
> const cv::Mat_<float> dmat(disparity_msg->image.height,
>                            disparity_msg->image.width,
>                            (float*)&disparity_msg->image.data[0],
>                            disparity_msg->image.step);
>
> Then do dmat(x,y) as Daniel said.
>
> Cheers,
> Patrick
>
>
> On Wed, Feb 2, 2011 at 7:14 PM, Daniel Maturana <dimatura at gmail.com>wrote:
>
>> It is in the image itself, that is the disparity at position x,y is at
>> image(x,y). You could also use the Z value of the points in the point
>> cloud.
>> Daniel
>>
>> On Wed, Feb 2, 2011 at 8:28 PM, Homer Manalo
>> <homer.manalo at roboteknik.com> wrote:
>> > Anyone knows how to get d(disparity) from the DisparityImage.msg?
>> >
>> > On Wed, Feb 2, 2011 at 5:33 PM, Homer Manalo <
>> homer.manalo at roboteknik.com>
>> > wrote:
>> >>
>> >> According to the documentation of DisparityImage.msg:
>> >>
>> >> http://www.ros.org/doc/api/stereo_msgs/html/msg/DisparityImage.html
>> >>
>> >> depth can be calculated by Z=fT/d, so far I can get the minimum
>> distance:
>> >>
>> >>         distance = data.f*data.T/data.max_disparity
>> >>     print "Minimum distance:", distance, "meters"
>> >>
>> >>         Minimum distance: 0.430558934726 meters
>> >>
>> >> How do you get d(disparity) here?
>> >>
>> >> On Wed, Feb 2, 2011 at 11:37 AM, Homer Manalo
>> >> <homer.manalo at roboteknik.com> wrote:
>> >>>
>> >>> Ok, so I need to manually extract this? Or is there a command to show
>> >>> this up? Which one is it contained:
>> >>>
>> >>> [sensor_msgs/PointCloud2]:
>> >>> Header header
>> >>>   uint32 seq
>> >>>   time stamp
>> >>>   string frame_id
>> >>> uint32 height
>> >>> uint32 width
>> >>> sensor_msgs/PointField[] fields
>> >>>   uint8 INT8=1
>> >>>   uint8 UINT8=2
>> >>>   uint8 INT16=3
>> >>>   uint8 UINT16=4
>> >>>   uint8 INT32=5
>> >>>   uint8 UINT32=6
>> >>>   uint8 FLOAT32=7
>> >>>   uint8 FLOAT64=8
>> >>>   string name
>> >>>   uint32 offset
>> >>>   uint8 datatype
>> >>>   uint32 count
>> >>> bool is_bigendian
>> >>> uint32 point_step
>> >>> uint32 row_step
>> >>> uint8[] data
>> >>> bool is_dense
>> >>>
>> >>> [stereo_msgs/DisparityImage]:
>> >>> Header header
>> >>>   uint32 seq
>> >>>   time stamp
>> >>>   string frame_id
>> >>> sensor_msgs/Image image
>> >>>   Header header
>> >>>     uint32 seq
>> >>>     time stamp
>> >>>     string frame_id
>> >>>   uint32 height
>> >>>   uint32 width
>> >>>   string encoding
>> >>>   uint8 is_bigendian
>> >>>   uint32 step
>> >>>   uint8[] data
>> >>> float32 f
>> >>> float32 T
>> >>> sensor_msgs/RegionOfInterest valid_window
>> >>>   uint32 x_offset
>> >>>   uint32 y_offset
>> >>>   uint32 height
>> >>>   uint32 width
>> >>> float32 min_disparity
>> >>> float32 max_disparity
>> >>> float32 delta_d
>> >>>
>> >>>
>> >>> Thanks,
>> >>> Homer
>> >>>
>> >>> On Wed, Feb 2, 2011 at 11:17 AM, Daniel Maturana <dimatura at gmail.com>
>> >>> wrote:
>> >>>>
>> >>>> Both the the disparity and the points2 messages have the information
>> >>>> you need. Note that your camera should be calibrated.
>> >>>> best,
>> >>>> Daniel
>> >>>>
>> >>>> On Tue, Feb 1, 2011 at 8:13 PM, Homer Manalo
>> >>>> <homer.manalo at roboteknik.com> wrote:
>> >>>> > I've actually used it for viewing disparity and rectifying images.
>> >>>> > What
>> >>>> > topic exactly are you referring to?
>> >>>> >
>> >>>> > Homer
>> >>>> >
>> >>>> > On Tue, Feb 1, 2011 at 11:43 PM, Daniel Maturana <
>> dimatura at gmail.com>
>> >>>> > wrote:
>> >>>> >>
>> >>>> >> Try http://www.ros.org/wiki/stereo_image_proc.
>> >>>> >> Daniel
>> >>>> >>
>> >>>> >> On Tue, Feb 1, 2011 at 4:13 AM, Homer Manalo
>> >>>> >> <homer.manalo at roboteknik.com> wrote:
>> >>>> >> > Are there packages that convert stereo data into real world
>> >>>> >> > measurements
>> >>>> >> > -
>> >>>> >> > how far an object is from camera?
>> >>>> >> >
>> >>>> >> > Thanks,
>> >>>> >> > Homer
>> >>>> >> >
>> >>>> >> > _______________________________________________
>> >>>> >> > ros-users mailing list
>> >>>> >> > ros-users at code.ros.org
>> >>>> >> > https://code.ros.org/mailman/listinfo/ros-users
>> >>>> >> >
>> >>>> >> >
>> >>>> >> _______________________________________________
>> >>>> >> ros-users mailing list
>> >>>> >> ros-users at code.ros.org
>> >>>> >> https://code.ros.org/mailman/listinfo/ros-users
>> >>>> >
>> >>>> >
>> >>>
>> >>
>> >
>> >
>> > _______________________________________________
>> > ros-users mailing list
>> > ros-users at code.ros.org
>> > https://code.ros.org/mailman/listinfo/ros-users
>> >
>> >
>> _______________________________________________
>> ros-users mailing list
>> ros-users at code.ros.org
>> https://code.ros.org/mailman/listinfo/ros-users
>>
>
>
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20110203/998697ff/attachment-0003.html>


More information about the ros-users mailing list