Closed johnwason closed 6 years ago
Setting line 127 of camera_display.cpp to a static pixel format seems to fix the problem:
Ogre::PixelFormat pf = Ogre::PF_B8G8R8;
Using the Ogre:PF_BYTE_RGB is a better option. It is machine independent endian.
Ogre::PixelFormat pf = Ogre::PF_BYTE_RGB;
I've been sloppy with branches here- 1c409a5ff9ca4cd775e9846306ec4923a8a73df8 is likely a fix but I've only applied it in the librviz_node branch (the intent of that branch is an experiment that probably belongs in a standalone repo).
I cherry picked 1c409a5 to 02b6410647c1fbc043bd889a72303aad932841d1- pull and see if that works for you.
Based on the Ogre user manual, PF_B8G8R8 and friends use the local machine endian, while PF_BYTE_RGB and friends always use "standard" endian. (I forget if BGR or RGB is "standard" endian for binary data.)
Taken from OgrePixelFormat.h
#if OGRE_ENDIAN == OGRE_ENDIAN_BIG
/// 3 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue
PF_BYTE_RGB = PF_R8G8B8,
/// 3 byte pixel format, 1 byte for blue, 1 byte for green, 1 byte for red
PF_BYTE_BGR = PF_B8G8R8,
/// 4 byte pixel format, 1 byte for blue, 1 byte for green, 1 byte for red and one byte for alpha
PF_BYTE_BGRA = PF_B8G8R8A8,
/// 4 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue, and one byte for alpha
PF_BYTE_RGBA = PF_R8G8B8A8,
#else
/// 3 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue
PF_BYTE_RGB = PF_B8G8R8,
/// 3 byte pixel format, 1 byte for blue, 1 byte for green, 1 byte for red
PF_BYTE_BGR = PF_R8G8B8,
/// 4 byte pixel format, 1 byte for blue, 1 byte for green, 1 byte for red and one byte for alpha
PF_BYTE_BGRA = PF_A8R8G8B8,
/// 4 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue, and one byte for alpha
PF_BYTE_RGBA = PF_A8B8G8R8,
#endif
Based on this, you should probably be using the PFBYTE* pixel formats. The inconsistency explains why the channels are being flipped.
Closing with above commit 00b20d7
The computer I'm on now has PF_X8R8G8B8
(26) as the suggested pixel format.
The images published from rviz have the red and blue channels swapped. Most likely there is an inconsistency in the RGB byte order.