Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Because I don't know how your .NET Wrapper works, I don't think that I can give you a proper Answer for .NET. Instead I show you, what would be necessary in c#.

starting from the code mentioned here on the emguCV site.

The most important variable there is the mask which is put into the findMatchesMethod here:

FindMatch(modelImage, observedImage, out matchTime, out modelKeyPoints, out observedKeyPoints, matches, out mask, out homography);

This mask holds the result of the complete matching. (to be exact, it is as big as the KeyPoints you have). Now if you want to count the matches (no Line without a Match so Lines == Match) you check each field in this array for the value 1 which represents a Match.

Here a code example:

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

Because I don't know how your .NET Wrapper works, I don't think that I can give you a proper Answer for .NET. Instead I show you, what would be necessary in c#.

starting from the code mentioned here on the emguCV site.

The most important variable there is the mask which is put into the findMatchesMethod here:

FindMatch(modelImage, observedImage, out matchTime, out modelKeyPoints, out observedKeyPoints, matches, out mask, out homography);

This mask holds the result of the complete matching. (to be exact, it is as big as the KeyPoints you have). Now if you want to count the matches (no Line without a Match so number of Lines == Match) number of Matches) you check each field in this array for the value 1 which represents a Match.

Here a code example:

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