使用SURF匹配OpenCV \EmguCV中的图像 [英] Use SURF to match images in OpenCV\EmguCV
本文介绍了使用SURF匹配OpenCV \EmguCV中的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在处理此处的源代码。
似乎 indices
变量存储匹配信息,但我不知道信息是如何存储的。
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?
推荐答案
看看这一行。
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);
最重要的变量是掩码。该变量具有所有需要的信息。这是阵列。如果此数组上的值等于1,则表示我们有一个公共对。你必须计算在这个数组中出现1的次数。
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;
}
这篇关于使用SURF匹配OpenCV \EmguCV中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文