简体   繁体   English

“OpenCV”被认为是未找到的

[英]“OpenCV” is considered to be NOT FOUND

Linux Flavor: Debian (Crunch Bang) Linux风味:Debian(Crunch Bang)

Problem Occurred: When attempting to build cvblobs with the following command 发生问题:尝试使用以下命令构建cvblobs时

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!

Well I met a similar problem when I was going with some other open source face detection modules rather than cvblobs. 当我使用其他一些开源面部检测模块而不是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. 所以您可能会注意到它要求您手动指出构建OpenCV库版本的目录。 For me, my source codes are at 对我来说,我的源代码是

/usr/local/opencv-2.4.13/ /usr/local/opencv-2.4.13/

but I make and install my release build of OpenCV at 但我制作并安装了我的OpenCV版本

/usr/local/opencv-2.4.13/release/ /usr/local/opencv-2.4.13/release/

so I use: cmake -D OpenCV_DIR=/usr/local/opencv-2.4.13/release/ .. and everything works:) 所以我用: cmake -D OpenCV_DIR=/usr/local/opencv-2.4.13/release/ ..一切正常:)

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. 当我编译一个使用OpenCV lib的程序时,视觉2.4.8发生了类似的错误,当我手动将Opencv_DIR路径指向opencv / build,visio 3.1.0时,就像你一样发生错误。

Then I point Opencv_DIR path to opencv/build whose vision is same to the program used. 然后我将Opencv_DIR路径指向opencv/build其视野与所使用的程序相同。 It works. 有用。

One of the reason could be the another OpenCV package in another path, that you had installed before. 其中一个原因可能是您之前安装的另一个路径中的另一个OpenCV包。 In my case, I had already installed OpenCV for Python in Anaconda package, and the CMake always wanted to refer me to that package. 就我而言,我已经在Anaconda包中安装了OpenCV for Python,而且CMake一直想把我推荐给那个包。

I simply added: 我简单地说:

set(OpenCV_FOUND 1)

to my CMakeList.txt file, this command simply override the other package you may had installed. 在我的CMakeList.txt文件中,此命令只是覆盖您可能已安装的其他软件包。 The final version of CMakeList file which is working for me would be this: 适用于我的CMakeList文件的最终版本是这样的:

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 1-我正在使用Clion IDE的CMakeList.txt文件

2- I am using it under windows. 2-我在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 3-如果使用其他版本,还需要更改OpenCV版本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM