[PyKDE] QImage usage (PyQt3)

Danny Pansters danny at ricin.com
Mon May 1 01:29:56 BST 2006


I'm mucking around trying to get a QImage from capture hardware (USB camera). 
I'm using a simple pygame based overlay for displaying (read() a YUV frame 
then display it on an overlay). I have the raw YUV data, split out in a tuple 
as I'm already using them for displaying each frame (four Y planes 
interleaved with 1 U and 1 V, in a 2x2 (Y), 1x1 (U), 1x1 (v) <-> 2x2 (R), 2x2 
(G), 2x2 (B) mapping). I understand that much and how to get RGB data out of 
that (well, barring some fiddling probably).

But the QImage under PyQT confuses me. In

QImage(uchar *data, int w, int h, int depth, QRgb *colorTable, int numColors, 
Endian bitOrder);

what exactly is *data supposed to be? I was already converting to ints (ord) 
but that doesn't seem nescessary. Obviously I must use the total-data strings 
that I get for y, u, v and convert them, but how should the RGB(A) pixel data 
be aligned? An example?

Also, it doesn't seem to have setPixel(), so I guess that means 
gather/transform data first, instantiate the image last?

Thanks,

Dan




More information about the PyQt mailing list