と同じ手順で、Airにも OpenCV3をインストール。
と思ったら。
同じ手順なのに、 こっちは OpenCV2の最新版 2.4.12 になってしまう。
1 2 3 4 5 |
$ $ brew search opencv3 homebrew/science/opencv3 $ |
あるし! opencv3!
もう一度 MacBookProの方でもやってみたら、
やっぱり opencv3 が出て来た!
なんだそりゃ。
MacBookProの方は、間違いなく opencv –HEAD で
3.0.0-dev になってるんだけどな。
を見ると、確かに head はopencvの 2.4 ブランチを見ることになってる。
brew update のタイミングが微妙だったのかも。
てな訳で、SSDの逼迫している MacBookAir の方は、
潔く opencv を uninstall して、 opencv3 を入れることに。
せっかくなので gcc も ビルドし直しておく。
opencv3 のオプションは…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
$ $ brew options opencv3 --32-bit Build 32-bit only --c++11 Build using C++11 mode --with-contrib Build "extra" contributed modules --with-cuda Build with CUDA v7.0+ support --with-ffmpeg Build with ffmpeg support --with-gphoto2 Build with gphoto2 support --with-gstreamer Build with gstreamer support --with-jasper Build with jasper support --with-java Build with Java support --with-libdc1394 Build with libdc1394 support --with-opengl Build with OpenGL support (must use --with-qt5) --with-openni Build with openni support --with-openni2 Build with openni2 support --with-python3 Build with python3 support --with-qt Build the Qt4 backend to HighGUI --with-qt5 Build the Qt5 backend to HighGUI --with-quicktime Use QuickTime for Video I/O instead of QTKit --with-tbb Enable parallel code in OpenCV using Intel TBB --without-eigen Build without eigen support --without-numpy Use a numpy you've installed yourself instead of a Homebrew-packaged numpy --without-opencl Disable GPU code in OpenCV using OpenCL --without-openexr Build without openexr support --without-python Build without Python support --without-tests Build without accuracy & performance tests --HEAD Install HEAD version $ |
適当にオプションを選んで。
–with-contrib は失敗するので外した方が良い。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
$ brew reinstall gcc --without-multilib $ brew uninstall opencv $ brew install opencv3 --with-ffmpeg --with-jasper --with-python3 --with-qt --with-qt5 --with-tbb --without-tests --HEAD ==> Installing opencv3 from homebrew/homebrew-science ==> Using Homebrew-provided fortran compiler. This may be changed by setting the FC environment variable. ==> Cloning https://github.com/Itseez/opencv.git Updating /Library/Caches/Homebrew/opencv3--git ==> Checking out branch master ==> Downloading https://downloads.sourceforge.net/project/opencvlibrary/3rdparty/ipp Already downloaded: /Library/Caches/Homebrew/opencv3--icv-macosx-20141027.tgz ==> cmake .. -DCMAKE_C_FLAGS_RELEASE= -DCMAKE_CXX_FLAGS_RELEASE= -DCMAKE_INSTALL_PRE ==> make ==> make install ==> Caveats This formula is keg-only, which means it was not symlinked into /usr/local. opencv3 and opencv install many of the same files. Generally there are no consequences of this for you. If you build your own software and it requires this formula, you'll need to add to your build variables: LDFLAGS: -L/usr/local/opt/opencv3/lib CPPFLAGS: -I/usr/local/opt/opencv3/include If you need Python to find bindings for this keg-only formula, run: echo /usr/local/opt/opencv3/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/opencv3.pth ==> Summary 🍺 /usr/local/Cellar/opencv3/HEAD: 247 files, 104M, built in 4.9 minutes $ echo /usr/local/opt/opencv3/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/opencv3.pth $ brew cleanup $ |
指示通りに opencv3 のパスを登録して
1 2 |
echo /usr/local/opt/opencv3/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/opencv3.pth |
pythonから確認。
1 2 3 4 5 6 7 8 9 |
$ python Python 2.7.10 (default, Jul 13 2015, 12:05:58) [GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 >>> cv2.__version__ '3.0.0-dev' >>> |
ちゃんと、’3.0.0-dev’になりました。