识别圆心坐标不准确
-
# Untitled - By: xrj - 周一 8月 6 2018 import sensor, image, time,pyb sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.QVGA) sensor.set_windowing((310,240)) sensor.skip_frames(time = 2000) clock = time.clock() while(True): clock.tick() img = sensor.snapshot() high_threshold = (160, 255) #二值化范围 img.gaussian(1) #模糊滤波 img.binary([high_threshold]) #二值化 img.erode(3) for c in img.find_circles(threshold = 25000, x_margin = 10, y_margin = 10, r_margin = 70,r_min = 70, r_max =100, r_step = 2): img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0))
可以看到图中运行结果里圆与实际希望的圆有一段差距,这个可以修正吗
-
多算几次,取平均值。