Mac OSX:构建opencv_contrib致命错误:找不到文件opencv2 / core.hpp

时间:2015-01-29 18:36:00

标签: c++ macos opencv cmake fatal-error

我一直在尝试在我的Mac上设置opencv_contrib(https://github.com/Itseez/opencv_contrib),但无法解决此问题。下面我已经复制了我采取的步骤和当前的错误输出。

步骤:

1 - 下载opencv 2.4.10和opencv_contrib。将两者解压缩到一个新的空目录中。文件结构是newfolder / opencv-2.4.10,newfolder / opencv_contrib

2 - 在opencv-2.4.10中创建构建主管。文件结构是newfolder / opencv-2.4.10 / build

3 - cd build

4 - 运行以下命令

cmake -G "Unix Makefiles" -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules ..
make -j8

此时我在make中途得到以下输出:

Scanning dependencies of target opencv_surface_matching
[ 25%] Building CXX object modules/surface_matching/CMakeFiles/opencv_surface_matching.dir/src/icp.cpp.o
In file included from <path to folder>/newfolder/opencv_contrib/modules/surface_matching/src/icp.cpp:41:
In file included from <path to folder>/newfolder/opencv_contrib/modules/surface_matching/src/precomp.hpp:45:

<path to newfolder>/newfolder/opencv_contrib/modules/surface_matching/include/opencv2/surface_matching/ppf_match_3d.hpp:62:10: fatal error:
  'opencv2/core.hpp' file not found

我不知道如何解决这个问题,我几乎逐字逐句地遵循安装说明。一个变化是添加-G&#34; Unix Makefiles&#34; (根据我最初安装opencv standalone时的成功,我从这里得到http://tilomitra.com/opencv-on-mac-osx/)。

在过去,我已经能够在没有opencv_contrib的情况下安装opencv而没有问题。

感谢您对我能做些什么的想法来解决这个问题!

1 个答案:

答案 0 :(得分:0)

你需要opencv3.0才能使用opencv_contrib repo。

标题组织在3.0中被更改,2.4中的opencv2 / core / core.hpp现在是opencv2 / core.hpp(这是你丢失的文件)