【发布时间】:2018-06-05 20:29:41
【问题描述】:
我已经实现了this 代码并在几张图片中检测到了徽标, 我能够得到一些类似 的结果,但我需要计算有多少图像包含这个标志, 可能类似于在大图像或其他东西中找到徽标的所有关键点。 我可以看到我在大图像中找到了徽标,但我想使用 emguCV 以编程方式确认它。 请帮忙。
--已编辑
这是一段带有单应性的代码,你能在这里指导我吗,因为我对 emguCV 和 openV 完全陌生,请帮我计算这些内联
public static Mat Draw(Mat modelImage, Mat observedImage, out long matchTime)
{
Mat homography;
VectorOfKeyPoint modelKeyPoints;
VectorOfKeyPoint observedKeyPoints;
using (VectorOfVectorOfDMatch matches = new VectorOfVectorOfDMatch())
{
Mat mask;
FindMatch(modelImage, observedImage, out matchTime, out modelKeyPoints, out observedKeyPoints, matches,
out mask, out homography);
//Draw the matched keypoints
Mat result = new Mat();// new Size(400,400), modelImage.Depth, modelImage.NumberOfChannels);
Features2DToolbox.DrawMatches(modelImage, modelKeyPoints, observedImage, observedKeyPoints,
matches, result, new MCvScalar(255, 255, 255), new MCvScalar(255, 255, 255), mask);
#region draw the projected region on the image
if (homography != null)
{
//draw a rectangle along the projected model
Rectangle rect = new Rectangle(Point.Empty, modelImage.Size);
PointF[] pts = new PointF[]
{
new PointF(rect.Left, rect.Bottom),
new PointF(rect.Right, rect.Bottom),
new PointF(rect.Right, rect.Top),
new PointF(rect.Left, rect.Top)
};
pts = CvInvoke.PerspectiveTransform(pts, homography);
Point[] points = Array.ConvertAll<PointF, Point>(pts, Point.Round);
using (VectorOfPoint vp = new VectorOfPoint(points))
{
CvInvoke.Polylines(result, vp, true, new MCvScalar(255, 0, 0, 255), 5);
}
}
#endregion
return result;
}
}
【问题讨论】:
-
从匹配中计算单应性并计算内点。如果许多匹配项支持单个单应性,则它们更有可能描述所需的徽标。
-
@Micka 请查看问题的编辑部分,我现在需要做什么来做这个单应性。