소스 뷰어
%%time
import numpy as np
from matplotlib import pyplot as plt
img = plt.imread( 'messi5.jpg' )

# 관심 영역 추출
mh = int( img.shape[0]*0.1 )
mw = int( img.shape[1]*0.1 )
img = img[ mh : -mh, mw : -mw ] 

# 회색조 변환
gray = np.sum( img*[1/3, 1/3, 1/3], axis=2 ) 

# 이미지 크기 축소
from skimage.transform import resize
gray_small = resize( gray, (gray.shape[0]//4, gray.shape[1]//4) )

# 영상 출력
plt.imshow( gray_small, cmap='gray' ) ; plt.show()
No description has been provided for this image
Wall time: 271 ms