LoginSignup
0
0

More than 1 year has passed since last update.

opencv インストール(Mac用)

Posted at

OpenCVとは

  • OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library. OpenCV was built to provide a common infrastructure for computer vision applications and to accelerate the use of machine perception in the commercial products. Being a BSD-licensed product, OpenCV makes it easy for businesses to utilize and modify the code.

OpenCVのインストール

  1. Homebrewのインストール
  • MacOS上でソフトウェアの導入を単純化するパッケージ管理システムの一つ
  • インストールする際は、下記コマンドを実行
$ ruby -e "$(curl -fsS http://gist.github.com/raw/323731/install_homebrew.rb)” 
  • 詳しくは以下のサイトを参照

  1. OpenCVのインストール(Mac)
  • Homebrewが入ったら、以下のコマンドを実行する
brew install opencv
  • その後、python用のopencvをインストールするために以下を実行
pip3 install opencv-python

pip3としているのは、python2とpython3の両方があるため、2と3の違いを明記するため。少なくとも私のMacにはデフォでpython2が入っているので、python3をインストールしても、デフォのpipコマンドではpython2の方が指定されている。zshのAliasに加筆すれば解決するらしいが、少々面倒なので、pip3を使っている。詳しくは以下のサイトを参照

  • OpenCVが入ったかの確認
import cv2

上記のコマンドを実行してエラーが出なければ問題ない。

Windowsにおけるインストール法は今後追記していく予定

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0