• OpenMV VSCode 扩展发布了,在插件市场直接搜索OpenMV就可以安装
  • 如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修
  • 发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • 直线检测报错,求教!



    • 请问这是什么错误呀

      0_1544061374565_f177d1e5-de33-4f4b-8ac0-c501d0e32f77-image.png



    • 
      import sensor, image, time
      
      sensor.reset()
      sensor.set_framesize(sensor.QVGA)
      sensor.set_pixformat(sensor.RGB565)
      
      
      Line_threshold = (60, 100, -18, 32, -33, 56) # L A B
      
      sensor.skip_frames(time = 1000)
      clock = time.clock()
      
      min_degree = 0
      max_degree = 179
      #img_raw = sensor.snapshot().lens_corr(1.8).save('test.bmp')
      
      
      
      
      img_op=image.Image('123.bmp',copy_to_fb=True)
      
      
          #time.sleep(3000)
      img_op.binary([Line_threshold])
      
      #img_op.erode(2)
      
      img_op.dilate(1)
      img_op.erode(1)
      for l in img_op.find_line_segments(merge_distance=2, max_theta_differance=2) #(x_stride=3,y_stride=3,threshold = 1000, theta_margin = 10, rho_margin = 20):
              #if (min_degree <= l.theta()) and (l.theta() <= max_degree):
      
              img_op.draw_line(l.line(), color = (255, 0, 0))
      
              print(l.theta())
      
      
      
      sensor.flush()
      
      time.sleep(100)
      
      


    • 31行没有冒号,而且不应该有空行



    • @kidswong999
      0_1544067185831_29cd067a-0305-42c1-81e0-ff7b2a817e3d-image.png

      嗯嗯 刚才忘了加冒号。。。改过之后变成这样了,说帧缓存区空间不够?这是怎么回事啊

      
      import sensor, image, time
      
      sensor.reset()
      sensor.set_framesize(sensor.QVGA)
      sensor.set_pixformat(sensor.RGB565)
      
      
      Line_threshold = (60, 100, -18, 32, -33, 56) # L A B
      
      sensor.skip_frames(time = 1000)
      clock = time.clock()
      
      min_degree = 0
      max_degree = 179
      #img_raw = sensor.snapshot().lens_corr(1.8).save('test.bmp')
      
      
      
      
      img_op=image.Image('123.bmp',copy_to_fb=True)
      
      
      #time.sleep(3000)
      img_op.binary([Line_threshold])
      
      #img_op.erode(2)
      
      img_op.dilate(1)
      img_op.erode(1)
      for l in img_op.find_line_segments(merge_distance=10, max_theta_differance=2):
      #if (min_degree <= l.theta()) and (l.theta() <= max_degree):
          img_op.draw_line(l.line(), color = (255, 0, 0))
          print(l.theta())
      
      
      
      sensor.flush()
      
      time.sleep(100)
      


    • 新的问题,新的报错提示,请单独发帖子



    • 这行代码前面有未识别的字符,在IDE里面把前面的空格全部删掉,在上一行代码结尾回车换行,对齐后重新编译。