Hello, I am developing windows desktop application during my part-time. Now I have a problem which puzzled me for one week.
I can get the camera data from the registered callback function to SDK. Pseudocode show below:
List imageList;//thread safe list
void (int width, int height, void* data)
{
//here I can get the image data, and according to camera fsp N,
//imageList can get N images per second, act as provider
}
//I use QLabel or QOpenGLWidget to display those images
class QMyLabel
: public QLabel{
{
painter.drawImage(img);
}
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
timer.start(60 / N);
}
List imageList;//thread safe list
void (int width, int height, void* data)
{
//here I can get the image data, and according to camera fsp N,
//imageList can get N images per second, act as provider
imageList.push(QImage(data));
}
//I use QLabel or QOpenGLWidget to display those images
class QMyLabel : public QLabel
{
void paintEvent(QPaintEvent * event)
{
QImage img = imageList.pop();
painter.drawImage(img);
}
QTimer timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
timer.start(60 / N);
}
To copy to clipboard, switch view to plain text mode
But it display frame by frame, not smoothly. I have used std::share_ptr and std::move to avoid copy, but still can't fix it.
I Googled it but can't find a solution? Could anyone can give some tips?
Bookmarks