本文介绍了Mac OS X上的OpenCV安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经浏览了所有的Google和Stack Overflow的搜索结果,以便在我的Mac上安装愚蠢的OpenCV,所有的方法都是完全无用的。

I have trawled through all of Google's and Stack Overflow's search results in order to install stupid OpenCV on my Mac and all the methods have been completely useless.

试图这样做与OS X 10.8和它的XCode版本,它没有工作。现在我在10.9和XCode 5.0.1。

I started trying to do this with OS X 10.8 and its XCode version and it didn't work. Now I'm on 10.9 and XCode 5.0.1.

我试过主要有两种方法:
1)从OCV网站下载.dmg文件,并做CMAKE例程。当我进入make -j8步骤,在36%左右,它给我错误,如:

I have tried mainly 2 methods:1) Downloading the .dmg file from OCV website and doing the CMAKE routine. When I get to the make -j8 step, at around 36% it gives me errors such as:

-make [1]: * [modules / imgproc / CMakeFiles / opencv_perf_imgproc.dir / all]错误2

-make[1]: * [modules/imgproc/CMakeFiles/opencv_perf_imgproc.dir/all] Error 2

-Documents / Libraries / opencv-2.4.6.1 / modules / ts / include / opencv2 / ts /ts_perf.hpp:480:12:note:
从宏'CV_PERF_TEST_MAIN_INTERNALS'扩展
while(++ argc> =(--argc,-1)){ VA_ARGS ; break;} / 这个丑陋的缺点...
^ ~~
1错误生成。
make [2]:*
* [modules / imgproc / CMakeFiles / opencv_perf_imgproc.dir / perf / perf_main.cpp.o]错误1

-Documents/Libraries/opencv-2.4.6.1/modules/ts/include/opencv2/ts/ts_perf.hpp:480:12: note: expanded from macro 'CV_PERF_TEST_MAIN_INTERNALS' while (++argc >= (--argc,-1)) {VA_ARGS; break;} /this ugly cons... ^ ~~1 error generated.make[2]: ** [modules/imgproc/CMakeFiles/opencv_perf_imgproc.dir/perf/perf_main.cpp.o] Error 1

2)使用Homebrew结束时,即使我添加了python路径,当我'import cv'它给我一个没有模块命名为cv错误

2) Using Homebrew at the end of which, even if I added the python path, when I do 'import cv' it gives me a "no module named cv" error

我之前尝试过Macports,所以我不记得这些步骤,但它没有工作。

I tried Macports as well a while ago so I don't remember the steps, but it didn't work.

不用说,我试过

任何其他解决方案?

推荐答案

有一个很棒的教程,位于。它突出显示您尝试使用的不兼容的版本。

There is a great tutorial located here. It highlights that the version you are trying to use "is not compatible". I am thinking that you should try installing the version stated in those instructions and see how you go.

以下说明直接取自该链接:

The following instructions are taken directly from that link:

安装CMAKE


  1. 首先,您需要在CMake的二进制分发下下载.dmg文件。在我安装这个,文件名是cmake-2.8.11.2-Darwin64-universal.dmg。

  1. First you need to download the .dmg file under Binary Distribution of CMake here. At the time of I installed this, the file name is cmake-2.8.11.2-Darwin64-universal.dmg.

完成安装后,系统会提示您是否将CMake放入/ usr / bin,选择是并完成安装

Upon completion of the installation you will be prompted whether to put CMake in /usr/bin, select Yes and finish installation

要确保CMake已成功安装,请在终端中键入cmake -version

To ensure that CMake has been successfully installed, type cmake -version in Terminal

安装OPENCV


  1. 首先,下载OpenCV 2.4.3稳定版本的tar文件和请勿使用最新版本

将tar文件解压缩到一个文件夹,并通过终端cd下载/ OpenCV-2.4.3

Extract the tar file in a folder and go to that folder through the terminal, e.g. cd Downloads/OpenCV-2.4.3

现在,以下每行都将在Terminal中执行,并且必须成功执行p>

Now, each of the following line is to be executed in Terminal and must be executed successfully (no error)


  1. mkdir build

  2. cd build

  3. cmake -GUnix Makefiles..

  4. make -j8

  5. sudo make install

  1. mkdir build
  2. cd build
  3. cmake -G "Unix Makefiles" ..
  4. make -j8
  5. sudo make install


  • 您已设置为使用OpenCV!

  • You are all set to use OpenCV!

    这篇关于Mac OS X上的OpenCV安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

  • 08-13 02:14