导航

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

    botu

    @botu

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

    botu 关注

    botu 发布的帖子

    • RE: 在线等大佬求助解答,为什么会这样?

      0_1716554493889_1.png

      发布在 OpenMV Cam
      B
      botu
    • RE: 在线等大佬求助解答,为什么会这样?

      @kidswong999 0_1716554283787_@D$RHO(IM%HT1)4I_UPW9ET.png !

      发布在 OpenMV Cam
      B
      botu
    • RE: 在线等大佬求助解答,为什么会这样?

      ![0_1716554234285_NI0~~OZW8Q1T$VG]$I((FCL.png](正在上传 0%) @kidswong999 ![0_1716554220064_@D$RHO(IM%HT1)4I_UPW9ET.png](正在上传 0%)

      发布在 OpenMV Cam
      B
      botu
    • RE: 在线等大佬求助解答,为什么会这样?
      # Template Matching Example - Normalized Cross Correlation (NCC)
      #
      # This example shows off how to use the NCC feature of your OpenMV Cam to match
      # image patches to parts of an image... expect for extremely controlled enviorments
      # NCC is not all to useful.
      #
      # WARNING: NCC supports needs to be reworked! As of right now this feature needs
      # a lot of work to be made into somethin useful. This script will reamin to show
      # that the functionality exists, but, in its current state is inadequate.
      
      import time, sensor, image
      from image import SEARCH_EX, SEARCH_DS
      #从imgae模块引入SEARCH_EX和SEARCH_DS。使用from import仅仅引入SEARCH_EX,
      #SEARCH_DS两个需要的部分,而不把image模块全部引入。
      
      # Reset sensor
      sensor.reset()
      
      # Set sensor settings
      sensor.set_contrast(1)
      sensor.set_gainceiling(16)
      # Max resolution for template matching with SEARCH_EX is QQVGA
      sensor.set_framesize(sensor.QQVGA)
      # You can set windowing to reduce the search image.
      #sensor.set_windowing(((640-80)//2, (480-60)//2, 80, 60))
      sensor.set_pixformat(sensor.GRAYSCALE)
      
      # Load template.
      # Template should be a small (eg. 32x32 pixels) grayscale image.
      template = image.Image("/image/e-5.pgm")
      #加载模板图片
      
      clock = time.clock()
      
      # Run template matching
      while (True):
          clock.tick()
          img = sensor.snapshot()
      
          # find_template(template, threshold, [roi, step, search])
          # ROI: The region of interest tuple (x, y, w, h).
          # Step: The loop step used (y+=step, x+=step) use a bigger step to make it faster.
          # Search is either image.SEARCH_EX for exhaustive search or image.SEARCH_DS for diamond search
          #
          # Note1: ROI has to be smaller than the image and bigger than the template.
          # Note2: In diamond search, step and ROI are both ignored.
          r = img.find_template(template, 0.60, 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)
      
          print(clock.fps())
      
      

      这是模板匹配的代码

      发布在 OpenMV Cam
      B
      botu
    • RE: 在线等大佬求助解答,为什么会这样?
      import sensor, image
      
      # 初始化摄像头
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time=2000)
      
      # 加载模板图像
      template = image.Image("/image/e-5.pgm", copy_to_fb=True)
      
      # 定义模板匹配的阈值
      threshold = 0.7
      
      while True:
          # 拍摄一张图像
          img = sensor.snapshot()
          
          # 在整个图像中搜索模板
          res = img.find_template(template, threshold, roi=(0, 0, img.width(), img.height()))
          
          # 如果找到了匹配
          if res:
              # 获取匹配位置的中心点
              cx = res[0] + res[2] // 2
              
              # 计算图像中心点与模板匹配中心点的横坐标差距
              img_center_x = img.width() // 2
              distance_x = img_center_x - cx
              
              # 打印横坐标差距到串行终端
              print("Horizontal Distance:", distance_x)
      
      
      发布在 OpenMV Cam
      B
      botu
    • RE: 在线等大佬求助解答,为什么会这样?

      @kidswong999 0_1716553856944_QQ图片20240524203047.png

      发布在 OpenMV Cam
      B
      botu
    • RE: 在线等大佬求助解答,为什么会这样?

      你好大佬,我的问题是这样的
      我想问下为什么这里总是显示没有未压缩的图片,但是我截取的图片采用的就是openmv官网给的代码,openmv进行模板匹配的图片必须是pgm格式,但是模板截取不能直接生成pgm格式,要转换格式必须进行压缩,这不是自相矛盾吗

      发布在 OpenMV Cam
      B
      botu
    • RE: 在线等大佬求助解答,为什么会这样?

      dddddddd

      发布在 OpenMV Cam
      B
      botu
    • RE: 在线等大佬求助解答,为什么会这样?

      在线等,挺急的:😭

      发布在 OpenMV Cam
      B
      botu
    • 在线等大佬求助解答,为什么会这样?

      0_1716475498518_QQ图片20240523224440.png
      rt,我在使用模板匹配时将roi的值省略,而且模板图片截取也是完全没有压缩,直接保存为pgm格式,路径名也检查过了完全没有问题,但是依然显示ValueError: Expected an uncompressed image错误,请问为什么

      发布在 OpenMV Cam
      B
      botu