导航

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

    2mdu

    @2mdu

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

    2mdu 关注

    2mdu 发布的帖子

    • RE: 模板匹配怎么匹配不出来物品

      0_1691475369196_微信图片_20230808141507.png 正方形老是被识别成三角形。。。。。。其中页面中还识别出好多多余的+

      发布在 OpenMV Cam
      2
      2mdu
    • 模板匹配怎么匹配不出来物品

      想匹配正方形,老是把正方形识别成三角形。0_1691466639981_2.png

      发布在 OpenMV Cam
      2
      2mdu
    • RE: 模板匹配是否支持同时识别颜色和形状

      找到了代码了了了

      发布在 OpenMV Cam
      2
      2mdu
    • 模板匹配是否支持同时识别颜色和形状

      利用模板匹配能实现同时识别颜色和形状么??目前只能识别形状,不能识别得颜色。

      发布在 OpenMV Cam
      2
      2mdu
    • RE: 矩形识别后,再识别颜色异常

      我看代码没有差别,找不到什么原因导致得。

      发布在 OpenMV Cam
      2
      2mdu
    • RE: 矩形识别后,再识别颜色异常

      0_1690870775110_2.png

      发布在 OpenMV Cam
      2
      2mdu
    • RE: 矩形识别后,再识别颜色异常

      @kidswong999 识别不出来矩形

      发布在 OpenMV Cam
      2
      2mdu
    • RE: 矩形识别后,再识别颜色异常

      识别视频中的形状率极低,这样情况怎么处理啊

      发布在 OpenMV Cam
      2
      2mdu
    • RE: 矩形识别后,再识别颜色异常
      import sensor, image, time
      from pyb import UART
      
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time = 1000)
      sensor.set_auto_gain(False)
      sensor.set_auto_whitebal(False)
      clock = time.clock()
      
      
      
      thresholds = [(16, 71, 15, 102, -23, 97), # red_thresholds
                    (11, 29, -33, -17, 0, 48), # green_thresholds
                    (0, 42, -23, 16, -46, -5)] # blue_thresholds
      
      shape = 1
      threshold_index =0
      area = 0
      uart = UART(3, 115200)
      
      
      def sending_data(cx,cy):
          global uart;
          data = ustruct.pack("<bbhhb",
                         0x2C,
                         0x12,
                         int(cx),
                         int(cy),
                         0x5B)
          uart.write(data);
      
      
      def receive_data():
          global uart
          if uart.any():
              tmp_data = uart.readline();
              print("====接收===",tmp_data)
              return tmp_data;
      
      
      
      def detect_shape(shape):
             row_data=[-1,-1]
             global area
        #  if shape==1:
             for r in img.find_rects(threshold=10000):
                 area=(r[0], r[1], r[2], r[3])
                 statistics = img.get_statistics(roi=area)
                 xq= r[2] / r[3]
                 if 0<statistics.l_mode()<100 and 20<statistics.a_mode()<127 and 10<statistics.b_mode()<127 and 0.8<xq<1.2:
                    row_data[0]= 1
                 elif 0<statistics.l_mode()<100 and -128<statistics.a_mode()<-23 and -128<statistics.b_mode()<127 and 0.8<xq<1.2:
                   row_data[0]= 3
                 elif 0<statistics.l_mode()<100 and -128<statistics.a_mode()<127 and -128<statistics.b_mode()<-2 and 0.8<xq<1.2:
                    row_data[0]= 2
                 row_data[1]=1
                 img.draw_rectangle(r.rect(), color = (255, 255, 255))
        #  elif shape==2:
             for c in img.find_circles(threshold =2000, 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())
                 statistics = img.get_statistics(roi=area)
                 if 0<statistics.l_mode()<100 and -128<statistics.a_mode()<0 and 0<statistics.b_mode()<127:#红色
                     row_data[0]= 1
                 elif 0<statistics.l_mode()<100 and -128<statistics.a_mode()<0 and 0<statistics.b_mode()<127:#绿色
                     row_data[0]= 3
                 elif 0<statistics.l_mode()<100 and -128<statistics.a_mode()<127 and -128<statistics.b_mode()<-2:#蓝色
                      row_data[0]= 2
                 row_data[1]=2
                 img.draw_circle(c.x(), c.y(), c.r(), color = (255, 255, 255))
         # elif shape==3:
            #    for l in img.find_line_segments(roi=[60,40,150,150],merge_distance = 10, max_theta_diff = 10):
             #      img.draw_line(l.line(), color = (0, 0, 255))
             return row_data
      
      
      
      while(True):
          clock.tick()
         # data= receive_data();
          img = sensor.snapshot()
          result =detect_shape(shape)
          print(clock.fps())
      
      发布在 OpenMV Cam
      2
      2mdu
    • RE: 矩形识别后,再识别颜色异常

      statistics 怎么获取范围值,比如图中 的红色和蓝色啊

      发布在 OpenMV Cam
      2
      2mdu