OpenCVの動作確認 | Visualize the Invisible

Visualize the Invisible

株価の変動をデータとAIを使って分析、何が起きているかを「見える化」したい。


https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/py_image_display/py_image_display.html#using-opencv


sh-3.2# /usr/local/bin/python3.5
Python 3.5.1 (default, Apr 18 2016, 11:55:04) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> import numpy as np
>>> img = cv2.imread('test2.jpg',0)
>>> cv2.line(img,(0,0),(50,50),(255,0,0),5)
array([[255, 255, 255, ..., 255, 255, 255],
       [255, 255, 255, ..., 255, 255, 255],
       [255, 255, 255, ..., 255, 255, 255],
       ..., 
       [ 40,  42,  45, ...,  22,  25,  26],
       [ 56,  57,  58, ...,  15,  16,  18],
       [ 64,  65,  65, ...,  16,  14,  15]], dtype=uint8)
>>> cv2.imshow("image",img)
>>> cv2.waitKey(0)
v2.destroyAllWindows()
27  
>>> v2.destroyAllWindows()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'v2' is not defined
>>> cv2.destroyAllWindows()
>>> 

イメージ 1


matplotlibを動かしたいが、エラーが出る。
/usr/local/Cellar/にインストールされているが、それを呼び出せない。

sh-3.2# /usr/local/bin/python3.5
Python 3.5.1 (default, Apr 18 2016, 11:55:04) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> import numpy as np
>>> from matplotlib import pyplot as plt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'matplotlib'