industrial_reconstruction icon indicating copy to clipboard operation
industrial_reconstruction copied to clipboard

Depth image encoding is hard-coded

Open gavanderhoorn opened this issue 2 years ago • 1 comments

The current implementation appears to hard-code the expected image encoding of the depth image:

https://github.com/ros-industrial/industrial_reconstruction/blob/2cf137d2941be6425bc4908e70c0cc1a2fc34c63/industrial_reconstruction/industrial_reconstruction/industrial_reconstruction.py#L288-L288

it doesn't do this for the regular RGB images:

https://github.com/ros-industrial/industrial_reconstruction/blob/2cf137d2941be6425bc4908e70c0cc1a2fc34c63/industrial_reconstruction/industrial_reconstruction/industrial_reconstruction.py#L289-L289

Looking at various drivers, there are two main 'types' of depth images:

  • 16-bit unsigned with depth in mm (16UC1)
  • 32-bit float with depth in m (32FC1)

At least in ROS 1, the depth_image_proc/convert_metric nodelet can be used to convert between the two types.

The hard-coded 16UC1 (and the existence of the depth_scale parameter) implies the first is expected and has been used when developing industrial_reconstruction. The code as-is is incompatible with the second type.

Would it be desirable to remove the hard-coding and rely on what is set in sensor_msgs::msgs::Image::encoding field instead?

gavanderhoorn avatar Sep 13 '22 17:09 gavanderhoorn

Would it be desirable to remove the hard-coding and rely on what is set in sensor_msgs::msgs::Image::encoding field instead?

Yes, this would definitely be preferable. Upon initial creation of this node I had some issues trying to do that, so I just ran with what would work for the initial application. It sounds like you and @Aashish-TUD have an application using different camera encodings than what I've used in the past, if you guys have a working change for that I would definitely want to merge that in.

marrts avatar Sep 13 '22 18:09 marrts