소스 뷰어
import cv2, matplotlib.pyplot as plt
# 이미지 불러오기 (흑백 이미지로 변환)
image = cv2.imread('example.jpg', cv2.IMREAD_GRAYSCALE)
# 캐니 엣지지
canny_edge = cv2.Canny(image, 150, 300)
# 폰트 사이즈
fs = 20
# 결과 출력
plt.figure(figsize=(12, 12))
# 원본 이미지 출력
plt.subplot(1, 2, 1)
plt.title("Original Image", fontsize=fs)
plt.imshow(image, cmap='gray')
plt.axis('off')
# Canny Edge 출력
plt.subplot(1, 2, 2)
plt.title("Canny Edge (150, 300)", fontsize=fs)
plt.imshow(canny_edge, cmap='gray' )
plt.axis('off')
plt.show()