9
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

OSXのBlenderでOpenCVを使う

Last updated at Posted at 2016-04-27

準備

Homebrewでpython3を入れる

brew install python3

OpenCV3をpython3サポート付きで入れる

brew tap homebrew/science
brew install opencv3 --with-python3

blenderを起動

起動する際にPYTHONPATHにHomebrewで入れたOpenCV3のモジュールのパスを指定する。

PYTHONPATH=/usr/local/opt/opencv3/lib/python3.5/site-packages/ /Applications/blender.app/Contents/MacOS/blender

確認

blenderのコンソールで

import cv2

cv2.__version__
capture = cv2.VideoCapture(0)
cv2.namedWindow("Capture", cv2.WINDOW_AUTOSIZE)
ret, image = capture.read()
cv2.imshow("Capture", image)
cv2.destroyAllWindows()
capture.destroy()
capture.release()

注意

blenderが古いと、Pyhton3.4だったり、もっと古いと2.x系だったりする。
そういう場合は、OpenCVモジュールが認識されないでエラーとなる。

関連投稿

関連記事

9
14
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
9
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?