k210识别直线


import sensor
import image
import lcd
import time

THRESHOLD = (5, 70, -23, 15, -57, 0)
clock = time.clock()
lcd.init()
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
#sensor.set_vflip(1)			#开启图像反转
sensor.set_vflip(0)				#关闭图像反转
sensor.run(1)
sensor.skip_frames(30)
min_degree = 0
max_degree = 179

while True:
    clock.tick()
    img = sensor.snapshot()
    for l in img.find_lines(threshold = 2000, theta_margin = 25, rho_margin = 25):
            if (min_degree <= l.theta()) and (l.theta() <= max_degree):
                img.draw_line(l.line(), color = (255, 0, 0))
    lcd.display(img)


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM