导航

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

    cv36

    @cv36

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

    cv36 关注

    cv36 发布的帖子

    • 怎么同时识别多个特征点的物体?

      *已经录入多个物体的特征点了,但为啥识别的时候没法同时识别他们。
      *我要怎么改代码使其能同时识别多个物体?

      import sensor, time, image
      
      # 重置传感器
      sensor.reset()
      
      # 传感器设置
      sensor.set_contrast(3)
      sensor.set_gainceiling(16)
      sensor.set_framesize(sensor.VGA)
      sensor.set_windowing((320, 240))
      sensor.set_pixformat(sensor.GRAYSCALE)
      
      sensor.skip_frames(time = 2000)
      sensor.set_auto_gain(False, value=100)
      
      #画出特征点
      def draw_keypoints(img, kpts):
          if kpts:
              print(kpts)
              img.draw_keypoints(kpts)
              img = sensor.snapshot()
              time.sleep_ms(1000)
      
      
      kpts1 = image.load_descriptor("/desc.orb")
      img = sensor.snapshot()
      kpts2 = image.load_descriptor("/desc0.orb")
      img = sensor.snapshot()
      
      
      clock = time.clock()
      
      while (True):
          clock.tick()
          img = sensor.snapshot()
          if  (kpts1 == None):
        
            
              kpts1 = img.find_keypoints(max_keypoints=150, threshold=10, scale_factor=1.2)
              draw_keypoints(img, kpts1)
      
          else:
           
      
      
              kpts2 = img.find_keypoints(max_keypoints=150, threshold=10, normalized=True)
      
              if (kpts2):
      
                  match = image.match_descriptor(kpts1, kpts2, threshold=85)
       
                  if (match.count()>10):
      
                      img.draw_rectangle(match.rect())
                      img.draw_cross(match.cx(), match.cy(), size=10)
      
      。
                  print(kpts2, "matched:%d dt:%d"%(match.count(), match.theta()))
      
      
      
          img.draw_string(0, 0, "FPS:%.2f"%(clock.fps()))
      
      
      发布在 OpenMV Cam
      C
      cv36
    • 在模板匹配里怎么设置roi大小啊?
      import time, sensor, image
      from image import SEARCH_EX, SEARCH_DS
      
      
      sensor.reset()
      
      
      sensor.set_contrast(1)
      sensor.set_gainceiling(16)
      
      sensor.set_framesize(sensor.QQVGA)
      
      sensor.set_pixformat(sensor.GRAYSCALE)
      
      
      template = image.Image("/11.pgm")
      
      clock = time.clock()
      
      while (True):
          clock.tick()
          img = sensor.snapshot()
      
      
      
          r = img.find_template(template, 0.70, step=4, search=SEARCH_EX) #, roi=(10, 0, 60, 60))
          if r:
              img.draw_rectangle(r)
      
          print(clock.fps())
      
      
      发布在 OpenMV Cam
      C
      cv36
    • 为什么会出现这个啊:objet 'int`t' isn`t a tuple or list?
      # 多颜色多模板匹配示例
      #
      # 这个例子显示了使用OpenMV的多色跟踪。
      
      import sensor, image, time
      from image import SEARCH_EX, SEARCH_DS
      
      # 颜色跟踪阈值(L Min, L Max, A Min, A Max, B Min, B Max)
      # 下面的阈值跟踪一般红色/绿色的东西。你不妨调整他们...
      thresholds = (30, 73, -38, -11, -15, 13) # generic_blue_thresholds
      # 不要超过16个颜色阈值
      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()
      
      # 只有比“pixel_threshold”多的像素和多于“area_threshold”的区域才被
      # 下面的“find_blobs”返回。 如果更改相机分辨率,
      # 请更改“pixels_threshold”和“area_threshold”。 “merge = True”合并图像中所有重叠的色块。
      
      templates = ["/pen1.pgm", "/pen2.pgm", "/pen3.pgm", "/pen4.pgm"] #保存多个模板
      
      while(True):
          clock.tick()
          img = sensor.snapshot()
          for blob in img.find_blobs(thresholds, pixels_threshold=200, area_threshold=200):
              #img.draw_rectangle(blob.rect())
              #img.draw_cross(blob.cx(), blob.cy())
              #print(blob.code())
      
              img = img.to_grayscale()
              for t in templates:
                  template = image.Image(t)
                  #对每个模板遍历进行模板匹配
                  r = img.find_template(template, 0.70, step=4, search=SEARCH_EX) #, roi=(10, 0, 60, 60))
              #find_template(template, threshold, [roi, step, search]),threshold中
              #的0.7是相似度阈值,roi是进行匹配的区域(左上顶点为(10,0),长80宽60的矩形),
              #注意roi的大小要比模板图片大,比frambuffer小。
              #把匹配到的图像标记出来
                  if r:
                      img.draw_rectangle(r, color=0)
                      print(blob.code(), t) #打印模板名字
                  
      
      
          #print(clock.fps())
      
      
      发布在 OpenMV Cam
      C
      cv36
    • RE: 模板匹配,模板大小能更改吗

      @kidswong999 怎么修改roi使其大于模板啊?

      发布在 OpenMV Cam
      C
      cv36
    • 怎么用openMV cam 识别到不同种类的垃圾,然后把数据传送到小车和机械臂来操控他们去抓取垃圾并送到对应的垃圾箱?

      怎么用颜色模板匹配和数据送等代码使小车控制小车做指定动作?

      发布在 OpenMV Cam
      C
      cv36