やったこと
OpenCV ライブラリを使い、画像を読み込んで表示してみます。
確認環境
$ python
Python 3.6.2 |Anaconda custom (64-bit)| (default, Sep 21 2017, 18:29:43)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
調査
opencv-img.py
import cv2
print(cv2.__version__)
img = cv2.imread('sample.jpg')
cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
opencv-img2.py
import cv2
from matplotlib import pyplot as plt
print(cv2.__version__)
img = cv2.imread('sample.jpg')
rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
plt.imshow(rgb)
plt.show()