【问题标题】:Correlation between two images using EMGU使用 EMGU 的两个图像之间的相关性
【发布时间】:2017-12-29 01:16:31
【问题描述】:

我已经搜索了几个小时...找不到任何帮助..

我正在使用 EMGU(初学者)并在此处找到:(How to calculate the correlation between two images in EMGU?) 执行关联的方法:

Image<>.MatchTemplate() 

我的问题是如何获得 x,y 班次。

非常感谢。

【问题讨论】:

    标签: c# opencv emgucv


    【解决方案1】:

    不需要编写自己的循环来查找最小/最大值和 x/y 点,并且您自己的代码运行速度将比内置和高度优化的 c++ 版本慢得多

    您正在寻找的功能是单线

    res.MinMax(minValue, maxValue, pointMin, pointMax)

    http://www.emgu.com/wiki/files/1.3.0.0/html/a6a35810-2a33-f1a7-ea9a-27371688fd77.htm

    这里使用 MinMax How to find the max occurred color in the picture using EMGU CV in C#?

    【讨论】:

      【解决方案2】:

      天哪...终于找到了 + maxVal 给出了比赛的质量。

      var res = img1.MatchTemplate(img2, TemplateMatchingType.CcoeffNormed);
              int maxXIdx = 0, maxYIdx = 0;
              float maxVal = float.MinValue;
              var dat = res.Data;
              int numChanels = dat.GetLength(2),
                  numCols = res.Cols, numRows = res.Rows;
              for (int i = 0; i < numChanels; i++)
              {
                  for (int x = 0; x < numCols; x++)
                  {
                      for (int y = 0; y < numRows; y++)
                      {
                          var val = dat[y, x, i];
                          if (val > maxVal)
                          {
                              maxVal = val;
                              maxXIdx = x;
                              maxYIdx = y;
                          }
                      }
                  }
              }
              int shiftX = maxXIdx, shiftY = maxYIdx;
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2014-02-27
        • 2014-04-11
        • 2020-04-23
        • 2011-08-09
        • 1970-01-01
        • 2012-12-29
        • 2017-12-10
        相关资源
        最近更新 更多