Open ooolky opened 1 year ago
步骤
import cv2 img = cv2.imread("test.jpg") center = img.shape w=center[1]/3 h=center[0]/3 x = center[1]/2 - w/2 y = center[0]/2 - h/2
crop_img = img[int(y):int(y+h), int(x):int(x+w)]
img = cv2.imwrite("new.jpg",crop_img)
步骤
crop_img = img[int(y):int(y+h), int(x):int(x+w)]
img = cv2.imwrite("new.jpg",crop_img)