Skip to content

Commit e42fbaf

Browse files
set 'png' compression format for depth images
By default the compressed_image_transport is using the jpeg format. This is a lossy compression format which introduces compression artefacts which are not visible in colour images, but corrupt the 16bit depth images. Change the depth compression to the lossless png format to keep the original data when decompressing depth images.
1 parent 677751f commit e42fbaf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/gazebo_ros_realsense.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ void GazeboRosRealsense::Load(physics::ModelPtr _model, sdf::ElementPtr _sdf) {
4040

4141
this->itnode_ = new image_transport::ImageTransport(*this->rosnode_);
4242

43+
// set 'png' compression format for depth images
44+
rosnode_->setParam(rosnode_->resolveName(cameraParamsMap_[DEPTH_CAMERA_NAME].topic_name) + "/compressed/format", "png");
45+
rosnode_->setParam(rosnode_->resolveName(cameraParamsMap_[DEPTH_CAMERA_NAME].topic_name) + "/compressed/png_level", 1);
46+
4347
this->color_pub_ = this->itnode_->advertiseCamera(
4448
cameraParamsMap_[COLOR_CAMERA_NAME].topic_name, 2);
4549
this->ir1_pub_ = this->itnode_->advertiseCamera(

0 commit comments

Comments
 (0)