O'Reilly logo

Computer Vision with OpenCV 3 and Qt5 by Amin Ahmadi Tazehkandi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Subclassing QThread

Let's start by creating an example Qt Widgets application in the Qt Creator named MultithreadedCV. Add the OpenCV framework to this project the same way as we learned in the beginning chapters of this book: by including the following piece of code in your MultithreadedCV.pro file (see Chapter 2, Creating Our First Qt and OpenCV Project or Chapter 3, Creating a Comprehensive Qt+OpenCV Project for more about this):

    win32: { 
      include("c:/dev/opencv/opencv.pri") 
    } 
    unix: !macx{ 
      CONFIG += link_pkgconfig 
      PKGCONFIG += opencv 
    } 
    unix: macx{ 
    INCLUDEPATH += /usr/local/include 
      LIBS += -L"/usr/local/lib" \ 
      -lopencv_world 
    } 

Then, add two label widgets to your mainwindow.ui file, shown as follows. We will use these labels to display ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required