在图像上加两个矩形框

在图像上加两个矩形框,第1张

在图像上加两个矩形框
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()

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5625508.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-15
下一篇2022-12-15

发表评论

登录后才能评论

评论列表(0条)

    保存