Qt - Opencv background subtraction issue
Hi there! I'm using Qt5.8 with Visual Studio 2017. The below piece of OpenCV code works well in VS, but when I run it using Qt Creator, it doesn't seem to work.
cv::Mat frame, output;
Ptr<BackgroundSubtractor> bgS = createBackgroundSubtractorMOG2();
cvtColor(frame, output, CV_BGR2GRAY);
The background subtractor doesn't seem to work (but no error is thrown) and output is showing blank (plain gray color) whereas this is working fine in VS. Anyone encountered this issue before?
Thanks in advance.
If you mean "run in creator" that you compile it via creator with same vs compiler or
is it other compiler in Creator ? ( like mingw)
In the project folder, there is a run environment settings.
You might need to add a path to the opencv dlls for it to find them.
Else it will work the same as Creator is just an editor.
i'm running using vs compiler (CDB, not mingw).
Then it must be the loading of the dlls.
Since Creator it self cannot change how code works.
sorry for my late reply. have managed to resolve this - it's not a Qt issue. When i port the codes from C++ to Qt, i have inadvertently initialized the variables inside my Qt Timer event, causing the weird behavior.
Pablo J. Rogina
@yjt8 if your problem is gone, please don't forget to mark your post as solved! Thanks.