问题
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