Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

unfortunately there's no builtin support for ARGB with opencv , so there's no easy, straightforward solution.

you could try a double-for loop like this:

unsigned int * pixels = new unsigned int [ 4 * img.total() ];
int k=0;
for ( int i=0; i<img.rows; i++ ) {
    for ( int j=0; j<img.rows; j++ ) {
        Vec3b p = img.at<Vec3b>(i,j);
                                 // a ( skipped )
        pixels[k]  = p[2] << 16; // r
        pixels[k] |= p[1] << 8;  // g
        pixels[k] |= p[0];       // b
        k++;
    }
}
// now process pixels

// ofc, later, you'll have to cleanup
delete [] pixels;