在Mac上安装OpenCV Contrib模块

时间:2015-08-05 02:11:49

标签: c++ macos opencv

我在StackOverflow和其他网站上搜索了如何安装OpenCV 3.0 Contrib Modules。我已经下载了额外的模块并将zip文件解压缩到/ opt / local / include / opencv2 / opencv_contrib /文件夹。我已导航到/ opt / local / include / opencv2文件夹并在终端中输入以下命令:

data scores;
    infile datalines dsd;
    input name : $9. Score1-score3 Team ~ $25. div $;
    datalines;
Smith,12,22,46,"Green Hornets, Atlanta",AAA 
Mitchel,23,19,25,"High Volts, Portland",AAA 
Jones,09,17,54,"Vulcans, Las Vegas",AA 
run;

我明白了:

cmake -DOPENCV_EXTRA_MODULES_PATH=/opt/local/include/opencv2/opencv_contrib/modules/ /opt/local/include/opencv2

如果我只输入cmake -D,我会得到:

-bash: $: command not found

所以我知道它识别带有-D标记的cmake命令。

有什么想法吗?

1 个答案:

答案 0 :(得分:3)

没有人说安装OpenCV及其模块很容易。

就像你一样,我已经安装并运行了Opencv 3.0.0,并希望添加contrib模块。

步骤:

1st-删除并再次下载OpenCV3.0.0文件夹(没有必要,但在抽搐之后,我更愿意下载一个新文件夹)下载openccv_contrib并将它们放在同一个文件夹中。

第2步 - 转到OpenCV3.0.0并创建构建文件夹。

3rd-打开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位 - 在终端中转到您的构建文件夹

5th- make -j4(4是处理器的核心数)

6th- sudo make install

现在,您可以检查build文件夹中的lib是否添加了contrib库 如果您不想再次下载OpenCV3.0.0,只需按照相同的步骤操作,无需下载或删除任何内容。

如果您已经在Xcode中使用了Opencv,那么一切都应该可行,但就像一条建议一样;许多OpenCV2.4示例在3.0版本中不起作用。