Hi All,
I am new to Qt and I am using Qt4 to develop an application to display video from SONY iidc camera.
Currently, I managed to show the image frames on a label's pixmap attribute. But, the speed of display is slow. Well, should be very slow - like 2frames/s. What I've actually done is:
1. read the data from the camera to a unsignech char buffer.
2. create a QImage object using that data
3. create a QPixmap object using the above QImage
4. Put is on the Label to display.
//gray image 8-bit
// this is the data buffer from the firewire camera
pImageBuff = (unsigned char *)iidc_lockdata(hCamera, -1);
frameImage
= new QImage(pImageBuff, iWidth, iHeight,
QImage::Format_Indexed8);
frameImage->setNumColors(256);
for (int icol = 0; icol< 256; icol++){
frameImage->setColor(icol, colorTableData[icol]);
}
buffer.open( IO_WriteOnly );
frameImage->save( &buffer, "PNG" );
bPixmap.loadFromData(ba);
LabelCam1->setPixmap(bPixmap);
LabelCam1->repaint();
//gray image 8-bit
QImage *frameImage;
QPixmap bPixmap;
QByteArray ba;
QBuffer buffer( &ba );
// this is the data buffer from the firewire camera
pImageBuff = (unsigned char *)iidc_lockdata(hCamera, -1);
frameImage = new QImage(pImageBuff, iWidth, iHeight, QImage::Format_Indexed8);
frameImage->setNumColors(256);
for (int icol = 0; icol< 256; icol++){
frameImage->setColor(icol, colorTableData[icol]);
}
buffer.open( IO_WriteOnly );
frameImage->save( &buffer, "PNG" );
bPixmap.loadFromData(ba);
LabelCam1->setPixmap(bPixmap);
LabelCam1->repaint();
To copy to clipboard, switch view to plain text mode
Does anyone has any idea of speeding up this displaying thing? Or using other methods?
Bookmarks