
import sensor, image, time
sensor.reset()
sensor.set_pixformat(sensor.RGB565) # grayscale is faster
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
sensor.set_auto_whitebal(False)
clock = time.clock()
while(True):
clock.tick()
img = sensor.snapshot().lens_corr(1.8)
2, r_max = 100, r_step = 2):
#img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0))
#print(c)
roi=(20,20,160,80)
juxing=img.find_rects(roi,threshold = 15000)
for r in juxing:
img.draw_rectangle(r.rect(), color = (255, 0, 0))
#for p in r.corners(): img.draw_circle(p[0], p[1], 5, color = (0, 255, 0))
#print(r)
#yuan=img.find_circles(threshold = 2000, x_margin = 10, y_margin = 10, r_margin = 10,r_min = 2, r_max = 100, r_step = 2)
print('矩形有',len(juxing))
print("FPS %f" % clock.fps())你好 我想和你交流一下 这个赛项