logo

对比度比较低识别率大幅下降怎么办?

2019-11-14 14:39
J
lian
74649edc-84b9-4c9b-a110-ba54682b5905.png
import sensor, image, time

sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE) # grayscale is faster
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()

while(True):
    clock.tick()
    img = sensor.snapshot().lens_corr(1.2)

    # Circle objects have four values: x, y, r (radius), and magnitude. The
    # magnitude is the strength of the detection of the circle. Higher is
    # better...

    # `threshold` controls how many circles are found. Increase its value
    # to decrease the number of circles detected...

    # `x_margin`, `y_margin`, and `r_margin` control the merging of similar
    # circles in the x, y, and r (radius) directions.

    # r_min, r_max, and r_step control what radiuses of circles are tested.
    # Shrinking the number of tested circle radiuses yields a big performance boost.

    for c in img.find_circles(threshold = 3500, x_margin = 15, y_margin = 15, r_margin = 15,
            r_min = 2, r_max = 100, r_step = 2):
        img.draw_circle(c.x(), c.y(), c.r()+2, color = (255, 0, 0))
        print(c)

    print("FPS %f" % clock.fps())
2019-11-15 16:57
I
网红小智智 星瞳科技

加一个灯,用于照明。