• 免费好用的星瞳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就会断开连接,这是什么原因?



    • Single Color RGB565 Blob Tracking Example

      This example shows off single color RGB565 tracking using the OpenMV Cam.

      import sensor, image, time, pyb
      from pyb import UART

      #4种灯
      red_led = pyb.LED(1)
      green_led = pyb.LED(2)
      blue_led = pyb.LED(3)
      infrared_led = pyb.LED(4)

      #串口设置
      uart = UART(3, 115200)
      uart.init(115200, bits=8, parity=None, stop=1, timeout_char=1000 ,read_buf_len=64)

      Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max)

      The below thresholds track in general red/green/blue things. You may wish to tune them...

      thresholds = [(6, 100, -64, -8, -32, 32), # day_generic_green_thresholds
      (6, 100, -64, -8, -32, 32), # night_generic_green_thresholds
      (0, 30, 0, 64, -128, 0)] # generic_blue_thresholds

      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time = 200)
      sensor.set_auto_gain(False) # must be turned off for color tracking
      sensor.set_auto_whitebal(False) # must be turned off for color tracking
      clock = time.clock()

      Only blobs that with more pixels than "pixel_threshold" and more area than "area_threshold" are

      returned by "find_blobs" below. Change "pixels_threshold" and "area_threshold" if you change the

      camera resolution. "merge=True" merges all overlapping blobs in the image.

      day_flag = True
      Uart_Rcv0 = 70
      Uart_Rcv1 = 0
      Igrcnt = 0

      while(True):
      UartRcv1 = uart.readchar()
      if(UartRcv1 == 70 or UartRcv1 == 69):
      Uart_Rcv0 = UartRcv1
      elif(UartRcv1 == 72 or UartRcv1 == 71):
      Uart_Rcv1 = UartRcv1
      print("Uart_Rcv0=",Uart_Rcv0)
      if(Uart_Rcv0 == 70):
      print("from_night_to_day")
      uart.write('F')
      day_flag = True
      time.sleep(50)
      elif(Uart_Rcv0 == 69):
      print("from_day_to_night")
      infrared_led.on()
      uart.write('E')
      day_flag = False
      time.sleep(50)
      if((Uart_Rcv0 == 69 or Uart_Rcv0 == 70) and Uart_Rcv1 == 72): #下位机会一直给openMV串口发送70,只有触发条件满足时才会发72,
      clock.tick()
      blue_led.on()
      img = sensor.snapshot()
      if(day_flag):
      for blob in img.find_blobs([thresholds[0]], pixels_threshold=200, area_threshold=3000, merge=True, margin=1):
      img.draw_rectangle(blob.rect())
      img.draw_cross(blob.cx(), blob.cy())
      print("blob.area()=",blob.area())
      if (blob.area() >= 5000):
      uart.write('A')
      Igrcnt = 0
      Uart_Rcv1 = 0
      else:
      for blob in img.find_blobs([thresholds[1]], pixels_threshold=200, area_threshold=3000, margin=1):
      img.draw_rectangle(blob.rect())
      img.draw_cross(blob.cx(), blob.cy())
      print("blob.area()=",blob.area())
      if (blob.area() >= 5000):
      uart.write('A')
      Igrcnt = 0
      Uart_Rcv1 = 0

          Igrcnt += 1
          if(Igrcnt >= 4):
              Igrcnt = 0
              uart.write('B')
              Uart_Rcv1 = 0
      blue_led.off()
      #print(clock.fps())


    • 什么叫做断开连接,说具体的现象



    • 就好像烧录进openMV板子里的程序没有在一直运行一样,openMV板子如果没有在运行会有什么现象吗?



    • 说具体的现象...



    • 我又不知道你说的“烧录进openMV板子里的程序没有在一直运行一样”是什么现象。。。



    • 找到原因了,是内存溢出了