ros-visualization / rqt_bag

http://wiki.ros.org/rqt_bag
29 stars 53 forks source link

Fix a few minor issues in image_helper #68

Closed mjeronimo closed 3 years ago

mjeronimo commented 3 years ago

Fixes #60

Signed-off-by: Michael Jeronimo michael.jeronimo@openrobotics.org

mjeronimo commented 3 years ago

Sure, I found and fixed the sources of the "TypeError: a bytes-like object is required, not 'str'" It was missing a call to decode and is now like the code found in the plot view plugin.

obj_repr = codecs.utf_8_decode(str(obj).encode(), 'ignore')[0]

mabelzhang commented 3 years ago

I believe I still need a way to test this. If I interpret the changes correctly, 8UC1 and 32FC1 were having problems before? And maybe an image that's a RGB type got converted when it shouldn't be? Do you happen to have data at hand that expose these problems, or was this just a "oh this is obviously wrong code" kind of fix?

mjeronimo commented 3 years ago

@mabelzhang These types showed up when running rqt_bag on ROS2 and using a rosbag from realsense. The same camera resulted in different data types with ROS1. FYI, it seems from here: https://github.com/IntelRealSense/realsense-ros/issues/253, that 'mono8' is preferred, but similar images can come in as '8UC1'.

VictorLamoine commented 3 years ago

This PR creates a bug. When trying to display thumbnails/images of compressed images (JPEG) the following error is displayed:

Can't convert image: local variable 'pil_mode' referenced before assignment

Reverting this merge request solves the issue. I'm using ROS melodic

VictorLamoine commented 3 years ago

Example bag file (4.1 Mio)

path:        images_compressed.bag
version:     2.0
duration:    2.0s
start:       Sep 22 2020 14:03:24.01 (1600776204.01)
end:         Sep 22 2020 14:03:25.98 (1600776205.98)
size:        4.1 MB
messages:    60
compression: none [6/6 chunks]
types:       sensor_msgs/CompressedImage [8f7a12909da2c9d3332d540a0977563f]
topics:      /nit_gige_1/image/compressed   60 msgs    : sensor_msgs/CompressedImage
mjeronimo commented 3 years ago

@VictorLamoine Ok, thanks. I'll investigate and fix.

VictorLamoine commented 3 years ago

@mjeronimo did you find what was wrong?

mjeronimo commented 3 years ago

Commented over on the issue, https://github.com/ros-visualization/rqt_bag/issues/74, thinking you'd see it. Apologies for not notifying you directly on this thread.