导航

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

    rfmg

    @rfmg

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

    rfmg 关注

    rfmg 发布的帖子

    • 为什么我的这个代码没办法识别绿色的圆啊,红色的可以,求解答

      这个颜色阈值的话单独识别是没有问题的,而且这个程序运行了之后没办法中断了

      import sensor, image, time
      
      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):
              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 23<statistics.l_mode()<61 and 25<statistics.a_mode()<97 and -13<statistics.b_mode()<77:#if the circle is red
                  img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0))#识别到的红色圆形用红色的圆框出来
              elif 36<statistics.l_mode()<100 and -11<statistics.a_mode()<-40 and -87<statistics.b_mode()<51:#if the circle is red
                  img.draw_circle(c.x(), c.y(), c.r(), color = ( 0,255, 0))#识别到的绿色圆形用圆框出来
              else:
                  img.draw_rectangle(area, color = (255, 255, 255))
                  #将非红色的圆用白色的矩形框出来
          #print("FPS %f" % clock.fps())
      
      
      发布在 OpenMV Cam
      R
      rfmg
    • 只有openmv4 h7 plus才能运行神经网络吗?我买错了。。。。

      只有openmv4 h7 plus才能运行神经网络吗?我买错了。。。。

      发布在 OpenMV Cam
      R
      rfmg