-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix a few minor issues in image_helper #68
Conversation
152b6c0
to
65a6482
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dependent on #67.
Is there an easy way to test this?
If I right-click on an image thumbnail > View > Raw, then I still see some errors that sound related to the fix here. Maybe that can be fixed at the same time?
Traceback (most recent call last):
File "/home/developer/viper/catkin_ws/install_isolated/lib/python3/dist-packages/rqt_bag/plugins/message_view.py", line 93, in event
self.message_viewed(bag, msg_data)
File "/home/developer/viper/catkin_ws/install_isolated/lib/python3/dist-packages/rqt_bag/plugins/raw_view.py", line 73, in message_viewed
self.message_tree.set_message(msg)
File "/home/developer/viper/catkin_ws/install_isolated/lib/python3/dist-packages/rqt_bag/plugins/raw_view.py", line 115, in set_message
self._add_msg_object(None, '', '', msg, msg._type)
File "/home/developer/viper/catkin_ws/install_isolated/lib/python3/dist-packages/rqt_bag/plugins/raw_view.py", line 239, in _add_msg_object
self._add_msg_object(item, subpath, subobj_name, subobj, subobj_type)
File "/home/developer/viper/catkin_ws/install_isolated/lib/python3/dist-packages/rqt_bag/plugins/raw_view.py", line 239, in _add_msg_object
self._add_msg_object(item, subpath, subobj_name, subobj, subobj_type)
File "/home/developer/viper/catkin_ws/install_isolated/lib/python3/dist-packages/rqt_bag/plugins/raw_view.py", line 207, in _add_msg_object
obj_repr = codecs.utf_8_decode(str(obj), 'ignore')[0]
TypeError: a bytes-like object is required, not 'str'
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.
|
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? |
@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: IntelRealSense/realsense-ros#253, that 'mono8' is preferred, but similar images can come in as '8UC1'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mono8 and 8UC1 link looks reasonable.
I was able to test the L and BGR change - it does affect Melodic where CompressedImage was showing up blue where it should have been red. In Noetic CompressedImages are currently not shown, so it's not seen.
I did not have 32FC1 data to test those additions, but they look reasonable enough.
* Used ByteIO rather than StringIO is now required for PIL's Image.open * Remove unused variable, 'alpha' * Added support for '8UC1' and '32FC1' image types * Only do bgr2rgb if it's definitely a BGR type Fixes #60 Signed-off-by: Michael Jeronimo <[email protected]>
Signed-off-by: Michael Jeronimo <[email protected]>
2741dce
to
9f26c06
Compare
This PR creates a bug. When trying to display thumbnails/images of compressed images (JPEG) the following error is displayed:
Reverting this merge request solves the issue. I'm using ROS melodic |
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 |
@VictorLamoine Ok, thanks. I'll investigate and fix. |
@mjeronimo did you find what was wrong? |
Commented over on the issue, #74, thinking you'd see it. Apologies for not notifying you directly on this thread. |
Fixes #60
Signed-off-by: Michael Jeronimo [email protected]