问题
I am not a Unix guy, so I have been trying to install openCV 2.0 for days with out success. I just downloaded the opencv library form sourceforge from this page: http://sourceforge.net/projects/opencvlibrary/ Does any one know the exact unix terminal commands for installing it?
please don't say "go to google", I already did. I found this: http://opencv.willowgarage.com/wiki/InstallGuide and this http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port but the explanations are not very good for unix beginners.
installations always fails in the end.
It would be great if I can make a framework. for example OpenCV.framework from the current source, So I can use it with Xcode, and Cocoa easier.
thanks
I did:
downloaded it. extracted it.
cd Downloads/OpenCV-2.0.0
./make_frameworks.sh
and got this when linking all the .o files.
mv -f .deps/saving.Tpo .deps/saving.Plo
mv -f .deps/logger.Tpo .deps/logger.Plo
mv -f .deps/index_testing.Tpo .deps/index_testing.Plo
libtool: link: (cd .libs/lib_clapack.lax/lib_clapack_floatstore.a && ar x "/Users/nacho4d/Downloads/OpenCV-2.0.0 3/build_i386/3rdparty/./.libs/lib_clapack_floatstore.a")
../libtool: line 961: cd: .libs/lib_clapack.lax/lib_clapack_floatstore.a: No such file or directory
make[2]: *** [lib_clapack.la] Error 1
make[2]: *** Waiting for unfinished jobs....
mv -f .deps/flann.Tpo .deps/flann.Plo
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Creating universal Framework
=============================================
cp: build_ppc/OpenCV.framework: No such file or directory
lipo: can't open input file: build_ppc/OpenCV.framework/OpenCV (No such file or directory)
Done
!
Do I need to do something before running the shell script?
EDIT: For the interested, I wrote a post on how to install and use OpenCV 2.1.1 on Macs here: http://nacho4d-nacho4d.blogspot.com/2010/07/blog-post.html
回答1:
I had a problem compiling on Snow Leopard too, but was able to get it to work by following the instructions at: http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port
The only modification I had to make was also to disable ffmpeg inside of ccmake
The GNU autotools methods (make && make install) are being outdated. Volunteers to edit this section?
mkdir opencv/build cd opencv/build cmake .. ccmake .
If you are on Snow Leopard, hit 't' to toggle advanced mode. Set CMAKE_CXX_COMPILER="/usr/bin/g++-4.0" and CMAKE_C_COMPILER="/usr/bin/gcc-4.0" and then continue with the following steps.
Hit 'c' to configure. Hit 'g' to generate the config file and exit ccmake.
make -j8 sudo make install
If you hit the following build error:
/Users/awagner/Developer/opencv2/src/highgui/grfmt_tiff.cpp:292: error: ‘fmtSignTiffII’ was not declared in this scope make[2]: * [src/highgui/CMakeFiles/highgui.dir/grfmt_tiff.o] Error 1 make1: * [src/highgui/CMakeFiles/highgui.dir/all] Error 2
you can get the build to complete by commenting out line 292 of src/highgui/grfmt_tiff.cpp and running make again. (This probably breaks something in TIFF export, but the build at least completes)
回答2:
TL;DR of the link nacho4d posted:
/usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
brew install opencv
and after about 30mins of crunching, you should have OpenCV installed.
...
However, if you get an error from brew when its trying to install opencv then read this: https://github.com/mxcl/homebrew/pull/6424#issuecomment-2333585 and edit the brew recipe with:
export EDITOR nano # optional, but for novices nano is easier than vim
brew edit opencv
then run brew install opencv
again.
回答3:
Ok, I just solved it. In fact there is a bug somewhere, because if your path contains a space shell scripts will fail.
for example.
$pwd
/Users/nacho4d/Downloads/OpenCV-2.0.0 3
$./make_frameworks.sh
this will fail because current folder "OpenCV-2.0.0 3" has a space.
It took me many hours to realize this. ;(
Regards
来源:https://stackoverflow.com/questions/1512594/how-to-install-opencv2-0-in-mac-os-10-6-1-snow-leopard