how to send camera frame to imagebox from thread
-
i have MainWindow and then i have another form which i call Table Manager which have table widget , to process the table data i have worker
i move the worker to thread where it process data but this worker also turning ON the camera and would get frames from camera . so the problem is how i get back to MainWindow from this worker to update the camera stream on MainWindow
here is flow
MainWindow ( UI which have ImageBox of camera )
|
|
V
Table Manager form ( where i have few buttons to load files data into table)
|
|
v
WORKER ( moved to thread for backend processing)normally using signal slots i can send Qstring message from worker to MainWindow. but i tried to send OpenCV cv::VideoCapture vcap back to MainWindow through signals and slots as first i pass it to table manager and then from table manager form to MainWindow but had no success with it , got error
QObject::connect: Cannot queue arguments of type 'cv::VideoCapture' (Make sure 'cv::VideoCapture' is registered using qRegisterMetaType().)
so am wondering what could be good approach so that i can display camera video on MainWindo UI ImageBox and as well as my worker get frames / image from that camera video feed.
thanks
-
i have MainWindow and then i have another form which i call Table Manager which have table widget , to process the table data i have worker
i move the worker to thread where it process data but this worker also turning ON the camera and would get frames from camera . so the problem is how i get back to MainWindow from this worker to update the camera stream on MainWindow
here is flow
MainWindow ( UI which have ImageBox of camera )
|
|
V
Table Manager form ( where i have few buttons to load files data into table)
|
|
v
WORKER ( moved to thread for backend processing)normally using signal slots i can send Qstring message from worker to MainWindow. but i tried to send OpenCV cv::VideoCapture vcap back to MainWindow through signals and slots as first i pass it to table manager and then from table manager form to MainWindow but had no success with it , got error
QObject::connect: Cannot queue arguments of type 'cv::VideoCapture' (Make sure 'cv::VideoCapture' is registered using qRegisterMetaType().)
so am wondering what could be good approach so that i can display camera video on MainWindo UI ImageBox and as well as my worker get frames / image from that camera video feed.
thanks
@Zelda4 You will need to register cv::VideoCapture with https://doc.qt.io/qt-5/qmetatype.html#qRegisterMetaType-1
Or simply pass a pointer instead by-value (this could increase performance dramatically if cv::VideoCapture is big). But then you will need to care about life-time of cv::VideoCapture instance. -
@Zelda4 You will need to register cv::VideoCapture with https://doc.qt.io/qt-5/qmetatype.html#qRegisterMetaType-1
Or simply pass a pointer instead by-value (this could increase performance dramatically if cv::VideoCapture is big). But then you will need to care about life-time of cv::VideoCapture instance.