LoginSignup
2

More than 5 years have passed since last update.

HomebrewのOpenCV3でcv2.imshowが正常に動作するようになった

Last updated at Posted at 2017-08-22

はじめに

  • Python3とOpenCV3環境化で画像処理を行いたかったのですが、cv2.imshowを実行すると以下のようなエラーとなり悩まされていました。
The function is not implemented. Rebuild the library with Windows,
GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian,
install libgtk2.0-dev and pkg-config,
then re-run cmake or configure script in function cvShowImage
  • しかしながら最近HomebrewのOpenCVのアップデートにより解消されたみたいです。
  • どうやらOpenCVの2系と3系でそれぞれリポジトリがあったのですが、パッケージ名はOpenCVですが、中身としてはOpenCV3のみになったみたいです。それに伴い、Pythonも3系のみになっているみたいです。

PythonとOpenCVを入れ直す

  • 特別に行うことはないのですが、一応メモとして残します。

Homebrewのアップデート

brew update && upgrade

OpenCVおよびOpenCV3のアンインストール

brew uninstall --force opencv
brew uninstall --force opencv3

PythonおよびPython3のアンインストール

brew uninstall --ignore-dependencies python
brew uninstall --force python
brew uninstall --ignore-dependencies python3
brew uninstall --force python3

Python3およびOpenCV3のインストール

brew install opencv

pip3の更新

pip3 install --upgrade pip setuptools wheel 

インストール後確認

Python 3.6.2 (default, Jul 17 2017, 16:44:47) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'3.3.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
2