PDA

View Full Version : error when linking opencv libraries in QT



lagarcia
19th March 2020, 17:23
Hello, I am new using Qt, and I need to link opencv libraries in Qt for a project that includes image processing, this I already had done in linux, but when executing it in window it does not recognize opencv libraries when including them, nor when adding them is the .pro.
When trying to compile opencv to link with Qt according to the steps shown in the url https://stackoverflow.com/questions/15881913/how-to-link-opencv-in-qtcreator-and-use-qt-library, after step 6.3, I receive the following error in executing cmake
CMake Error at CMakeLists.txt:18 (include):
include could not find load file:

cmake/OpenCVMinDepVersions.cmake


CMake Error at CMakeLists.txt:78 (include):
include could not find load file:

cmake/OpenCVUtils.cmake


CMake Error at CMakeLists.txt:79 (ocv_cmake_reset_hooks):
Unknown CMake command "ocv_cmake_reset_hooks".


Configuring incomplete, errors occurred!

First it gave me the error that the CMakeLists.txt file did not exist in the opencv folder, and I added it manually as it is on the github. After doing so, when I hit the button "Configure", I received the error.
I thank in advance who can help me to solve this problem.

d_stranz
19th March 2020, 18:00
The steps in the stackoverflow post you linked describe only how to install OpenCV and build it using CMake. If that is where you are having problems, make sure you have set the CMake-GUI variables described in section 6. Also be sure you have actually installed all of the OpenCV modules you are trying to build. f there are modules you don't need and have not installed, then you must set the CMake variables to ignore them. This is probably why you are having problems.

Also, if you are NOT using gcc / g++ as a compiler but are using MSVC instead, DO NOT set the configuration for MinGW Makefiles, because the libraries will be incompatible with MSVC. You will have to choose one of the MSVC options.

lagarcia
19th March 2020, 22:10
Thank you very much for your reply. First I apologize because I am not familiar with terms like gcc / g ++ and MSVC. I did exactly the same as detailed in the steps. I don't know if I installed all opencv modules, because I just gave it extract to opencv .exe. Anyway, there are few opencv functions that I will use, since the image processing for facial recognition I did with the python libraries.
In linux I had compiled it by command and it linked perfectly to QT. If it is not too much trouble, I ask that if you have any reference where you can find the steps of how to do it in the most suitable way that you mention, I would appreciate it.