0
$\begingroup$

I want to read a depth image from ros. I subscribe to the /camera/aligned_depth_to_color/image_raw/compressed topic published by a intel realsense D435i camera. I get a sensor_msgs CompressedImage ros msg, the image has a 16UC1; jpeg compressed format. I use opencv to read the image: depth_image = bridge.compressed_imgmsg_to_cv2(image_depth,desired_encoding='passthrough') but it returns an image with values between 0-255. How can I get the depth value in mm for each pixel?

$\endgroup$

1 Answer 1

0
$\begingroup$

https://github.com/IntelRealSense/realsense-ros/issues/2361#issuecomment-1160149057 and surrounding comments say to use compressedDepth instead, or uncompressed, /compressed 16UC1; jpeg compressed is unusable (because it was automatically created by ImageTransport, which in this case and others creates invalid image topics unless manually configured not to with disable_pub_plugins).

$\endgroup$
2
  • $\begingroup$ Or avoid the compression pitfalls by subscribing to the uncompressed topic .../depth/image_rect_raw $\endgroup$
    – Mike973
    Nov 1, 2023 at 15:12
  • $\begingroup$ thank you very much, I'll try this topic $\endgroup$
    – Franci
    Nov 1, 2023 at 17:59

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.