Extract pixel values from a bitmap in Qt

December 24, 2012

The first step in writing an image processing program is usually extracting the image data from a file container such as a bitmap or jpeg file. Using Qt, the QImage class makes this easy. The QImage can open/save directly to bmp, jpeg, and other common container formats. Once a file has been opened into an instance of a QImage, the RGB pixel values can be extracted into a luminance array for processing.

Here is a code example for extraction. In this case, an array of 32-bit value is used for storage even though only the lower byte has a value.
The RGB values are mapped to the luminance vector of the YUV color space.

Entry filed under: Image Processing, Qt. Tags: .

David’s Principles of Software Development Implementation of a Laplacian filter