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



    • import sensor, image, time ,pyb
      from pyb import UART
      led_qr = pyb.LED(1)
      usb = pyb.USB_VCP()
      qrcode = "000+000"
      qr1="000"
      qr2="000"
      qr="000"
      scan_flag=1
      qrcode_flag=1
      num = [0,0,0]
      zhua=[0,0,0]
      red_threshold  = (28,51,45,74,31,52)
      green_threshold  = (39, 87, -58, -28, 5, 44)
      blue_threshold  = (17, 65, -8, 18, -49, -14)
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQVGA)
      sensor.skip_frames(30)
      sensor.set_auto_whitebal(False)
      clock = time.clock()
      uart = UART(3, 9600)
      def find_max(blobs):
          max_size=0
          for blob in blobs:
              if blob.pixels() > max_size:
                  max_blob=blob
                  max_size = blob.pixels()
          return max_blob
      while(scan_flag):
          img = sensor.snapshot()
          clock.tick()
          img.lens_corr(1.8)
          for code in img.find_qrcodes():
              qrcode="%s" % code.payload()
              scan_flag=0
              print(qrcode)
              uart.write(qrcode+'#')
          led_qr.on()
          time.sleep(150)
          led_qr.off()
          time.sleep(100)
      while (True):
          img = sensor.snapshot()
          clock.tick()
          c = uart.readchar()-48
          while((qrcode_flag==1 and c==1) or (qrcode_flag==2 and c==2)):
              i=0
              qr1=qrcode[0:3]
              qr2=qrcode[4:7]
              num=[0,0,0]
              zhua=[0,0,0]
              blobs_r = img.find_blobs([red_threshold])
              blobs_g = img.find_blobs([green_threshold])
              blobs_b = img.find_blobs([blue_threshold])
              if blobs_r:
                  max_r = find_max(blobs_r)
                  img.draw_rectangle(max_r[0:4])
                  img.draw_cross(max_r[5], max_r[6])
                  num[0]=max_r[5]
              if blobs_g:
                  max_g = find_max(blobs_g)
                  img.draw_rectangle(max_g[0:4])
                  img.draw_cross(max_g[5], max_g[6])
                  num[1]=max_g[5]
              if blobs_b:
                  max_b = find_max(blobs_b)
                  img.draw_rectangle(max_b[0:4])
                  img.draw_cross(max_b[5], max_b[6])
                  num[2]=max_b[5]
              imin=min(num)
              imax=max(num)
              if qrcode_flag==1:
                  qr=qr1
              else:
                  qr=qr2
              for q in qr:
                  if q=='1':
                      if num[0]==imin:
                          zhua[i]=1
                      elif num[0]==imax:
                          zhua[i]=3
                      else:
                          zhua[i]=2
                  if q=='2':
                      if num[1]==imin:
                          zhua[i]=1
                      elif num[1]==imax:
                          zhua[i]=3
                      else:
                          zhua[i]=2
                  if q=='3':
                      if num[2]==imin:
                          zhua[i]=1
                      elif num[2]==imax:
                          zhua[i]=3
                      else:
                          zhua[i]=2
                  i+=1
              if (zhua[0]==1 and zhua[1]==2 and zhua[2]==3):
                  print('1')
                  uart.write('1')
                  qrcode_flag=2
              if (zhua[0]==1 and zhua[1]==3 and zhua[2]==2):
                  print('2')
                  uart.write('2')
                  qrcode_flag=2
              if (zhua[0]==2 and zhua[1]==1 and zhua[2]==3):
                  print('3')
                  uart.write('3')
                  qrcode_flag=2
              if (zhua[0]==2 and zhua[1]==3 and zhua[2]==1):
                  print('4')
                  uart.write('4')
                  qrcode_flag=2
              if (zhua[0]==3 and zhua[1]==1 and zhua[2]==2):
                  print('5')
                  uart.write('5')
                  qrcode_flag=2
              if (zhua[0]==3 and zhua[1]==2 and zhua[2]==1):
                  print('6')
                  uart.write('6')
                  qrcode_flag=2
      
      


    • 求大佬们帮帮忙,之前还可以的,这两天一直遇到这种情况,刚开始运行就卡住了。



    • 如果你用VCP,就不要用OpenMV IDE调试代码。

      因为OpenMV IDE就是用VCP调试的。