我在这里搜索了StackOverflow和其他网站,以找出如何安装OpenCV 3.0 Contrib模块。我已经下载了额外的模块并将zip文件解压缩到/ opt / local / include / opencv2 / opencv_contrib /文件夹。我已导航到/ opt / local / include / opencv2文件夹并在终端中键入以下命令:
cmake -DOPENCV_EXTRA_MODULES_PATH=/opt/local/include/opencv2/opencv_contrib/modules/ /opt/local/include/opencv2
我明白了:
-bash: $: command not found
如果我只输入cmake -D,我得到:
CMake Error: -D must be followed with VAR=VALUE.
CMake Error: Problem processing arguments. Aborting.
所以我知道它识别带有-D标记的cmake命令。
有任何想法吗?
没有人说安装OpenCV及其模块很容易。
就像你一样,我已经安装并运行了Opencv 3.0.0,并希望添加contrib模块。
脚步:
1st-删除并再次下载OpenCV3.0.0文件夹(没有必要,但在抽搐后,我更喜欢下载一个新的)下载openccv_contrib
并将它们放在同一个文件夹中。
第2步 - 转到OpenCV3.0.0并创建构建文件夹。
3 - 打开Cmake gui并按照https://github.com/itseez/opencv_contrib的步骤进行操作。
3.1- Fill “Where is the source code” with the rotute of where is openCV3.0.0. (my case /Users/Rafearl/Program/ComputerVision/opencv-3.0.0)
3.2- Fill “Where to build binaries” with the build route(/Users/Rafearl/Program/ComputerVision/opencv-3.0.0/build)
3.3- Press configure
3.4- In the search bar search for “OPENCV_EXTRA_MODULES_PATH” and fill with the Opencv_contrib modules(/Users/Rafearl/Program/ComputerVision/opencv_contrib-master/modules)
3.5- Click configure again and then click generate. By default current generator: Unix makefiles
4-在终端中转到您的构建文件夹
5- make -j4(4是处理器的核心数)
6th- sudo make install
现在,您可以检查构建文件夹中添加了contrib库的lib如果您不想再次下载OpenCV3.0.0,只需按照相同的步骤操作即可,无需下载或删除任何内容。
如果你已经在Xcode中使用了Opencv,那么一切都应该可行,但就像一条建议一样;许多OpenCV2.4示例在3.0版本中不起作用。