ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Difference between depth image types

asked 2017-12-09 16:41:50 -0600

rnunziata gravatar image

updated 2017-12-10 05:14:04 -0600

gvdhoorn gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-12-10 11:31:33 -0600

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.

edit flag offensive delete link more


Thanks...that helps....I will post my point cloud problem under a different issue with new data gleamed from this insight.

rnunziata gravatar image rnunziata  ( 2017-12-10 16:18:12 -0600 )edit

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


Asked: 2017-12-09 16:41:50 -0600

Seen: 879 times

Last updated: Dec 10 '17