2016-11-02 3 views
0

matplotlib.image.imread을 사용하여로드 된 이미지가 있습니다.Numpy 배열에서 하위 배열 추출

왼쪽 열 20, 5 행에서 시작하여 오른쪽 열 25, 10 행에서 끝나는 이미지 섹션을 추출하는 가장 좋은 방법은 무엇입니까?

답변

1

img[5:10,20:25]의 문제점은 무엇인가요?

import matplotlib.image as mi 
import matplotlib.pyplot as plt 


img = mi.imread('./3.png') 
cropped = img[5:10,20:25] 
f,axarr = plt.subplots(2,1) 
axarr[0].imshow(img) 
axarr[1].imshow(cropped) 
plt.show() 

결과 :

enter image description here

관련 문제