python
import cv2
img = cv2.imread('F:/2024/Python/demo1/test1/man.jpg')
cv2.imshow('Image', img) # 显示图片
#cv2.waitKey(0) # 等待按键
x, y, w, h = 500, 100, 200, 200 # 示例坐标
roi = img[y:y+h, x:x+w] # 截取指定区域
cv2.imshow('ROI', roi)
cv2.waitKey(0)
cv2.destroyAllWindows() # 关闭所有窗口