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



    • 0_1621925710182_e0a3b8d69877d5096ed8e91e0830bbc.png

      运行一段时间就发生卡死现象,然后直接直接断连,图为断连前打印数据

      0_1621925828959_42c91443-0791-4986-b76d-8faca401670c-image.png

      功能是同时识别二维码和条形码,如果画面有多个条形码,就取最上面一个。

      # Barcode Example
      #
      # This example shows off how easy it is to detect bar codes using the
      # OpenMV Cam M7. Barcode detection does not work on the M4 Camera.
      
      import sensor, image, time, math
      import time
      from pyb import Pin, Timer
      
      # 50kHz pin6 timer2 channel1
      light = Timer(2, freq=50000).channel(1, Timer.PWM, pin=Pin("P6"))
      light.pulse_width_percent(50) # adjust light 0~100
      
      import sensor, image, time
      sensor.reset()
      sensor.set_pixformat(sensor.GRAYSCALE)
      sensor.set_framesize(sensor.XGA) # High Res!
      sensor.set_windowing((1000, 400))# V Res of 80 == less work (40 for 2X the speed).
      sensor.skip_frames(time = 2000)
      sensor.set_auto_gain(False)  # must turn this off to prevent image washout...
      sensor.set_auto_whitebal(False)  # must turn this off to prevent image washout...
      clock = time.clock()
      
      # Barcode detection can run at the full 640x480 resolution of your OpenMV Cam's
      # OV7725 camera module. Barcode detection will also work in RGB565 mode but at
      # a lower resolution. That said, barcode detection requires a higher resolution
      # to work well so it should always be run at 640x480 in grayscale...
      
      def barcode_name(code):
          if(code.type() == image.EAN2):
              return "EAN2"
          if(code.type() == image.EAN5):
              return "EAN5"
          if(code.type() == image.EAN8):
              return "EAN8"
          if(code.type() == image.UPCE):
              return "UPCE"
          if(code.type() == image.ISBN10):
              return "ISBN10"
          if(code.type() == image.UPCA):
              return "UPCA"
          if(code.type() == image.EAN13):
              return "EAN13"
          if(code.type() == image.ISBN13):
              return "ISBN13"
          if(code.type() == image.I25):
              return "I25"
          if(code.type() == image.DATABAR):
              return "DATABAR"
          if(code.type() == image.DATABAR_EXP):
              return "DATABAR_EXP"
          if(code.type() == image.CODABAR):
              return "CODABAR"
          if(code.type() == image.CODE39):
              return "CODE39"
          if(code.type() == image.PDF417):
              return "PDF417"
          if(code.type() == image.CODE93):
              return "CODE93"
          if(code.type() == image.CODE128):
              return "CODE128"
      
      while(True):
          clock.tick()
          img = sensor.snapshot()
      
          codes = img.find_barcodes()
          codeh = 0
          y = 10000000
          print(len(codes))
          if (len(codes)>1):
              for code in codes:
                  img.draw_rectangle(code.rect())
                  y1 =code.y()
                  print(y1)
                  if(y1<y):
                      y = y1
                      codeh = code
      
              if(codeh != ""):
                  print_args = (barcode_name(codeh), codeh.payload(), (180 * codeh.rotation()) / math.pi, codeh.quality(), clock.fps())
                  print("Barcode %s, Payload \"%s\", rotation %f (degrees), quality %d, FPS %f" % print_args)
      
          else:
              for code in codes:
                  img.draw_rectangle(code.rect())
                  codeh = code
                  print_args = (barcode_name(codeh), codeh.payload(), (180 * codeh.rotation()) / math.pi, codeh.quality(), clock.fps())
                  print("Barcode %s, Payload \"%s\", rotation %f (degrees), quality %d, FPS %f" % print_args)
      
      
          #img.lens_corr(1.8) # strength of 1.8 is good for the 2.8mm lens.
          for code in img.find_qrcodes():
              img.draw_rectangle(code.rect(), color = (255, 0, 0))
              print(code)
          if not codes:
              print("FPS %f" % clock.fps())
      
      


    • 图一为卡死后自动断连的情况



    • 我运行没有发现错误,你检查一下是不是USB接口松了。



    • @kidswong999 现在测试第一次12分钟就断连 重新连接后 几分钟就断连,是不是xga大画面传输 导致温度太高了,然后自己断了 。



    • @kidswong999 因为摸着很烫



    • @kidswong999
      检查了usb接口,然后使用例程里面的条形码 改为xga画质,还是运行一段时间就卡死

      # Barcode Example
      #
      # This example shows off how easy it is to detect bar codes using the
      # OpenMV Cam M7. Barcode detection does not work on the M4 Camera.
      
      import sensor, image, time, math
      
      sensor.reset()
      sensor.set_pixformat(sensor.GRAYSCALE)
      sensor.set_framesize(sensor.XGA) # High Res!
      #sensor.set_windowing((640, 80)) # V Res of 80 == less work (40 for 2X the speed).
      sensor.skip_frames(time = 2000)
      sensor.set_auto_gain(False)  # must turn this off to prevent image washout...
      sensor.set_auto_whitebal(False)  # must turn this off to prevent image washout...
      clock = time.clock()
      
      # Barcode detection can run at the full 640x480 resolution of your OpenMV Cam's
      # OV7725 camera module. Barcode detection will also work in RGB565 mode but at
      # a lower resolution. That said, barcode detection requires a higher resolution
      # to work well so it should always be run at 640x480 in grayscale...
      
      def barcode_name(code):
          if(code.type() == image.EAN2):
              return "EAN2"
          if(code.type() == image.EAN5):
              return "EAN5"
          if(code.type() == image.EAN8):
              return "EAN8"
          if(code.type() == image.UPCE):
              return "UPCE"
          if(code.type() == image.ISBN10):
              return "ISBN10"
          if(code.type() == image.UPCA):
              return "UPCA"
          if(code.type() == image.EAN13):
              return "EAN13"
          if(code.type() == image.ISBN13):
              return "ISBN13"
          if(code.type() == image.I25):
              return "I25"
          if(code.type() == image.DATABAR):
              return "DATABAR"
          if(code.type() == image.DATABAR_EXP):
              return "DATABAR_EXP"
          if(code.type() == image.CODABAR):
              return "CODABAR"
          if(code.type() == image.CODE39):
              return "CODE39"
          if(code.type() == image.PDF417):
              return "PDF417"
          if(code.type() == image.CODE93):
              return "CODE93"
          if(code.type() == image.CODE128):
              return "CODE128"
      
      while(True):
          clock.tick()
          img = sensor.snapshot()
          codes = img.find_barcodes()
          for code in codes:
              img.draw_rectangle(code.rect())
              print_args = (barcode_name(code), code.payload(), (180 * code.rotation()) / math.pi, code.quality(), clock.fps())
              print("Barcode %s, Payload \"%s\", rotation %f (degrees), quality %d, FPS %f" % print_args)
          if not codes:
              print("FPS %f" % clock.fps())
      
      


    • @mesi 那你联系售后寄回维修,让售后复现问题。