画像を切り抜く
2019/09/28
Python2.7.8, OpenCV4.1.1
import cv2
im = cv2.imread('img.png')
x1,y1 = (100,150) #左上
x2,y2 = (400,550) #右下
im_trim = im[y1:y2,x1:x2] #im[top : bottom, left : right]
cv2.imwrite('im_trim.png',im_trim)
2019/09/28
Python2.7.8, OpenCV4.1.1
import cv2
im = cv2.imread('img.png')
x1,y1 = (100,150) #左上
x2,y2 = (400,550) #右下
im_trim = im[y1:y2,x1:x2] #im[top : bottom, left : right]
cv2.imwrite('im_trim.png',im_trim)