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 ...

Get Computer Vision with OpenCV 3 and Qt5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.