from maix import image, display, camera
import time
import math
while True:
img = camera.capture()
line = img.find_line()
# print(line)
img.draw_rectangle(15, 205, 25, 215, color=(255, 0, 0), thickness=1) #将找到的颜色区域画出来
img.draw_rectangle(215, 6, 225, 16, color=(0, 0, 255), thickness=1) #将找到的颜色区域画出来
img.draw_line(line["rect"][0], line["rect"][1], line["rect"][2],
line["rect"][3], color=(255, 0, 0), thickness=2)
img.draw_line(line["rect"][2], line["rect"][3], line["rect"][4],
line["rect"][5], color=(0, 255, 0), thickness=2)
img.draw_line(line["rect"][4], line["rect"][5], line["rect"][6],
line["rect"][7], color=(0, 0, 255), thickness=2)
img.draw_line(line["rect"][6], line["rect"][7], line["rect"][0],
line["rect"][1], color=(255, 255, 255), thickness=2)
img.draw_circle(line["rect"][0], line["rect"][1], 4,color=(255, 0, 0), thickness=2)
img.draw_circle(line["rect"][2], line["rect"][3], 4,color=(0, 255, 0), thickness=2)
img.draw_circle(line["rect"][4], line["rect"][5], 4,color=(0, 0, 255), thickness=2)
img.draw_circle(line["rect"][6], line["rect"][7], 4,color=(255, 255, 255), thickness=2)
img.draw_string(0, 0, "x0:"+str(line["rect"][2])+" y0: "+str(line["rect"][3]), color= (255, 0, 0), thickness=1)
img.draw_string(0, 16, "x1:"+str(line["rect"][0])+" y1: "+str(line["rect"][1]), color= (255, 0, 0), thickness=1)
img.draw_string(0, 32, "x2:"+str(line["rect"][6])+" y2: "+str(line["rect"][7]), color= (255, 0, 0), thickness=1)
img.draw_string(0, 48, "x3:"+str(line["rect"][4])+" y3: "+str(line["rect"][5]), color= (255, 0, 0), thickness=1)
display.show(img)
v831找黑边框(一)
最新推荐文章于 2024-10-14 16:42:33 发布