• 免费好用的星瞳AI云服务上线!简单标注,云端训练,支持OpenMV H7和OpenMV H7 Plus。可以替代edge impulse。 https://forum.singtown.com/topic/9519
  • 我们只解决官方正版的OpenMV的问题(STM32),其他的分支有很多兼容问题,我们无法解决。
  • 如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修
  • 发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • 做了一个检测圆的程序,但一直显示有错误,说ROI无效,这是要怎么解决呢?



    • from pyb import LED,Timer
      import sensor, image, time, math, struct
      import Message
      class yuan(object):
          flag = 0
          r = 0
          x = 0
          y = 0
      yuan=yuan()
      
      circles=[]
      
      def find_max_circle(circles):
          max_r=0
          for c in circles:
              if c.r()>max_r:
                  max_circle=c
                  max_r=c.r()
                  return max_circle
      
      while(True):
      #def CircleCheck():
          img = sensor.snapshot().lens_corr(1.8)
          circles.clear()
          all_circles=img.find_circles(x_stride=1,y_stride=1,threshold = 2000,
          x_margin = 10, y_margin = 10, r_margin = 10,
          r_min = 2, r_max = 100)
          for c in all_circles:
              if c.r()<22:
                  circles.append(c)
          if circles:
              max_circle = find_max_circle(circles)
              img.draw_circle(max_circle.x(),max_circle.y(),max_circle.r())
              img.draw_cross(max_circle.x(), max_circle.y())
              yuan.x = max_circle.x()-80
              yuan.y = max_circle.y()-60
              yuan.flag = 1
              LED(3).toggle()
              LED(2).toggle()
          else:
              yuan.flag = 0
              LED(2).off()
              LED(3).off()
          Message.UartSendData(Message.DotDataPack(yuan.flag,yuan.x,yuan.y,max_circle.x(), max_circle.y()))
      
      


    • 就这个错误
      Traceback (most recent call last):
      File "", line 25, in
      OSError: Invalid ROI dimensions!
      MicroPython v1.9.4-4553-gb4eccdfe3 on 2019-05-02; OPENMV4 with STM32H743
      Type "help()" for more information.



    • 你的代码不全啊, sensor初始化呢?



    • 其实还有代码的,这是主函数,sensor初始化在主函数里,我在主函数里,还是一样的错误

      import sensor, image, time, math, struct
      import json
      from pyb import LED,Timer
      from struct import pack, unpack
      import Message,LineFollowing,DotFollowing,find_circle
      #初始化镜头
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)#设置相机模块的像素模式
      sensor.set_framesize(sensor.QQVGA)#设置相机分辨率160*120
      sensor.skip_frames(time=3000)#时钟
      sensor.set_auto_whitebal(False)#若想追踪颜色则关闭白平衡
      clock = time.clock()#初始化时钟
      
      #主循环
      while(True):
          clock.tick()#时钟初始化
          #接收串口数据
          Message.UartReadBuffer()
          if Message.Ctr.WorkMode==1:#点检测
              DotFollowing.DotCheck()
          elif (Message.Ctr.WorkMode==2):#线检测
              LineFollowing.LineCheck()
          elif (Message.Ctr.WorkMode==3):#圆检测
              find_circle.CircleCheck()
          elif(Message.Ctr.WorkMode==4):#Led检测
          #用户数据发送
          #Message.UartSendData(Message.UserDataPack(127,127,32767,32767,65536,65536,65536,65536,65536,65536))
          #计算程序运行频率
          if Message.Ctr.IsDebug == 1:
              fps=int(clock.fps())
              Message.Ctr.T_ms = (int)(1000/fps)
              print('fps',fps,'T_ms',Message.Ctr.T_ms)
      
      #************************************ (C) COPYRIGHT 2019 ANO ***********************************#
      
      


    • 你能不能给我能够测试的代码。



    • 如果涉及代码,需要报错提示与全部代码文本,请注意不要贴代码图片