logo

循迹程序,为什么画面里不显示教程里那个绿色的直线

2019-04-28 19:38
F
_15522110752
THRESHOLD =(0, 30, -10, 2, -6, 6) # Grayscale threshold for dark things...
import sensor, image, time

sensor.reset()
#sensor.set_vflip(True)
#sensor.set_hmirror(True)
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA) # 80x60 (4,800 pixels) - O(N^2) max = 2,3040,000.
#sensor.set_windowing([0,20,80,40])
sensor.skip_frames(time = 2000)     # WARNING: If you use QQVGA it may take seconds
clock = time.clock()                # to process a frame sometimes.

while(True):
    clock.tick()
    img = sensor.snapshot().binary([THRESHOLD])
    line = img.get_regression([(100,100,0,0,0,0)], robust = True)
    if (line):
        
        rho_err = abs(line.rho())-img.width()/2
        if line.theta()>90:
            theta_err = line.theta()-180
        else:
            theta_err = line.theta()
        img.draw_line(line.line(), color=(255,0,0))
        print(rho_err,line.magnitude(),rho_err)
c396ae93-596e-4539-878d-fb3c915535a1.jpg
2019-04-28 20:16
I
网红小智智 星瞳科技

https://forum.singtown.com/topic/2888/%E6%9B%B4%E6%96%B0%E5%9B%BA%E4%BB%B6%E5%90%8E%E4%BA%8C%E5%80%BC%E5%8C%96%E5%87%BD%E6%95%B0binary-%E8%B7%9F%E4%BB%A5%E5%89%8D%E7%9A%84%E4%B8%8D%E4%B8%80%E6%A0%B7%E4%BA%86-%E9%97%AE%E9%A2%98%E5%BE%88%E4%B8%A5%E9%87%8D-%E8%AF%B7%E5%AE%98%E6%96%B9%E7%BB%99%E4%B8%8E%E8%A7%A3%E9%87%8A/7

我感觉是固件的问题,你烧录成3.2.0的固件试一下。