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

Revision history [back]

The problem here is caused because depth images by convention are 16 bit monochrome images (1 unit encodes 1 mm of depth in most cases) but the video codecs being used in this case are only compatible with 8 bit color or mono image streams.

If you are producing this depth video with a view to using the video as sensor data and processing it into 3D information then you probably don't want to loose this resolution, however if you are producing the video just to view and are not too concerned about the exact values then there is an easy solution.

You'll want to make a simple ROS node which subscribes to the depth image topic, and converts each frame into an 8 bit mono or color image and publishes it. Then you can use the code to convert the depth camera topic into a form compatible with the video codecs.

There are many ways of doing the conversion itself. You can scale a color bar to the known depth range of your sensor, so that the pixel colors will be consistent between frames. Or you could normalise each frame individually so that the color bar is stretched to the depth range of that frame, but as the depth range of the images changes so will the coloring.

Hope this gives you some ideas.