About the slot delivery Mat object
Previously, the Qtimer timer was used, and the mat member implementation of the Read dialog object after the timeout was set to display the image in the UI, which added complexity to subsequent integration of other process-oriented code.
So consider using slots
Even after processing the image with multithreading, send signal to the Dialog object, dialog connect them on the line.
Child threads. cpp
...
for (;;) {
...
Emit imagechanged (LABELIMG);
...
}
Emit finished ();
...
Dialog.h
...
Private Slots:
void UpdateImage (const cv::mat &img);
...
Dialog.cpp
...
qregistermetatype< cv::mat > ("Cv::mat");
Connect (worker, SIGNAL (imagechanged (const Cv::mat &)), this, SLOT (updateimage (const Cv::mat &));
...
Child threads. h
...
Signals:
void imagechanged (const cv::mat &img);
...
//////////////
Parent class Worker
Public Slots:
virtual void DoWork ();
Child threads
Class Ctworker:public Worker
{
Public
Ctworker ();
Public Slots:
void DoWork (); The overlay is OK.
};
#endif//Ctworker_h
QT uses slots to pass OPENCV objects in the mat and to integrate open source code with multithreading.