MobileManipulation / rgbd_ros_to_lcm

ROS node to republish RGBD sensor data in LCM
BSD 3-Clause "New" or "Revised" License
27 stars 11 forks source link

Handle different image encodings for RGB and depth #1

Closed 5yler closed 6 years ago

5yler commented 6 years ago

Just a quick look at the RealSense SR300 and Kinect 1 image encodings shows the following differences.

RealSense:

/camera/depth_registered/sw_registered/image_rect
encoding: 32FC1
/camera/depth_registered/sw_registered/image_rect_raw
encoding: 16UC1
/camera/rgb/image_raw
encoding: rgb8
/camera/rgb/image_rect_color
encoding: rgb8

Kinect:

/camera/depth_registered/sw_registered/image_rect
encoding: 32FC1
/camera/rgb/image_raw
encoding: bayer_grbg8
/camera/rgb/image_rect_color
encoding: bgr8

At minimum, should be able to handle input formats of 16UC1 and 32FC1 for depth, rgb8 and bgr8 for RGB images without any user input required.

hpf9017 commented 5 years ago

I'm using Intel D435i to record data, and met such fault: from your comment above, dose it mean that I can ignore the fault?

[ INFO] [1569739773.005786763]: depth uncompressed_size: 614400 [ INFO] [1569739773.005811362]: depth compressed_size: 2457600 [ INFO] [1569739773.008267338]: depth compressed successfully with zlib! [ INFO] [1569739773.008307587]: memcpy to depth_lcm message complete! [ WARN] [1569739773.008568255]: Frame 1518 [ INFO] [1569739773.038899988]: RGB encoding: rgb8 [ INFO] [1569739773.038931752]: Depth encoding: 16UC1 [ INFO] [1569739773.038975501]: Stamp 1569739773007510574 [ INFO] [1569739773.038991550]: Images acquired at 1569739773007510 [ WARN] [1569739773.039006679]: Encoding is rgb8 [ERROR] [1569739773.039020826]: Depth image format is 16UC1 [ INFO] [1569739773.042977953]: depth uncompressed_size: 614400 [ INFO] [1569739773.043007079]: depth compressed_size: 2457600 [ INFO] [1569739773.046732744]: depth compressed successfully with zlib! [ INFO] [1569739773.046755879]: memcpy to depth_lcm message complete! [ WARN] [1569739773.047068130]: Frame 1519 [ INFO] [1569739773.051282669]: RGB encoding: rgb8 [ INFO] [1569739773.051310190]: Depth encoding: 16UC1 [ INFO] [1569739773.051350193]: Stamp 1569739773016918007 [ INFO] [1569739773.051363043]: Images acquired at 1569739773016918 [ WARN] [1569739773.051373983]: Encoding is rgb8 [ERROR] [1569739773.051387298]: Depth image format is 16UC1

5yler commented 5 years ago

Yes, there is no actual error, the log level of the Depth image format is 16UC1 was just set higher so that it would be more visible in the output. Please see https://github.com/MobileManipulation/rgbd_ros_to_lcm/pull/8

cwczyj commented 5 years ago

@5yler Sorry for troubling you. I want to use my kinect to collect RGB images and depth images, and I want to use your appreciate program to convert my files to lcm-* file, and use the generated file to LabelFusion. According to this issue, I can follow the steps that how RealSensor works, just like using realsense-ros. And I just put files collected by my Kinect to the above directorys correctly, then It will work. Is it Right? Thanks very much, Best Wishes

5yler commented 4 years ago

@cwczyj I believe it should be sensor independent, however I have only tested it with a RealSense. Please report back if it worked!