0
$\begingroup$

Rosanswers logo

Hello,

I am trying to get the distance to the defined object by using Astra camera with /camera/depth/image_raw topic. By using OpenCV library and RGB image from topic /camera/rgb/image_raw I have defined the object and get the center position of the object. Now I want to get the distance to that center, I read that the depth_image with 32FC1 encoding from depth topic gives you the distance of each pixel in meters. But when I am trying to do that in that way: depth = depth_image[self.position[0], self.position[1]] I got strange value like 1169 or the values which are very close to it regardless of the distance.

Could someone help me regards,


Originally posted by Yehor on ROS Answers with karma: 166 on 2019-04-03

Post score: 0

$\endgroup$
1

1 Answer 1

0
$\begingroup$

Rosanswers logo

The problem was that I mixed up height and width in the image.


Originally posted by Yehor with karma: 166 on 2019-11-05

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.