PDA

View Full Version : Video



mahiapkum
22nd April 2008, 09:09
Hi,
I have an application which uses webcam and i need to capture the image and display the image continuosly in a window.I am able to capture the image and m getting the buffer which has the image data.Now how will i display this data in a window???presently i am using QImage,but the quality of the image is very bad.Any help is appreciated.Thanks in advance...

aamer4yu
22nd April 2008, 11:06
What does it mean that image quality is bad ??
are u displaying the image in the same resolution as it i aptured ? whats the resolution of the camera ?

mahiapkum
22nd April 2008, 11:36
In the sense i get a feeling of viewing the negative of a film...resolution of the cam is 352x288,the camera works fine with xawtv and gqcam.I am using the same resolution to display the image.

mahiapkum
22nd April 2008, 12:38
I am using Qt 3.3.6 version and here 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::paintEvent( QPaintEvent * )
{
QPainter paint( this );
if ( img )
{
paint.drawImage(0, 0, *img, 0, 0, -1, -1, 0 );
}
}