“OpenCV” is considered to be NOT FOUND

两盒软妹~` 提交于 2019-12-13 12:07:15

问题


Linux Flavor: Debian (Crunch Bang)

Problem Occurred: When attempting to build cvblobs with the following command

cd ~/cvblob
cmake .

Error:

CMake Error at cvBlob/CMakeLists.txt:20 (find_package):
 Found package configuration file:

/usr/local/share/OpenCV/OpenCVConfig.cmake

but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
NOT FOUND.


-- Configuring incomplete, errors occurred!

回答1:


Well I met a similar problem when I was going with some other open source face detection modules rather than cvblobs. Actually you will find that before these lines of error-info, there are:

CMake Warning at /usr/local/opencv-2.4.13/cmake/OpenCVConfig.cmake:163 (message):
  Found OpenCV Windows Pack but it has not binaries compatible with your configuration.

  You should manually point CMake variable OpenCV_DIR to your build of OpenCV library.
Call Stack (most recent call first):
  CMakeLists.txt:57 (find_package)


CMake Warning at CMakeLists.txt:57 (find_package):
  Found package configuration file:

    /usr/local/opencv-2.4.13/cmake/OpenCVConfig.cmake

but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be NOT FOUND.

So you may notice that it asks you to manually point out the directory of you build version of OpenCV library. For me, my source codes are at

/usr/local/opencv-2.4.13/

but I make and install my release build of OpenCV at

/usr/local/opencv-2.4.13/release/

so I use: cmake -D OpenCV_DIR=/usr/local/opencv-2.4.13/release/ .. and everything works:)




回答2:


When I compile a program that use OpenCV lib, vision 2.4.8, occurs the similar error, when I point manually Opencv_DIR path to opencv/build ,visio 3.1.0, error occurred like you.

Then I point Opencv_DIR path to opencv/build whose vision is same to the program used. It works.




回答3:


One of the reason could be the another OpenCV package in another path, that you had installed before. In my case, I had already installed OpenCV for Python in Anaconda package, and the CMake always wanted to refer me to that package.

I simply added:

set(OpenCV_FOUND 1)

to my CMakeList.txt file, this command simply override the other package you may had installed. The final version of CMakeList file which is working for me would be this:

set( OpenCV_FOUND 1 )
find_package(OpenCV 2.4.13 REQUIRED PATHS "C:/opencv")
set(SOURCE_FILES main.cpp)
add_executable(OpenCV_Test ${SOURCE_FILES})

Note:

1- I am using the CMakeList.txt file for Clion IDE

2- I am using it under windows. Probably you may set the relevant path if you use other OS

3- You need also change the OpenCV version if you use other version



来源:https://stackoverflow.com/questions/18327197/opencv-is-considered-to-be-not-found

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!