Ask Your Question
0

Problem with amcl_demo.launch and depth data from camera/depth/image

asked 2015-04-22 08:51:45 -0500

Phelipe gravatar image

updated 2015-04-22 11:23:08 -0500

Hi! I'm having some troubles using the amcl_demo.launch, because i need to get the depth information from the camera/depth/image which the openni.launch initializes (and is initialized by amcl_demo.launch). But using the amcl_demo.launch the only topic i can acess to get this depth data is camera/depth/image_raw, but nothing happens in it apparently (i checked using image_view).

I've checked at this question and followed the instructions by changing that parameters in amcl_demo.launch but i still can't make this work.

Using the openni.launch, it's possible to get the depth information perfectly from the topic /camera/depth/image. To get the depth data as well as i did from /camera/depth/image (from another topic like /camera/depth_registered/image_raw), do i need to convert the image before using ?

My code calculates the distance from an object, and with the /camera/depth/image launched by openni.launch it's possible to calculate as follow (not exactly this, i just copied the important parts):

cv_bridge::CvImagePtr Dest;
Dest = cv_bridge::toCvCopy(img);
ROI = Dest->image(cv::Rect(rect));
cv::Scalar average = cv::mean(ROI.at<float>());

I'd like to know how can i calculate the distance from the topic /camera/depth/image_raw, or another one that provides the depth information. (changing as less as possible this code)

EDIT: With depth_registration activated in amcl_demo.launch, the topics /camera/depth_registered/image_raw and /camera/depth_registered/image doesn't publish data, the only one publishing is /camera/depth/image_raw but its type does not follow the one i'm using, i've tried to convert using this: Dest = cv_bridge::toCvCopy(img,sensor_msgs::image_encodings::TYPE_16UC1); but i got 0 meters distance. What am i doing wrong?

Thanks in advance!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-04-22 12:28:35 -0500

Phelipe gravatar image

updated 2015-04-22 12:29:10 -0500

I guess i found the solution:

Using the /camera/depth_registered/image_raw and setting depth_registration true in amcl_demo.launch, my CallBack function is converting the image to a 32-bit float type as follow: Dest = cv_bridge::toCvCopy(img,sensor_msgs::image_encodings::TYPE_32FC1); .

The difference between this topic and that /camera/depth/image is that this one gives me the distance in mm, and the other one provides the distance in m.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-04-22 08:51:45 -0500

Seen: 191 times

Last updated: Apr 22 '15