macos 如何在 Mac OS 10.6.1 (Snow Leopard) 中安装 OpenCV2.0
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1512594/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to Install OpenCV2.0 in Mac OS 10.6.1 (Snow Leopard)
提问by nacho4d
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?
我不是一个 Unix 人,所以我几天来一直在尝试安装 openCV 2.0,但没有成功。我刚刚从这个页面下载了 opencv 库表单 sourceforge:http: //sourceforge.net/projects/opencvlibrary/有谁知道安装它的确切 unix 终端命令吗?
please don't say "go to google", I already did. I found this: http://opencv.willowgarage.com/wiki/InstallGuideand this http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Portbut the explanations are not very good for unix beginners.
请不要说“去谷歌”,我已经这样做了。我发现了这个:http: //opencv.willowgarage.com/wiki/InstallGuide和这个 http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port但这些解释对 unix 初学者来说不是很好。
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.
如果我能制作一个框架就太好了。例如来自当前源代码的 OpenCV.framework,所以我可以将它与 Xcode 和 Cocoa 一起使用。
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.
并在链接所有 .o 文件时得到了这个。
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?
在运行 shell 脚本之前我需要做些什么吗?
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
编辑:对于感兴趣的人,我写了一篇关于如何在 Mac 上安装和使用 OpenCV 2.1.1 的帖子:http: //nacho4d-nacho4d.blogspot.com/2010/07/blog-post.html
采纳答案by nacho4d
Ok, I just solved it. In fact there is a bug somewhere, because if your path contains a space shell scripts will fail.
好的,我刚刚解决了它。实际上某处存在一个错误,因为如果您的路径包含空格,shell 脚本将失败。
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.
这将失败,因为当前文件夹“OpenCV-2.0.0 3”有一个空格。
It took me many hours to realize this. ;(
我花了好几个小时才意识到这一点。;(
Regards
问候
回答by Hortitude
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
我在 Snow Leopard 上编译时也遇到了问题,但可以按照以下说明进行操作: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
我必须做的唯一修改也是在 ccmake 中禁用 ffmpeg
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)
GNU 自动工具方法(make && make install)已经过时了。志愿者编辑此部分?
mkdir opencv/build cd opencv/build cmake .. ccmake .
如果您使用的是 Snow Leopard,请按“t”切换高级模式。设置 CMAKE_CXX_COMPILER="/usr/bin/g++-4.0" 和 CMAKE_C_COMPILER="/usr/bin/gcc-4.0" 然后继续下面的步骤。
点击“c”进行配置。点击“g”生成配置文件并退出 ccmake。
make -j8 sudo make install
如果您遇到以下构建错误:
/Users/awagner/Developer/opencv2/src/highgui/grfmt_tiff.cpp:292: 错误: 'fmtSignTiffII' 未在此范围内声明 make[2]: * [src/highgui/CMakeFiles/highgui.dir/grfmt_tiff.o ] 错误 1 生成1: *[src/highgui/CMakeFiles/highgui.dir/all] 错误 2
您可以通过注释掉 src/highgui/grfmt_tiff.cpp 的第 292 行并再次运行 make 来完成构建。(这可能会破坏 TIFF 导出中的某些内容,但构建至少已完成)
回答by ReactiveRaven
TL;DR of the link nacho4d posted:
TL; nacho4d 链接的 DR 发布:
/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.
经过大约 30 分钟的处理,您应该安装了 OpenCV。
...
...
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-2333585and edit the brew recipe with:
但是,如果您在 brew 尝试安装 opencv 时遇到错误,请阅读以下内容:https: //github.com/mxcl/homebrew/pull/6424#issuecomment-2333585并使用以下命令编辑 brew 配方:
export EDITOR nano # optional, but for novices nano is easier than vim
brew edit opencv
then run brew install opencv
again.
然后brew install opencv
再次运行。