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



    • import sensor, image, time, math,lcd,pyb
      from pyb import UART
      import json
      import ustruct
      
      sensor.reset()
      sensor.set_framesize(sensor.QVGA)
      sensor.set_pixformat(sensor.RGB565)
      sensor.skip_frames(time = 2000)
      lcd.init()
      clock = time.clock()
      uart = UART(3,115200)   #定义串口3变量    P4 TX<-->PA10  P5 RX<-->PA9
      uart.init(115200, bits=8, parity=None, stop=1) # init with given parameters
      
      find_threshold = (35, 9, -5, 6, 28, 13)
      
      def find_max(blobs): 
          blobs.sort(key=lambda x:x.pixels(),reverse=True);
          max_blob={}            
          length=len(blobs)
          if length>0:
              max_blob=blobs[0]
          return max_blob
      
      def sending_data(cx_max,cy_max):
          global uart;
          #frame=[0x2C,18,cx%0xff,int(cx/0xff),cy%0xff,int(cy/0xff),0x5B];
          #data = bytearray(frame)
          data = ustruct.pack("<bbhhb", 
                         0x2C,                       
                         0x12,                      
                         int(cx_max), # up sample by 4    
                         int(cy_max), # up sample by 4    
                         0x5B);
          uart.write(data); 
      
      while(True):
          clock.tick()
          lcd.display(sensor.snapshot()) 
          img = sensor.snapshot()#.lens_corr(1.3);
          #img.binary([binary_threshold], invert = 1)
          blobs = img.find_blobs([find_threshold],area_threshold=100,pixel_threshold=8000)
      
      
          if blobs:
              max_blob=find_max(blobs)
              img.draw_rectangle(max_blob.rect(),color=(0,0,255))
              img.draw_cross(max_blob.cx(), max_blob.cy(),color=(0,0,255))
              img.draw_cross(160, 120,color=(255,0,0)) # 在中心点画标记
              img.draw_line((160,120,max_blob.cx(),max_blob.cy()), color=(0,0,255));
              img.draw_circle(160, 120, 10, color = (255,0,0), thickness = 1, fill = False)
      
              xywh=max_blob.rect()
              print("xywh=",xywh)
              print("中心x坐标:",max_blob.cx(),"中心y坐标:",max_blob.cy())
              print("L =", 160 - max_blob.cx())
              print("H =", 120 - max_blob.cy())
              print("像素数量:",max_blob.pixels()) 
              print("\r\n")
              print(clock.fps())
      
      
      


    • 0_1600570411486_48563dd8-5322-4b82-80cc-ba759c918e40-image.png



    • 但是我用其他的openmv却能正常运行;
      报错的是:openmv4 cam h7 plus
      正常的是:openmv4 cam h7



    • 你有没有把PLUS的摄像头模组的两个螺丝拧紧?我感觉像是摄像头模组没有安装紧固。