kcsin
17th March 2011, 19:38
I have a multithreaded opencv/opengl project built in a qt envirionment NO GUI :(
I'm using the opengl idle process to drive when I grab the next video frame.
The problem I'm having is this is a command line project and I need to create a QLabel when I start the display thread.
I get the label being created but it's not being updated.
You might be able to tell I have very little qt experience.
Essentially I have a separate thread that picks up a copy of an image and displays it. However, when this thread is started it needs to create a new label to display the converted image.
Kelly Sinclair
/************************************************** *****
* Video Stream used to create image used by OpenGL
* ************************************************** **/
void *videoStream(void *ptr) {
(void) ptr;
QLOG_INFO ()<<" starting video Stream thread";
QLabel videoDisplay;
videoDisplay.setMinimumSize(1280,720);
for (;;){
if ( bufferedImage == true )
{
mutex.lock(); /// the mutex is used to control creating the imageInBuffer in the OpenGL idle() function.
const uchar *videoImage = (const uchar*)iplImage->imageInBuffer;
QImage videoImage(videoImage, CAPTUREWIDTH, CAPTUREHEIGHT, QImage::Format_RGB888);
videoImage.rgbSwapped();
bufferedImage = false;
mutex.unlock();
}
QLOG_INFO()<<"videoStream - i should be displaying an image " ;
videoDisplay.setPixmap(QPixmap::fromImage(videoIma ge));
}
return 0;
} //end videoStream()
I'm using the opengl idle process to drive when I grab the next video frame.
The problem I'm having is this is a command line project and I need to create a QLabel when I start the display thread.
I get the label being created but it's not being updated.
You might be able to tell I have very little qt experience.
Essentially I have a separate thread that picks up a copy of an image and displays it. However, when this thread is started it needs to create a new label to display the converted image.
Kelly Sinclair
/************************************************** *****
* Video Stream used to create image used by OpenGL
* ************************************************** **/
void *videoStream(void *ptr) {
(void) ptr;
QLOG_INFO ()<<" starting video Stream thread";
QLabel videoDisplay;
videoDisplay.setMinimumSize(1280,720);
for (;;){
if ( bufferedImage == true )
{
mutex.lock(); /// the mutex is used to control creating the imageInBuffer in the OpenGL idle() function.
const uchar *videoImage = (const uchar*)iplImage->imageInBuffer;
QImage videoImage(videoImage, CAPTUREWIDTH, CAPTUREHEIGHT, QImage::Format_RGB888);
videoImage.rgbSwapped();
bufferedImage = false;
mutex.unlock();
}
QLOG_INFO()<<"videoStream - i should be displaying an image " ;
videoDisplay.setPixmap(QPixmap::fromImage(videoIma ge));
}
return 0;
} //end videoStream()