ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

I've just had a quick look at the source code for this and it seems the encoding option is not implemented. It's actually hard coded to use bgr8 and ignores whatever you specify as the encoding!

Since It's a python file you could dig in and change the hard coded encoding format yourself or get it to use the encoding value correctly.

Hope this helps.

I've just had a quick look at the source code for this and it seems the encoding option is not implemented. It's actually hard coded to use bgr8 and ignores whatever you specify as the encoding!

Since It's a python file you could dig in and change the hard coded encoding format yourself or get it to use the encoding value correctly.

Hope this helps.

Update:

You'll need to change line 53 which is currently:

img = np.asarray(bridge.imgmsg_to_cv2(msg, 'bgr8'))

so that the encoding you want to use is in the inverted commas instead such as

img = np.asarray(bridge.imgmsg_to_cv2(msg, 'mono8'))