【问题标题】:Logo recognition using emguCV使用 emguCV 进行徽标识别
【发布时间】:2018-06-05 20:29:41
【问题描述】:

我已经实现了this 代码并在几张图片中检测到了徽标, 我能够得到一些类似 的结果,但我需要计算有多少图像包含这个标志, 可能类似于在大图像或其他东西中找到徽标的所有关键点。 我可以看到我在大图像中找到了徽标,但我想使用 emguCV 以编程方式确认它。 请帮忙。

--已编辑

这是一段带有单应性的代码,你能在这里指导我吗,因为我对 emguCV 和 openV 完全陌生,请帮我计算这些内联

public static Mat Draw(Mat modelImage, Mat observedImage, out long matchTime)
    {
        Mat homography;
        VectorOfKeyPoint modelKeyPoints;
        VectorOfKeyPoint observedKeyPoints;
        using (VectorOfVectorOfDMatch matches = new VectorOfVectorOfDMatch())
        {
            Mat mask;
            FindMatch(modelImage, observedImage, out matchTime, out modelKeyPoints, out observedKeyPoints, matches,
               out mask, out homography);

            //Draw the matched keypoints
            Mat result = new Mat();// new Size(400,400), modelImage.Depth, modelImage.NumberOfChannels);
            Features2DToolbox.DrawMatches(modelImage, modelKeyPoints, observedImage, observedKeyPoints,
               matches, result, new MCvScalar(255, 255, 255), new MCvScalar(255, 255, 255), mask);

            #region draw the projected region on the image

            if (homography != null)
            {
                
                //draw a rectangle along the projected model
                Rectangle rect = new Rectangle(Point.Empty, modelImage.Size);
                PointF[] pts = new PointF[]
                {
                      new PointF(rect.Left, rect.Bottom),
                      new PointF(rect.Right, rect.Bottom),
                      new PointF(rect.Right, rect.Top),
                      new PointF(rect.Left, rect.Top)
                };
                pts = CvInvoke.PerspectiveTransform(pts, homography);

                Point[] points = Array.ConvertAll<PointF, Point>(pts, Point.Round);
                using (VectorOfPoint vp = new VectorOfPoint(points))
                {
                    CvInvoke.Polylines(result, vp, true, new MCvScalar(255, 0, 0, 255), 5);
                }

            }

            #endregion

            return result;

        }
    }

【问题讨论】:

  • 从匹配中计算单应性并计算内点。如果许多匹配项支持单个单应性,则它们更有可能描述所需的徽标。
  • @Micka 请查看问题的编辑部分,我现在需要做什么来做这个单应性。

标签: c# opencv emgucv sift


【解决方案1】:

我认为我的回答有点晚了,但我可以帮助别人。使用以下代码片段,您可以计算属于您的问题的匹配特征点(计算行数)。重要的变量是 mask 变量。它包含信息。

private int CountHowManyParisExist(Mat mask) { 

Matrix<Byte> matrix = new Matrix<Byte>(mask.Rows, mask.Cols);
mask.CopyTo(matrix);

var matched = matrix.ManagedArray;
var list = matched.OfType<byte>().ToList();
var count = list.Count(a => a.Equals(1));

return count; 
}

【讨论】:

    猜你喜欢
    • 2011-10-13
    • 1970-01-01
    • 2011-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-08
    • 2015-09-07
    • 2019-07-18
    相关资源
    最近更新 更多