ros-perception / ros-perception/image_common
image_transport::SubscriberFilter decodes 16bit png to 8bit
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 153
- Forks
- 253
- Avg merge
- 5m
- Merged PRs (30d)
- 1
Description
I am publishing a png compressed depth image in python via:
msg_dimg_compr = self.cvbridge.cv2_to_compressed_imgmsg(dimg, dst_format="png")
to /camera/depth/image_rect_raw/compressed, where dimg is a single channel 16bit (np.uint16) image.
This seems to work fine since manually decoding the raw data (e.g. as in PR https://github.com/ros-perception/vision_opencv/pull/228) gives me the same 16bit image.
But using a image_transport::SubscriberFilter for synchronisation in C++ like:
image_transport::SubscriberFilter sub_image_depth;
sub_image_depth.subscribe(...);
sync_rgbd = message_filters::Synchronizer<ApproximateTime...>(sub_image_depth, ...);
sync_rgbd.registerCallback(sync_cb);
gives me a mono8 instead of a mono16 image in the callback:
void sync_cb(sensor_msgs::ImageConstPtr depth_img_msg, ....) {
depth_img_msg->encoding; // <- this is "mono8" instead of "mono16"
}
This might be related to https://github.com/ros-perception/image_common/issues/77 and https://github.com/ros-perception/vision_opencv/issues/206. I.e. images need to be decoded using the IMREAD_UNCHANGED flag.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the image_transport::SubscriberFilter compressed-image decoding path and compare it with the IMREAD_UNCHANGED behavior referenced in the issue. Use the provided single-channel uint16 PNG reproduction and confirm that the synchronizer callback preserves the mono16 encoding.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100