import numpy as np
import cv2
from PIL import Image
import matplotlib.pyplot as plt
image_Big = 'C:/Users/Lenovo/Desktop/test22/0007.png'
image_Big = Image.open(image_Big)
first_point = (20,420)
last_point = (20+300, 420+300)
print("左上角起点坐标:{0} 右下角终点坐标:{1}".format(first_point, last_point))
image_Big=cv2.rectangle(np.array(image_Big), first_point, last_point, (0, 255, 0), 2)
right_point1 = (22, 417)
right_point2 = (22 + 300, 417+300)
print(right_point1, right_point2)
image_Big2 = cv2.rectangle(image_Big, right_point1, right_point2, (0, 255, 255), 2)
plt.imshow(image_Big2)
plt.show()
在图像上加两个矩形框
最新推荐文章于 2024-10-17 11:21:39 发布