■サンプルコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import cv2 import numpy as np from matplotlib import pyplot as plt img = cv2.imread('maru.png',0) edges = cv2.Canny(img,100,200) plt.subplot(121) plt.imshow(img,cmap = 'gray') plt.title('input image') plt.subplot(122) plt.imshow(edges,cmap = 'gray') plt.title('canny image') plt.show() |
■実行結果