导航

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

    axw1

    @axw1

    0
    声望
    6
    楼层
    505
    资料浏览
    0
    粉丝
    0
    关注
    注册时间 最后登录

    axw1 关注

    axw1 发布的帖子

    • 大佬们,OPENMV3和POENMV4的二维码识别都是官网上同一个例程吗?

      大佬们,OPENMV3和POENMV4的二维码识别都是官网上同一个例程吗?

      发布在 OpenMV Cam
      A
      axw1
    • RE: 已知图中绿色圆的阈值,如何返回该颜色下圆形的数量?

      for c in img.find_circles(threshold = 3500, x_margin = 10, y_margin = 10, r_margin = 10,
      r_min = 2, r_max = 100, r_step = 2): #3500比较合适。如果视野中检测到的圆过多,请增大阈值;
      if 1<statistics.l_mode()<71 and -128<statistics.a_mode()<-18 and -128<statistics.b_mode()<127:#if the circle is red
      img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0))#识别到的绿色圆形用红色的圆框出来
      #green_threshold.append(c) #找到了绿色的圆,并用红框圈起来,该如何返回这个圆的个数?

      串口输出:{"x":90, "y":48, "r":32, "magnitude":4585}

      我的问题是如何返回这个颜色下圆形的个数?
      球球别再给我发识别圆形个数的链接了,求思路解答。

      发布在 OpenMV Cam
      A
      axw1
    • RE: 已知图中绿色圆的阈值,如何返回该颜色下圆形的数量?
      green_threshold = (71, 1, -128, -18, -128, 127)
      
      red_cicle_number = img.find_circles(threshold=green_threshold, x_margin = 10, y_margin = 10, r_margin = 10,
      
      发布在 OpenMV Cam
      A
      axw1
    • RE: 已知图中绿色圆的阈值,如何返回该颜色下圆形的数量?
      import sensor, image, time
      
      
      green_threshold   = (71, 1, -128, -18, -128, 127)
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQVGA)
      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()
      
      while(True):
          clock.tick()
          img = sensor.snapshot().lens_corr(1.8)
          for c in img.find_circles(threshold = 3500, x_margin = 10, y_margin = 10, r_margin = 10,
                  r_min = 2, r_max = 100, r_step = 2):   #3500比较合适。如果视野中检测到的圆过多,请增大阈值;
                  # 相反,如果视野中检测到的圆过少,请减少阈值。
              area = (c.x()-c.r(), c.y()-c.r(), 2*c.r(), 2*c.r())
              #area为识别到的圆的区域,即圆的外接矩形框
              statistics = img.get_statistics(roi=area)#像素颜色统计
              #print(statistics)
              #(0,100,0,120,0,120)是红色的阈值,所以当区域内的众数(也就是最多的颜色),范围在这个阈值内,就说明是红色的圆。
              #l_mode(),a_mode(),b_mode()是L通道,A通道,B通道的众数。
              if 1<statistics.l_mode()<71 and -128<statistics.a_mode()<-18 and -128<statistics.b_mode()<127:#if the circle is red
                  img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0))#识别到的红色圆形用红色的圆框出来
                  red_cicle_number = img.find_circles(threshold=green_threshold, x_margin = 10, y_margin = 10, r_margin = 10,
                  r_min = 2, r_max = 100, r_step = 2)
                  print(len(red_cicle_number))
      
             # elif 30<statistics.l_mode()<100 and 15<statistics.a_mode()<127 and 15<statistics.b_mode()<127:#if the circle is red
             #         img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0))#识别到的红色圆形用红色的圆框出来
              else:
                  img.draw_rectangle(area, color = (255, 255, 255))
                  #将非红色的圆用白色的矩形框出来
         # print("FPS %f" % clock.fps())
      

      TypeError: can't convert tuple to int

      发布在 OpenMV Cam
      A
      axw1
    • RE: 已知图中绿色圆的阈值,如何返回该颜色下圆形的数量?

      这个链接里面的程序是将不同颜色的圆圈出来,问题是如何识别不同颜色下圆的个数,假如我知道了这个颜色下的圆的阈值,我也看了那个识别有效圆形个数的代码,但是如何把阈值threshold[ (30, 100, -64, -8, -32, 32)] 绿色 放进img.find_circles(xxxx)里,我放进去,它就报错,说是length过长。

      发布在 OpenMV Cam
      A
      axw1
    • 已知图中绿色圆的阈值,如何返回该颜色下圆形的数量?

      threshold[ (30, 100, -64, -8, -32, 32)] 绿色
      一堆圆 = img.find_circles(xxxxxxx)这里面的参数该如何配置?

      print(len(一堆圆))#打印 一堆圆的 数量,比如5
      返回圆形数量会,识别不同颜色的圆也会,但是如何识别不同颜色下圆形的个数?

      发布在 OpenMV Cam
      A
      axw1