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



    • 1_1626438793589_屏幕截图 2021-07-16 171514.jpg 0_1626438793587_屏幕截图 2021-07-16 171437.jpg 0_1626438932873_屏幕截图 2021-07-16 203518.jpg

      import sensor, image, time,car
      from pyb import LED
      from pid import PID
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQVGA)
      sensor.set_vflip(True)
      sensor.set_hmirror(True)
      sensor.set_auto_gain(False,gain_db=6.02)
      #sensor.set_auto_whitebal(False,rgb_gain_db=(63.4416, 60.2071, 63.7403))#H7 PLUS
      sensor.set_auto_whitebal(False,rgb_gain_db=(-5,-6,-3))#H7
      '''sensor.set_saturation(3)#饱和度
      sensor.set_contrast(3)#对比度
      sensor.set_brightness(3)#亮度'''
      sensor.skip_frames(time = 2000)
      clock = time.clock() # 跟踪FPS帧率
      
      rho_pid = PID(p=0.6, i=0)
      theta_pid = PID(p=0.001, i=0)
      THRESHOLD= (32, 69, -12, 22, -13, 15)
      BLACK=((100,100),[250,255])
      while(True):
          clock.tick()
          img = sensor.snapshot().lens_corr(strength = 1.8, zoom = 1.0).mean(2).binary([THRESHOLD])
      
          line = img.get_regression([BLACK[0]],roi=(0,sensor.height()-40,sensor.width(),40),x_stride=2,y_stride=2,pixels_threshold=1,robust = True)
          if (line):
              rho_err = abs(line.rho())-img.width()/2
              if line.theta()>90:
                  theta_err = line.theta()-180
              else:
                  theta_err = line.theta()
              img.draw_line(line.line(), color = 127)
              print(rho_err,line.magnitude(),theta_err)
              #if -40<b_err<40 and -30<t_err<30:
              rho_output = rho_pid.get_pid(rho_err,1)
              theta_output = theta_pid.get_pid(theta_err,1)
              output = rho_output+theta_output
              car.run(30+output, 30-output)
          else:
              car.run(20,-20)
              pass
          print(clock.fps(),sensor.get_gain_db())
      
      


    • 启动后亮度不一致,是因为没有手动设置曝光。参考这里面的代码
      https://forum.singtown.com/topic/7098/openmv4plus的图像为什么这么偏暗偏绿/7



    • 你串口打印的不是白平衡,是增益get_gain_db, 白平衡用get_rgb_gain_db