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



    • 从SD卡里导入文件进行特征点检测,提示运行内存不足,除了降低图片分辨率外,还有其他技巧可以解决这个问题吗?
      0_1590548509854_8cb4f6c44a18e6d14aad6c4ea263aca.png

      import sensor, time, image
      from pid import PID
      from pyb import Servo
      pan_servo=Servo(1)
      tilt_servo=Servo(2)
      pan_pid = PID(p=0.10, i=0, imax=90)
      tilt_pid = PID(p=0.10, i=0, imax=90)
      sensor.reset()
      sensor.set_contrast(3)
      sensor.set_gainceiling(16)
      sensor.set_framesize(sensor.VGA)
      sensor.set_windowing((320, 240))
      sensor.set_pixformat(sensor.GRAYSCALE)
      sensor.skip_frames(time = 2000)
      sensor.set_auto_gain(False, value=100)
      
      def draw_keypoints(img, kpts):
          if kpts:
              print(kpts)
              img.draw_keypoints(kpts)
              img = sensor.snapshot()
              time.sleep(1000)
      kpts1 = image.load_descriptor("/A1.orb")
      kpts2 = image.load_descriptor("/A2.orb")
      kpts3 = image.load_descriptor("/A3.orb")
      kpts4 = image.load_descriptor("/A4.orb")
      kpts5 = image.load_descriptor("/A5.orb")
      kpts6 = image.load_descriptor("/A6.orb")
      kpts7 = image.load_descriptor("/A7.orb")
      kpts8 = image.load_descriptor("/A8.orb")
      kpts9 = image.load_descriptor("/B1.orb")
      kpts10 = image.load_descriptor("/B2.orb")
      kpts11 = image.load_descriptor("/B3.orb")
      kpts12 = image.load_descriptor("/B4.orb")
      kpts13 = image.load_descriptor("/B5.orb")
      kpts14 = image.load_descriptor("/B6.orb")
      kpts15 = image.load_descriptor("/B7.orb")
      kpts16 = image.load_descriptor("/B8.orb")
      kpts17 = image.load_descriptor("/C1.orb")
      kpts18 = image.load_descriptor("/C2.orb")
      kpts19 = image.load_descriptor("/C3.orb")
      kpts20 = image.load_descriptor("/C4.orb")
      kpts21 = image.load_descriptor("/C5.orb")
      kpts22 = image.load_descriptor("/C6.orb")
      kpts23 = image.load_descriptor("/C7.orb")
      kpts24 = image.load_descriptor("/C8.orb")
      kpts25 = image.load_descriptor("/D1.orb")
      kpts26 = image.load_descriptor("/D2.orb")
      kpts27 = image.load_descriptor("/D3.orb")
      kpts28 = image.load_descriptor("/D4.orb")
      kpts29 = image.load_descriptor("/D5.orb")
      kpts30 = image.load_descriptor("/D6.orb")
      kpts31 = image.load_descriptor("/D7.orb")
      kpts32 = image.load_descriptor("/D8.orb")
      img = sensor.snapshot()
      clock = time.clock()
      while (True):
          clock.tick()
          img = sensor.snapshot()
          pan_servo.angle(0)
          time.sleep(200)
          tilt_servo.angle(-17)
          time.sleep(200)
          kptsA = img.find_keypoints(max_keypoints=150, threshold=10, normalized=True)
          if (kptsA):
              match1 = image.match_descriptor(kpts1, kptsA, threshold=85)
              match2 = image.match_descriptor(kpts2, kptsA, threshold=85)
              match3 = image.match_descriptor(kpts3, kptsA, threshold=85)
              match4 = image.match_descriptor(kpts4, kptsA, threshold=85)
              match5 = image.match_descriptor(kpts5, kptsA, threshold=85)
              match6 = image.match_descriptor(kpts6, kptsA, threshold=85)
              match7 = image.match_descriptor(kpts7, kptsA, threshold=85)
              match8 = image.match_descriptor(kpts8, kptsA, threshold=85)
              match9 = image.match_descriptor(kpts9, kptsA, threshold=85)
              match10 = image.match_descriptor(kpts10, kptsA, threshold=85)
              match11 = image.match_descriptor(kpts11, kptsA, threshold=85)
              match12 = image.match_descriptor(kpts12, kptsA, threshold=85)
              match13 = image.match_descriptor(kpts13, kptsA, threshold=85)
              match14 = image.match_descriptor(kpts14, kptsA, threshold=85)
              match15 = image.match_descriptor(kpts15, kptsA, threshold=85)
              match16 = image.match_descriptor(kpts16, kptsA, threshold=85)
              match17 = image.match_descriptor(kpts17, kptsA, threshold=85)
              match18 = image.match_descriptor(kpts18, kptsA, threshold=85)
              match19 = image.match_descriptor(kpts19, kptsA, threshold=85)
              match20 = image.match_descriptor(kpts20, kptsA, threshold=85)
              match21 = image.match_descriptor(kpts21, kptsA, threshold=85)
              match22 = image.match_descriptor(kpts22, kptsA, threshold=85)
              match23 = image.match_descriptor(kpts23, kptsA, threshold=85)
              match24 = image.match_descriptor(kpts24, kptsA, threshold=85)
              match25 = image.match_descriptor(kpts25, kptsA, threshold=85)
              match26 = image.match_descriptor(kpts26, kptsA, threshold=85)
              match27 = image.match_descriptor(kpts27, kptsA, threshold=85)
              match28 = image.match_descriptor(kpts28, kptsA, threshold=85)
              match29 = image.match_descriptor(kpts29, kptsA, threshold=85)
              match30 = image.match_descriptor(kpts30, kptsA, threshold=85)
              match31 = image.match_descriptor(kpts31, kptsA, threshold=85)
              match32 = image.match_descriptor(kpts32, kptsA, threshold=85)
              if (match1.count()>10):
                  pan_servo.angle(40)
                  time.sleep(400)
                  pan_servo.angle(0)
                  time.sleep(400)
              elif (match2.count()>10):
                  pan_servo.angle(40)
                  time.sleep(400)
                  pan_servo.angle(0)
                  time.sleep(400)
              elif (match3.count()>10):
                  pan_servo.angle(40)
                  time.sleep(400)
                  pan_servo.angle(0)
                  time.sleep(400)
              elif (match4.count()>10):
                  pan_servo.angle(40)
                  time.sleep(400)
                  pan_servo.angle(0)
                  time.sleep(400)
              elif (match5.count()>10):
                  pan_servo.angle(40)
                  time.sleep(400)
                  pan_servo.angle(0)
                  time.sleep(400)
              elif (match6.count()>10):
                  pan_servo.angle(40)
                  time.sleep(400)
                  pan_servo.angle(0)
                  time.sleep(400)
              elif (match7.count()>10):
                  pan_servo.angle(40)
                  time.sleep(400)
                  pan_servo.angle(0)
                  time.sleep(400)
              elif (match8.count()>10):        
                  pan_servo.angle(40)
                  time.sleep(400)
                  pan_servo.angle(0)
                  time.sleep(400)            
              elif (match9.count()>10):
                  tilt_servo.angle(-47)
                  time.sleep(400)
                  tilt_servo.angle(-17)
                  time.sleep(400)
              elif (match10.count()>10):
                  tilt_servo.angle(-47)
                  time.sleep(400)
                  tilt_servo.angle(-17)
                  time.sleep(400)
              elif (match11.count()>10):
                  tilt_servo.angle(-47)
                  time.sleep(400)
                  tilt_servo.angle(-17)
                  time.sleep(400)
              elif (match12.count()>10):
                  tilt_servo.angle(-47)
                  time.sleep(400)
                  tilt_servo.angle(-17)
                  time.sleep(400)
              elif (match13.count()>10):
                  tilt_servo.angle(-47)
                  time.sleep(400)
                  tilt_servo.angle(-17)
                  time.sleep(400)
              elif (match14.count()>10):
                  tilt_servo.angle(-47)
                  time.sleep(400)
                  tilt_servo.angle(-17)
                  time.sleep(400)
              elif (match15.count()>10):
                  tilt_servo.angle(-47)
                  time.sleep(400)
                  tilt_servo.angle(-17)
                  time.sleep(400)
              elif (match16.count()>10):
                  tilt_servo.angle(-47)
                  time.sleep(400)
                  tilt_servo.angle(-17)
                  time.sleep(400)
              elif (match17.count()>10):
                  pan_servo.angle(-35)
                  time.sleep(400)
                  pan_servo.angle(0)
                  time.sleep(400)
              elif (match18.count()>10):
                  pan_servo.angle(-35)
                  time.sleep(400)
                  pan_servo.angle(0)
                  time.sleep(400)
              elif (match19.count()>10):
                  pan_servo.angle(-35)
                  time.sleep(400)
                  pan_servo.angle(0)
                  time.sleep(400)
              elif (match20.count()>10):
                  pan_servo.angle(-35)
                  time.sleep(400)
                  pan_servo.angle(0)
                  time.sleep(400)
              elif (match21.count()>10):
                  pan_servo.angle(-35)
                  time.sleep(400)
                  pan_servo.angle(0)
                  time.sleep(400)
              elif (match22.count()>10):        
                  pan_servo.angle(-35)
                  time.sleep(400)
                  pan_servo.angle(0)
                  time.sleep(400)
              elif (match23.count()>10):        
                  pan_servo.angle(-35)
                  time.sleep(400)
                  pan_servo.angle(0)
                  time.sleep(400)
              elif (match24.count()>10):
                  pan_servo.angle(-35)
                  time.sleep(400)
                  pan_servo.angle(0)
                  time.sleep(400)            
              elif (match25.count()>10):
                  tilt_servo.angle(13)
                  time.sleep(400)
                  tilt_servo.angle(-17)
                  time.sleep(400)
              elif (match26.count()>10):
                  tilt_servo.angle(13)
                  time.sleep(400)
                  tilt_servo.angle(-17)
                  time.sleep(400)
              elif (match27.count()>10):
                  tilt_servo.angle(13)
                  time.sleep(400)
                  tilt_servo.angle(-17)
                  time.sleep(400)
              elif (match28.count()>10):
                  tilt_servo.angle(13)
                  time.sleep(400)
                  tilt_servo.angle(-17)
                  time.sleep(400)
              elif (match29.count()>10):
                  tilt_servo.angle(13)
                  time.sleep(400)
                  tilt_servo.angle(-17)
                  time.sleep(400)
              elif (match30.count()>10):
                  tilt_servo.angle(13)
                  time.sleep(400)
                  tilt_servo.angle(-17)
                  time.sleep(400)
              elif (match31.count()>10):        
                  tilt_servo.angle(13)
                  time.sleep(400)
                  tilt_servo.angle(-17)
                  time.sleep(400)
              elif (match32.count()>10):
                  tilt_servo.angle(13)
                  time.sleep(400)
                  tilt_servo.angle(-17)
                  time.sleep(400)    
              else :
                  pan_servo.angle(0)
                  time.sleep(200)
                  tilt_servo.angle(-17)
                  time.sleep(200)
              print(kptsA, "matched:%d dt:%d"%(match4.count(), match4.theta()))
          img.draw_string(0, 0, "FPS:%.2f"%(clock.fps()))
      
      


    • 不要在一开始全部把特征点读取进来。内存不够。

      在循环里添加for循环。参考这个代码:https://book.openmv.cc/image/mulity-template-match.html