0
votes

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

1

1 Answers

0
votes

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.