分类: LINUX
2014-12-18 10:02:17
1. 先从sourceforge上下载OpenCV的源码
2. 解压到任意目录
3. 进入源码目录,创建release目录
4. 可以看到在OpenCV目录下,有个CMakeLists.txt文件,需要事先安装一些软件
5. 进入release目录,安装OpenCV是所有的文件都会被放到这个release目录下
6. cmake编译OpenCV源码,安装所有的lib文件都会被安装到/usr/local目录下
8. 测试,在某个目录下建立一个DisplayImage.cpp文件
9. 从网上下那个著名的lena.jpg放在cpp目录下
10. 写一个cmake的makefile,也叫CMakeLists.txt
CMake Error at CMakeLists.txt:15 (find_package): Could not find module FindOpenCV.cmake or a configuration file for package OpenCV. Adjust CMAKE_MODULE_PATH to find FindOpenCV.cmake or set OpenCV_DIR to the directory containing a CMake configuration file for OpenCV. The file will have one of the following names: OpenCVConfig.cmake opencv-config.cmake
The fact is that I have an environment variable for the path which I use in Visual Studio with no problems. If I don't include OpenCV, then I can configure and generate with no problem, but I need to solve the problem. I don't understand why cmake cannot find the OpenCV path or how to fix it.
I also used the recommendations mentioned in this link:
Does anybody had this problem too?
解决:export OpenCV_DIR=