0
$\begingroup$

Rosanswers logo

Trying to understand the difference between depth images and how to convert between them. I have two bag files from which I am displaying depth image topics below. The image on the left is the rgb image , the middle image is the generated via cv::imshow and the right image is via rviz.

The top seq displays a point cloud correctly but the bottom does not...and is corrupt. Why are they different and how can I transform them. Can anyone give me some insight on this.

C:\fakepath\Screenshot from 2017-12-09 17-23-19.png

C:\fakepath\Screenshot from 2017-12-09 17-24-26.png


Originally posted by rnunziata on ROS Answers with karma: 713 on 2017-12-09

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The two depth images in the top sequence in your post look different because of the different ways they're being shown on the screen, the underlying data is the same. Depth images are single channel floating point images where the pixel value is the distance from the camera in meters and zeros are used to represent unknown pixels. When you use cv::imshow with a floating point image it expects values between zero and one, so all values larger than one will be white and all values less than zero will be black. This is why your centre image is black and white. However rviz normalizes the image before it's shown so you can see the full depth range there. To get the same result with cv::imshow use the normalize function first to scale the dynamic range to the range 0-1.

I can't tell you why the two bag files are producing different results without some more information, did you capture then yourself or are they downloaded from the Internet?

Hope this helps.


Originally posted by PeteBlackerThe3rd with karma: 9529 on 2017-12-10

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by rnunziata on 2017-12-10:
Thanks...that helps....I will post my point cloud problem under a different issue with new data gleamed from this insight.

$\endgroup$

Your Answer

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