导航

    • 登录
    • 搜索
    • 版块
    • 产品
    • 教程
    • 论坛
    • 淘宝
    1. 主页
    2. 13538614682
    3. 楼层
    1
    • 举报资料
    • 资料
    • 关注
    • 粉丝
    • 屏蔽
    • 帖子
    • 楼层
    • 最佳
    • 群组

    13538614682 发布的帖子

    • RE: 根据官网颜色自动追踪实例进行修改写了一段程序但出现了错误,请问是怎么回事?

      @kidswong999 因为要测距啊,那要怎么改

      发布在 OpenMV Cam
      1
      13538614682
    • 根据官网颜色自动追踪实例进行修改写了一段程序但出现了错误,请问是怎么回事?

      如图所示在串行终端显示“Learning thresholds”的时候摄像头还能对物体进行追踪,但在“Threshold learned...”和“Tracking colors...”出现之后就追踪不到,请问哪里还需要修改。

      import sensor, image,time,pyb
      from pyb import UART
      
      uart = UART(3,9600)
      
      print("Letting auto algorithms run. Don't put anything in front of the camera!")
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time = 2000)
      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()
      
      K=650#the value should be measured  50*13
      K2=0.1#实际大小=k*直径的像素  k=5/50
      
      # Capture the color thresholds for whatever was in the center of the image.
      r = [(320//2)-(50//2), (240//2)-(50//2), 50, 50] # 50x50 center of QVGA.
      
      print("Auto algorithms done. Hold the object you want to track in front of the camera in the box.")
      print("MAKE SURE THE COLOR OF THE OBJECT YOU WANT TO TRACK IS FULLY ENCLOSED BY THE BOX!")
      for i in range(60):
          img = sensor.snapshot()
          img.draw_rectangle(r)
      
      print("Learning thresholds...")
      threshold = [50, 50, 0, 0, 0, 0] # Middle L, A, B values.
      for i in range(60):
          r = [(320//2)-(50//2), (240//2)-(50//2), 50, 50] # 50x50 center of QVGA.
          img = sensor.snapshot()
          hist = img.get_histogram(roi=r)
          lo = hist.get_percentile(0.01) # Get the CDF of the histogram at the 1% range (ADJUST AS NECESSARY)!
          hi = hist.get_percentile(0.99) # Get the CDF of the histogram at the 99% range (ADJUST AS NECESSARY)!
          # Average in percentile values.
          threshold[0] = (threshold[0] + lo.l_value()) // 2
          threshold[1] = (threshold[1] + hi.l_value()) // 2
          threshold[2] = (threshold[2] + lo.a_value()) // 2
          threshold[3] = (threshold[3] + hi.a_value()) // 2
          threshold[4] = (threshold[4] + lo.b_value()) // 2
          threshold[5] = (threshold[5] + hi.b_value()) // 2
          for blob in img.find_blobs([threshold], pixels_threshold=100, area_threshold=100, merge=True, margin=10):
              img.draw_rectangle(blob.rect())
              img.draw_cross(blob.cx(), blob.cy())
              img.draw_rectangle(r)
      
      print("Thresholds learned...")
      print("Tracking colors...")
      
      while(True):
          clock.tick() # Track elapsed milliseconds between snapshots().
          img = sensor.snapshot() # Take a picture and return the image.
          for blob in img.find_blobs([threshold], pixels_threshold=100, area_threshold=100, merge=True, margin=10):
              blobs = img.find_blobs([threshold])
              if len(blobs) == 1:
                  # Draw a rect around the blob.
                  b = blobs[0]
                  img.draw_rectangle(b[0:4]) # rect
                  img.draw_cross(b[5], b[6]) # cx, cy
                  Lm = (b[2]+b[3])/2
                  length = K/Lm
                  print("length:%s cm"%(length))
                  #print(Lm)
                  size=K2*Lm
                  print(size)
      
                  h=K2*b[3]
                  w=K2*b[2]
                  print("high:%s cm, width:%s cm"%(h,w))
      
                  output_str="[%.1f,%.1f,%.1f]" % (length,h,w)
                  print('you send:',output_str)
                  uart.write(output_str+'\r\n')
              else:
                  print('not found!')
      
      
      
      
          #print(clock.fps())
      

      0_1556306538233_1.png 0_1556306543372_2.png 0_1556306547694_3.png

      发布在 OpenMV Cam
      1
      13538614682
    • 升级OpenMv IDE之后电脑就检查不到OpenMv

      升级固件的两种方法都试过了。插进电脑之后led灯一直在闪但就是连接不到。

      发布在 OpenMV Cam
      1
      13538614682
    • 请问OpenMV可以实现自动修改其阈值识别颜色吗?

      请问OpenMV可以实现通过扫描缓冲区里的图片,然后得到一样物品的LAB阈值然后返回给threshold然后识别那样物品吗?就是自动识别。还是只能自己手动通过IDE软件确定其阈值再修改threshold才能识别?

      发布在 OpenMV Cam
      1
      13538614682