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



    • def main():
       global Bd_num
       sensor.reset()
       sensor.set_pixformat(sensor.GRAYSCALE)
       sensor.set_framesize(sensor.VGA)
      
       print("Initial exposure == %d" % sensor.get_exposure_us())
       print("db == %d" % sensor.get_gain_db())
       sensor.skip_frames(time = 500)
      
       sensor.set_auto_gain(False![0_1698112339282_捕获.PNG](https://fcdn.singtown.com/bccd10ae-cfa4-4438-8179-f86bc66a7530.PNG) )
       sensor.set_auto_whitebal(False)
       sensor.set_auto_exposure(False,exposure_us=2000)
      
      # sensor.set_hmirror(True)
      # sensor.set_vflip(True)
       sensor.skip_frames(time = 2000)
       clock = time.clock()  # Create a clock object to track the FPS.
      
       uart2 = pyb.UART(3)
       uart2.init(115200, bits=8, parity=None, stop=1,read_buf_len=500)
      
       
       while(True):
          clock.tick()                    # Update the FPS clock.
          img = sensor.snapshot()
          print("Initial exposure == %d" % sensor.get_exposure_us())
          print("db == %d" % sensor.get_gain_db())
          print(clock.fps(),sensor.get_rgb_gain_db())
      
          for c in img.find_circles(threshold = 3500, x_margin = 10, y_margin = 10, r_margin = 10,r_min = 2, r_max = 100, r_step = 2):
              img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0))
              print(c)
      


    • 你得把完整的,可以直接运行出错的代码放上来。



    • from pyb import UART
      import sensor, image, time,pyb,struct
      import json
      import cpufreq
      
      EXPOSURE_TIME_SCALE = 1.0
      
      
      def main():
      
       sensor.reset()
       sensor.set_pixformat(sensor.GRAYSCALE)
       sensor.set_framesize(sensor.VGA)
      
       print("Initial exposure == %d" % sensor.get_exposure_us())
       print("db == %d" % sensor.get_gain_db())
       sensor.skip_frames(time = 500)
      
       sensor.set_auto_gain(False)
       sensor.set_auto_whitebal(False)
       sensor.set_auto_exposure(False,exposure_us=2000)
      
       sensor.skip_frames(time = 2000)#跳过多少毫秒的帧
       clock = time.clock()  # Create a clock object to track the FPS.
      
      
       uart2 = pyb.UART(3)
       uart2.init(115200, bits=8, parity=None, stop=1,read_buf_len=500)
      
       while(True):
          clock.tick()                    # Update the FPS clock.
          img = sensor.snapshot()
          print("Initial exposure == %d" % sensor.get_exposure_us())
          print("db == %d" % sensor.get_gain_db())
          print(clock.fps(),sensor.get_rgb_gain_db())
      
          for c in img.find_circles(threshold = 3500, x_margin = 10, y_margin = 10, r_margin = 10,r_min = 2, r_max = 100, r_step = 2):
             img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0))
             print(c)
      
      
      main()
      
      


    • 0_1698374581311_111.PNG



    • OpenMV4 H7,find_circles不能用vga图像,因为内存太小了。

      要么减小分辨率,要么换OpenMV4 H7 Plus。



    • @kidswong999 请问用findcircles()函数是不是需要知道圆大概占多少像素?