获取图像大小
import cv2
img = cv2.imread(photo_path)
height = img.shape[0]
width = img.shape[1]
channel = img.shape[2]
裁剪图片
from PIL import Image
img = Image.open('1.jpg') # 打开当前路径图像
box1 = (14, 4, 53, 52) # 设置图像裁剪区域 (x左上,y左上,x右下,y右下)
image1 = img.crop(box1) # 图像裁剪
image1.save('image1.jpg') # 存储裁剪得到的图像