导航

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

    Mr_Zty

    @Mr_Zty

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

    Mr_Zty 关注

    Mr_Zty 发布的帖子

    • RE: OPEN MV 插上SD卡以后不能脱机运行,LED灯一直是白色的,求助!

      将main.py拷贝到SD卡就行了

      发布在 OpenMV Cam
      M
      Mr_Zty
    • RE: 如何获取模板匹配物体中心坐标?

      @kidswong999 谢谢你

      发布在 OpenMV Cam
      M
      Mr_Zty
    • RE: 如何获取模板匹配物体中心坐标?

      报错显示:IndentationError: unindent does not match any outer indentation level

      import time, sensor, image
      from image import SEARCH_EX, SEARCH_DS#从imgae模块引入SEARCH_EX和SEARCH_DS。
      #使用from import仅仅引入SEARCH_EX, SEARCH_DS两个需要的部分,而不把image模块全部引入。
      
      sensor.reset()# 重置传感器
      
      sensor.set_contrast(1)#设置传感器
      sensor.set_gainceiling(16)#与SEARCH_EX的模板匹配的最大分辨率是QQVGA。
      sensor.set_framesize(sensor.QQVGA)#你可以设置窗口来减少搜索图像。#sensor.set_windowing(((640-80)//2, (480-60)//2, 80, 60))
      sensor.set_pixformat(sensor.GRAYSCALE)
      
      #加载模板。
      #模板应该是小的(如。为32 x32像素)灰度图像。
      template = image.Image("/make.pgm")
      #加载模板图片
      
      clock = time.clock()
      
      while (True):
          clock.tick()
          img = sensor.snapshot()
          img.lens_corr(strength=1.8, zoom=1.0)
      
          # find_template(template, threshold, [roi, step, search])
          # Step: The loop step used (y+=step, x+=step) use a bigger step to make it faster.
          # 步骤:使用的循环步骤(y+= Step, x+= Step)使用更大的步骤使其更快。
          # Search is either image.SEARCH_EX for exhaustive search or image.SEARCH_DS for diamond search
          # Note1: ROI必须小于图像,大于模板(template)。
          # Note2: In diamond search, step and ROI are both ignored.
          r = img.find_template(template, 0.70, step=4, search=SEARCH_EX) #, roi=(10, 0, 100, 80))
          #threshold中的0.70是相似度阈值,roi是进行匹配的区域(左上顶点为(10,0),长80宽60的矩形),
          #                           注意roi的大小要比模板图片大,比frambuffer小。
          #把匹配到的图像标记出来
          if r:
               img.draw_rectangle(r,color=0)
      
           print(r[0]+r[2]/2, r[1]+r[3]/2)
      
      
      发布在 OpenMV Cam
      M
      Mr_Zty
    • RE: 如何获取模板匹配物体中心坐标?

      @yuan @kidswong999 ```
      import time, sensor, image
      from image import SEARCH_EX, SEARCH_DS#从imgae模块引入SEARCH_EX和SEARCH_DS。
      #使用from import仅仅引入SEARCH_EX, SEARCH_DS两个需要的部分,而不把image模块全部引入。

      sensor.reset()# 重置传感器

      sensor.set_contrast(1)#设置传感器
      sensor.set_gainceiling(16)#与SEARCH_EX的模板匹配的最大分辨率是QQVGA。
      sensor.set_framesize(sensor.QQVGA)#你可以设置窗口来减少搜索图像。#sensor.set_windowing(((640-80)//2, (480-60)//2, 80, 60))
      sensor.set_pixformat(sensor.GRAYSCALE)

      #加载模板。
      #模板应该是小的(如。为32 x32像素)灰度图像。
      template = image.Image("/make.pgm")
      #加载模板图片

      clock = time.clock()

      while (True):
      clock.tick()
      img = sensor.snapshot()
      img.lens_corr(strength=1.8, zoom=1.0)

      # find_template(template, threshold, [roi, step, search])
      # Step: The loop step used (y+=step, x+=step) use a bigger step to make it faster.
      # 步骤:使用的循环步骤(y+= Step, x+= Step)使用更大的步骤使其更快。
      # Search is either image.SEARCH_EX for exhaustive search or image.SEARCH_DS for diamond search
      # Note1: ROI必须小于图像,大于模板(template)。
      # Note2: In diamond search, step and ROI are both ignored.
      r = img.find_template(template, 0.70, step=4, search=SEARCH_EX) #, roi=(10, 0, 100, 80))
      #threshold中的0.70是相似度阈值,roi是进行匹配的区域(左上顶点为(10,0),长80宽60的矩形),
      #                           注意roi的大小要比模板图片大,比frambuffer小。
      #把匹配到的图像标记出来
      if r:
          img.draw_rectangle(r,color=0)
      
      print(r[0]+r[2]/2, r[1]+r[3]/2)
      
      程序如上,但出现报错 :File "<stdin>", line 37, in <module>
      TypeError: 'NoneType' object is not subscriptable
      发布在 OpenMV Cam
      M
      Mr_Zty
    • RE: 如何获取模板匹配物体中心坐标?

      @kidswong999 @yuan 如何将匹配到物体的中心坐标打印出来

      发布在 OpenMV Cam
      M
      Mr_Zty
    • 使用模版匹配NCC模板时提示内存不足

      0_1525343546024_EQN1UT3U858%RXNL1RV(T4Y.png
      如图所示,使用的时IDE自带的示例,已安装SD卡,只使用了这一个模板;安装教程上的方法在内存不足时把QQVGA改成QQCIF也没有用

      发布在 OpenMV Cam
      M
      Mr_Zty