Hi all,
I am new to Qt and opencv, I am programming a graphical interface to record a video through webcam using opencv libraries in Qt. Problem is when I push the start recording button on my interface, a new window gets launched and I dont want that. It should be like after pressing the start recording button it should display the opencv output of webcam inside a Label or Widget on my graphical interface and not on a newly launched window.
I am using Qt 5.8 on windows 10. Below is the while loop which captures the frame and displays in a window:
while (1)
{
Mat frame;
bool bSuccess = cap.read(frame); // read a new frame from video
if (!bSuccess)
{
cout << "ERROR: Cannot read a frame from video file" << endl;
break;
}
oVideoWriter.write(frame);
imshow("MyVideo", frame); //this line launches a new output window
if (waitKey(10) == 27)
{
cout << "esc key is pressed by user" << endl;
return ;
}
}
while (1)
{
Mat frame;
bool bSuccess = cap.read(frame); // read a new frame from video
if (!bSuccess)
{
cout << "ERROR: Cannot read a frame from video file" << endl;
break;
}
oVideoWriter.write(frame);
imshow("MyVideo", frame); //this line launches a new output window
if (waitKey(10) == 27)
{
cout << "esc key is pressed by user" << endl;
return ;
}
}
To copy to clipboard, switch view to plain text mode
Can anyone please guide me on the code of how can I embed the opencv output window inside a Label or Widget in my form.ui.
Thank you for your time and knowledge.
Bookmarks