Thanks for pointing that out!
I tried to get the most out of that tutorial to do the conversion, and I just figured out the following:
convert the ros image (bgr8) to cvImage in cv_bridge by specifying the wanted encoding (rgba8).
convert this cvImage to ros msg, and publish.
When I run this script, it seems to consume quite a bit of cpu. I assume that during the first conversion, it needs lots of operations.
I just wonder if there would be a more efficient way of doing it?
Originally posted by Mikee with karma: 41 on 2013-06-21
This answer was NOT ACCEPTED on the original site
Post score: 1
Original comments
Comment by rosqueries on 2013-09-05:
i also have to publish a cvMat image in ROS...can you please tell me how can i convert the cvMat to ROS msg image?
Comment by TimboInSpace on 2014-11-17:
Were you able to get any other conversions to work? I'm trying the same thing with RGB8 > Mono16, with no luck: encoding specified as mono16, but image has incompatible type 8UC3
Edit: My stream was only coming in as RGB8. This was the default in opencv, changing that fixed it.