Use SURF to match images in OpenCV\EmguCV

送分小仙女□ 提交于 2019-12-12 01:34:50

问题


I'm working on the source code from here.

It seems that indices variable stores the match information, but I don't know how the information is stored.

For example, can you tell me how many matched pair of points are found? Which point matches which point?


回答1:


Take a look on this line.

Image<Bgr, Byte> result = Features2DToolbox.DrawMatches(modelImage, modelKeyPoints, observedImage, observedKeyPoints,
        indices, new Bgr(255, 255, 255), new Bgr(255, 255, 255), mask, Features2DToolbox.KeypointDrawType.DEFAULT);

The most important variable is mask. This variable has all need information. It is array. If value on this array is equal 1 that means that we have a common pair. You have to count how many times appears 1 in this array.

    public int CountHowManyPairsExist( Matrix<byte> mask)
    {
        var matched = mask.ManagedArray;
        var list = matched.OfType<byte>().ToList();
        var count = list.Count(a => a.Equals(1));
        return count;
    }


来源:https://stackoverflow.com/questions/14374423/use-surf-to-match-images-in-opencv-emgucv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!