导航

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

    klob 发布的帖子

    • RE: 新手提问,openmv识别最大的球,为什么用框框面积不行,求助!

      我主要想通过这个代码来识别出距离摄像头最近的红球

      发布在 OpenMV Cam
      K
      klob
    • 新手提问,openmv识别最大的球,为什么用框框面积不行,求助!
      import sensor, image, time, math
      thresholds = [(30, 100, 15, 127, 15, 127), # generic_red_thresholds
                    (30, 100, -64, -8, -32, 32), # generic_green_thresholds
                    (0, 15, 0, 40, -80, -20)] # generic_blue_thresholds
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time = 2000)
      sensor.set_auto_gain(False) #自动增益开启(True)或者关闭(False)。在使用颜色追踪时,需要关闭自动增益。
      sensor.set_auto_whitebal(False) # 自动白平衡开启(True)或者关闭(False)。在使用颜色追踪时,需要关闭自动白平衡。
      clock = time.clock()
      sensor.set_vflip(True)#垂直方向反转
          int max_area=0;
      while(True):
          clock.tick()
          img = sensor.snapshot()
          for blob in img.find_blobs([thresholds[0]], pixels_threshold=200, area_threshold=200):
              if (blob.area()>max_area)
                  max_area = blob.area()
              if (max_area>blob.area())
                  img.draw_rectangle(blob.rect())
      

      0_1570868979492_78847f1cdd890c0c64b0504bd513d30.png

      发布在 OpenMV Cam
      K
      klob