ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How do I use RegionOfInterest in sensor_msgs ?

asked 2012-02-20 10:12:16 -0500

samesimasemsom gravatar image

updated 2014-01-28 17:11:24 -0500

ngrennan gravatar image

Hey everyone,

I'm using the kinect and Openni_launch to publish a pointcloud (pcl::point<xyz>). I want to extract the distance of a point given the pixel coordinates of that point.

so lets say, in the 640x480 pixel matrix, I want to extract the depth at cell 100x100. I thought of using sensor_msgs::PointCloud2 and sensor_msgs::RegionOfInterest. But I can't find out how to make them work together.

I currently have:

void roiing(sensor_msgs::RegionOfInterest roi) { roi.x_offset = 100; roi.y_offset = 100; roi.height = 1; roi.width = 1; roi.do_rectify = false; }

and then some Functions to subscribe to topics and do processing..

The region of interest doesn't change anything and I was wondering how I can make it work ? I can't find any code online where the RegionOfInterest message is used.

Thanks

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2012-02-20 11:34:50 -0500

Is there somewhere specific that tells you to use a RegionOfInterest message? You can access a specific point from an organized pointcloud (which the openni driver produces) by using cloud.at(u,v).

Alternatively, if you just want the depth, you can subscribe to the depth image, and just index into the image, which will provide you with the depth.

edit flag offensive delete link more
0

answered 2012-02-20 12:48:38 -0500

samesimasemsom gravatar image

updated 2012-02-20 12:49:25 -0500

Thanks for you response, I was looking for such a function for days!

Alternatively, if you just want the depth, you can subscribe to the depth image, and just index into the image, which will provide you with the depth.

referring to the sensor_msgs::Image doc : http://www.ros.org/doc/api/sensor_msgs/html/msg/Image.html

How do I index the image ?

edit flag offensive delete link more

Comments

Rather than posting a new question as an "answer", please consider posing this as a new question.

joq gravatar image joq  ( 2012-02-20 13:50:10 -0500 )edit

Question Tools

Stats

Asked: 2012-02-20 10:12:16 -0500

Seen: 2,022 times

Last updated: Feb 20 '12