• 星瞳AI VISION软件内测!可以离线标注,训练,并生成OpenMV的模型。可以替代edge impulse https://forum.singtown.com/topic/8206
  • 我们只解决官方正版的OpenMV的问题(STM32),其他的分支有很多兼容问题,我们无法解决。
  • 如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修
  • 发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • 阈值列表里有多种颜色就提示错误,怎么解决。



    • import sensor, image, time
      import car
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time = 2000)
      block_box_color = [(0, 29, -52, 55, -114, 49),
                        (30, 100, -64, -8, -32, 32)]
      def expand_roi(roi):
          extra = 5
          win_size = (640, 240)
          (x, y, width, height) = roi
          new_roi = [x-extra, y-extra, width+2*extra, height+2*extra]
          if new_roi[0] < 0:
              new_roi[0] = 0
          if new_roi[1] < 0:
              new_roi[1] = 0
          if new_roi[2] > win_size[0]:
              new_roi[2] = win_size[0]
          if new_roi[3] > win_size[1]:
              new_roi[3] = win_size[1]
          return tuple(new_roi)
      i = 0
      clock = time.clock()
      while(True):
          clock.tick()
          img = sensor.snapshot()
          img.replace(img,vflip=True, hmirror=True, transpose=False)
          img.draw_line(0,200,320,200,(0,0,255),thinkness = 1)
          find_block = img.find_blobs([block_box_color], area_threshold=10000)
          car.run(25,25)
          if find_block:
              for blob in find_block:
                  is_line = False
                  max_line = None
                  max_length = -1
                  is_block = 0
                  new_roi = expand_roi(blob.rect())
                  img.draw_rectangle(new_roi)
                  img.draw_cross(blob[5], blob[6])
                  ltx = new_roi[0]
                  lty = new_roi[1]
                  lbx = new_roi[0]
                  lby = new_roi[1] + new_roi[3]
                  rtx = new_roi[0] + new_roi[2]
                  rty = new_roi[1]
                  rbx = new_roi[0] + new_roi[2]
                  rby = new_roi[1] + new_roi[3]
                  print("ltx=",ltx,"lty=",lty)
                  print("lbx=",lbx,"lby=",lby)
                  print("rtx=",rtx,"rty=",rty)
                  print("rbx=",rbx,"rby=",rby)
                  print("\n")
                  if lby > 200 :
                      car.turn_left(120)
                      print("turn_left")
      

      0_1659965267897_xiaokeai.png



    • img.find_blobs([block_box_color], area_threshold=10000)

      改为

      img.find_blobs(block_box_color, area_threshold=10000)