Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
566 views
in Technique[技术] by (71.8m points)

cmake - OpenCV installation on Mac OS X

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.

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.

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] Error 2

-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) 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

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

It goes without saying that I've tried different versions of OCV and all have given me issues at the make step.

Any other solutions?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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:

INSTALLING CMAKE

  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.

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

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

INSTALLING OPENCV

  1. First, download the tar file of OpenCV 2.4.3 stable version here and DO NOT use the latest version. I struggled with the installation because I used OpenCV 2.4.6.1 and it's not yet compatible.

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

  3. 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 -G "Unix Makefiles" ..
    4. make -j8
    5. sudo make install
  4. You are all set to use OpenCV!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.8k users

...