简体   繁体   中英

Use SURF to match images in OpenCV\EmguCV

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?

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;
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM