0

I'm new to the OpenCV / QT environment (and in programming in general). I'm trying to run this code:

https://github.com/Terranlee/Realtime_EVM

Can someone please tell me step by step what I need to install/compile in order to run this script on Windows 10? Not sure what versions to install or if it even matters.

I've tried following directions from here (https://wiki.qt.io/How_to_setup_Qt_and_openCV_on_Windows) but I keep getting 'undefined reference' errors which means I'm not referencing the libraries properly... or I need to edit the code somehow to point to my libraries but I'm not quite sure what to edit and how.

Thanks in advance and please excuse my noobieness!

-jay


Reply to answer

I compiled OpenCV using CMake per the wiki guide using the following commands:

mingw32-make -j 8

mingw32-make install

Once this was done, I opened Qt Creator and opened the Github EVM code by downloading the zip file then extracting it and opening the rvm.pro file.

Without making any changes, I tried to build the code and my first error was that it couldn't find "opencv_world310.dll" library.

I searched for it and found the file locally in the "E:\opencv\build\x64\vc14\bin" directory so I edited the rvm.pro file to look in that directory like so:

win32 {
    OPENCVFOLDER = E:/_CODE_/_EXTERNAL_/OpenCV/my_git_build/
    OPENCVVERSION = 310
    INCLUDEPATH += E:\opencv\build\install\include
    INCLUDEPATH += E:\opencv\build\x64\vc14\lib


CONFIG(release, debug|release) {
    LIBS += -LE:\opencv\build\x64\vc14\lib
    LIBS += -lopencv_world$${OPENCVVERSION}
}
CONFIG(debug, debug|release) {
    DEFINES += DEBUG_MODE
    LIBS += -LE:\opencv\build\x64\vc14\lib
    LIBS += -lopencv_world$${OPENCVVERSION}d
}

This got rid of the initial error but then I get several 'undefined reference' issues afterward:

C:\Eulerian Real-Time OpenCV build\Realtime-Video-Magnification-master\build-rvm-Desktop_Qt_5_9_0_MinGW_32bit-Debug\debug\main.o:-1: In function `ZN2cv6StringD1Ev':

E:\opencv\build\include\opencv2\core\cvstd.hpp:664: error: undefined reference to `cv::String::deallocate()'

C:\Eulerian Real-Time OpenCV build\Realtime-Video-Magnification-master\build-rvm-Desktop_Qt_5_9_0_MinGW_32bit-Debug\debug\main.o:-1: In function `ZN2cv6StringaSERKS0_':

E:\opencv\build\include\opencv2\core\cvstd.hpp:672: error: undefined reference to `cv::String::deallocate()'

C:\Eulerian Real-Time OpenCV build\Realtime-Video-Magnification-master\src\main\threads\CaptureThread.h:42: error: undefined reference to `cv::VideoCapture::~VideoCapture()'

...... there are about 50 of these issues so I won't list them all.

Is it just a matter of correctly referencing the library?

In summary I'm just trying to run the Github code using Qt Creator, mingGW, CMake, & OpenCV. Please let me know how I need to edit the .pro file to link the library properly.

My OpenCV is in e:\opencv

Thanks again for the help and for your patience!

-Jay

Jay
  • 1
  • 1

1 Answers1

0

There is very little info on what are the steps you are taking currently. Do you want to use Visual Studio / mingw? Here are some pointers:

  • You can open the pro file using Qt Creator
  • You can generate a Visual Studio compatible solution using qmake -spec <spec of the Visual Studio to use> -tp vc, to choose the spec see this answer.

With either of this you should have Qt includes/libraries set up.

The bad thing about the project is, that if you look at the .pro file, it explicitly uses Linux friendly include paths:

INCLUDEPATH += /usr/local/include \
                /usr/local/include/opencv \
               /usr/local/include/opencv2

LIBS += `pkg-config --libs opencv` -ldl

So, you will have to then add the include/library paths to OpenCV either inside Visual Studio or in the .pro file, if you are using Qt Creator. For example the link you used in your post on Qt/OpenCV has Windows friendly ones:

LIBS += D:\opencv-build\bin\libopencv_core320.dll
LIBS += D:\opencv-build\bin\libopencv_highgui320.dll
LIBS += D:\opencv-build\bin\libopencv_imgcodecs320.dll
LIBS += D:\opencv-build\bin\libopencv_imgproc320.dll
LIBS += D:\opencv-build\bin\libopencv_features2d320.dll
LIBS += D:\opencv-build\bin\libopencv_calib3d320.dll

So please explain in more detail what have you done so far, and which references (Qt/OpenCV) exactly are missing.

Rudolfs Bundulis
  • 11,636
  • 6
  • 33
  • 71
  • Thank you so much for the replying. This is what I've done so far: I've followed the https://wiki.qt.io/How_to_setup_Qt_and_openCV_on_Windows to the tee and downloaded and installed Qt 5.9 with MingGW 5.3.0, CMake 3.7.2, OpenCV 3.2.0 then followed the steps to compile OpenCV using CMake. Once that was all done, I downloaded the code I wanted to run from Github (zip), extracted it, then opened the rvm.pro file with Qt Creator. – Jay Jan 30 '18 at 19:32
  • Without making any changes, I tried to build the code and my first error was that it couldn't find "opencv_world310.dll" library. I searched for it and found the file in the "E:\opencv\build\x64\vc14\bin" directory so I edited the rvm.pro file to look like: CONFIG(release, debug|release) { LIBS += -LE:\opencv\build\x64\vc14\lib LIBS += -lopencv_world$${OPENCVVERSION} } CONFIG(debug, debug|release) { DEFINES += DEBUG_MODE LIBS += -LE:\opencv\build\x64\vc14\lib LIBS += -lopencv_world$${OPENCVVERSION}d – Jay Jan 30 '18 at 19:33
  • This got past the error but when I compile I get several 'undefined reference' errors. Sorry for the format of the reply.. not sure how I'm supposed to respond properly on this forum (it's telling me not to use 'answer your question' but 'comments' has limited characters and can't format properly) – Jay Jan 30 '18 at 19:38
  • @Jay - you can edit the initial question to fill in this info:) It would be good to see what exact undefined references are you getting. – Rudolfs Bundulis Jan 30 '18 at 19:49
  • @Jay, ok it looks like the opencv symbols are not being linked in. I dont know what libopencv_world is , but can you try adding all of the libs found in the wiki you sent instead of that? Maybe of course it is some kind of a wrapper, but it would make sense to link all the libs, the unneded symbols will be ignored anyway – Rudolfs Bundulis Feb 01 '18 at 13:54
  • Thanks! I tried adding all the libs like the wiki and still got the errors. It looks like libopencv_world is some sort of all in one library. I tried to compile OpenCV with CMake and added the 'with_OpenCV' option but it failed with several errors. Maybe I should just use Visual Studio 15. How would I go about doing that and making sure all libraries are included? – Jay Feb 06 '18 at 02:14