我需要使用Python根据车牌的边界框坐标(4个坐标)从车辆图像中裁剪车牌。有什么建议吗?
我有以下代码,但效果不如预期。
> x1, y1: 1112 711
> x2, y2: 1328 698
> x3, y3: 1330 749
> x4, y4: 1115 761
image = cv2.imread(IMAGE_PATH)
fixed_image = cv2.cvtColor(image,cv2.COLOR_BGR2RGB)
new_img = cv2.rectangle(fixed_image, (x3,y3), (x1,y1), (0, 255, 0), 5)
plt.figure(figsize=(12,13))
plt.imshow(new_img)
谢谢。
opencv
的标签,所以我假设你已经用它加载了你的图像。你可以直接使用切片操作:image[y1:y2, x1:x2]
。 - Nullman