PDA

View Full Version : Help For Video Programming Using Wecam



mahiapkum
23rd April 2008, 14:35
I am using Qt 3.3.6 version and the application is for displaying images captured from webcam in a window can anyone help pls below is the code:

This is video capture loop:


void Video::captureloop()
{
unsigned char *raw_buf;
img = new QImage(352, 288, 32, 0, QImage::IgnoreEndian);
while(1)
{
raw_buf = read_test(0); ////////This function fetches fresh frames and returns the buffer pointer having the image data////////

memcpy(img->bits(), raw_buf, 304128);
update();
}
}

This is paint event function:

void Video:aintEvent( QPaintEvent * )
{
QPainter paint( this );
if ( img )
{
paint.drawImage(0, 0, *img, 0, 0, -1, -1, 0 );
}
}