lucasw / rviz_camera_stream

Custom rviz camera plugin that published rendered camera video stream
BSD 3-Clause "New" or "Revised" License
59 stars 47 forks source link

Encoding picker #14

Open jwendelmuth opened 8 years ago

jwendelmuth commented 8 years ago

Adds an EnumProperty that allows to change image encoding from rgb8/rgba8 to bgr8/bgra8.

lucasw commented 8 years ago

This isn't telling ogre to change the pixel format- when changing the encoding the underlying data doesn't change, but the colors get swapped in ros image viewers (which is wrong).

(It looks like the hardcoded encodings currently in 7839c3aedb7445a6a62f2c26aee473af41f07510 are wrong, blue and red channels are swapped, which may be the source of some confusion here.)

Ogre::RenderTarget::copyContentsToMemory docs say "See suggestPixelFormat for a tip as to the best pixel format to extract into, although you can use whatever format you like and the results will be converted.". So the user ought to be able to select from any format that both ros and ogre support (/usr/include/OGRE/OgrePixelFormat.h), and then pf will be set to that format.

It would be nice if the user could be informed what the most efficient format is if they desire low cpu usage, or at least set that as the default.

I assume having ogre originate the image in the desired format is more efficient than post processing the image with opencv to re-order color channels.