[Qt-interest] which QImage::Format is the right one, how to construct colortable?

Constantin Makshin cmakshin at gmail.com
Mon Jul 12 17:33:22 CEST 2010


In Qt RGB32 and ARGB32 store the bogus (for RGB32) or alpha (for ARGB32) channel in the first byte, while your camera puts that value to the last byte.

15- and 16-bit color formats are incompatible due to differences in channel order (RGB in Qt and BGR in camera).

RGB24 (IS_CM_RGB8_PACKED) and QImage::Format_RGB888 seem to be the best choice if you want to get color images. In this case each line obviously occupies "width * 3" bytes.

On Monday 12 July 2010 17:33:15 Matthias Pospiech wrote:
> I have a camera which has several ways to store the image in an array.
> I would like to chose a one which I can pass directly to a QImage, 
> however I fail to see which one is correct:
> 
> This table lists how the camera saves the images:
> http://www.ids-imaging.de/frontend/files/uEyeManuals/Manual_ger/uEye_Handbuch/index.html?sdk_allgemeines_farbformate.html
> 
> which has only few options where only one pixel is within 32 bit, or 
> aligned with 32 bit. Especially 8 bit mono versions include 4 pixel in 
> 32 bit.
> 
> Now I wonder if these match in storage:
> 
> Qt                                            -        camera format
> -----------------------------------------
> QImage::Format_RGB32    -    RGB32(8 8 8)
> QImage::Format_ARGB32   -    RGBY(8 8 8 8)
> QImage::Format_RGB16    -    BGR16(5 6 5)
> QImage::Format_RGB555   -    BGR15(5 5 5)
> QImage::Format_Indexed8 -    Mono8 (8, 8, 8, 8)
> 
> I am not familier with these storage formats, so I would appreaciate if 
> someone could
> verify that I am right or wrong.
> 
> Besides the format I also need to know how to calculate the BytesPerLine 
> (which I need to pass)
> and I wonder how a colortable would look like, which I need to pass to 
> the QImage in
> image.setColorTable( const QVector<QRgb>  colors )
> 
> Matthias



More information about the Qt-interest-old mailing list