系统迁移中,暂时无法访问,所有数据会迁移到新的网站。
OpenMV VSCode 扩展发布了,在插件市场直接搜索OpenMV就可以安装
如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修。
发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
每一个新的提问,单独发一个新帖子
帖子需要目的,你要做什么?
如果涉及代码,需要报错提示与全部代码文本,请注意不要贴代码图片
必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
关于返回错误'line' object isn't iterable
-
请问我的代码运行时为什么返回如标题错误
import sensor, image, time, lcd, gc sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.CIF) sensor.set_windowing([0,0,136,200]) sensor.skip_frames(time = 2000) clock = time.clock() #==========================寻找离视野中心最近的直线函数================ def find_theline(lines): min_dis = 100 for line in lines: if (abs(line.x1() - img.width()/2) < min_dis): the_line = line min_dis = abs(line.x1() - img.width()/2) return the_line #================================================================= #=============================滤波参数============================== kernel_size = 1 kernel = [-1, -1, -1,\ -1, +8, -1,\ -1, -1, -1] thresholds = [(0, 36)] #================================================================= while(True): clock.tick() img = sensor.snapshot().lens_corr(strength = 1.0,zoom = 1) img.morph(kernel_size, kernel) img.binary(thresholds) img.erode(1, threshold = 2) lines = img.get_regression([(0,36)], robust = True) if (lines): theline = find_theline(lines) if(theline.magnitude() > 8): rho_err = abs(theline.rho())-img.width()/2 print("rho_error:",rho_err) img.draw_line(theline.line()) gc.collect() print("fps:",clock.fps())
-
问题就出在
for line in lines:
这句话上
-
img.get_regression返回的是一条线,而不是多条线。