How can I display live camera feed?



  • As of now, I am doing the following:

    1. I have cv::Mat image (from OpenCV) that I convert to a QImage dispQImage
    2. Then, each time I get a new frame, I do the following:
      QLabel *imgDispLabel = new QLabel("");
      imgDispLabel->setPixmap(QPixmap::fromImage(dispQImage));
      imgDispLabel->adjustSize();
      dockwidget->setWidget(imgDispLabel);

    This seems to be slow & not a very good way of doing it. Is there a better alternative that I can use?

    EDIT:
    I am already CV thing in a worker thread and passing the QImage through the signal. It does improve the performance, but I would like a better way to display the color frame, rather than creating a new label each time.



  • Hi, I also worked with the CV lib, and no it's not Qt that slows the framing down. The CV math is very very demanding on your CPU time. The think you could do is place the CV in a different thread and the display of picture in an other. Use the signal/slot to pass data between both threads.
    That should speed up your GUI end.
    You could test how long the CV takes first, to verify my option.
    Greetz


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.