在SURFFeature程序中需要帮助 [英] Needing help in the SURFFeature Program

查看:56
本文介绍了在SURFFeature程序中需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我是学习c#以及EMGU.CV的新手.我已经从emgu.com的教程中试用了SURFFeature程序.线将被绘制到匹配的特征右侧.有什么办法可以找出总共画了多少行,并在标签上显示没有画出的线"?

Hello, I am a newbie learning c# as well as EMGU.CV. I have tried out the SURFFeature program in the tutorial from emgu.com. Lines will be drawn to the matched features right. Is there any way I can find out how many lines are there all together being drawn and display the "no of lines drawn" on a label?

推荐答案

,我很抱歉对于较晚的回复,但如果您还没有想到这个
我还想给你一个答案.

在图像上绘制线条的代码部分为:

Hi my apologise for a late response but in case you haven''t figured this
out yet I thought I''d give you an answer.

The section of code that draws the lines on the image is:

#region draw lines between the matched features
foreach (SURFTracker.MatchedSURFFeature matchedFeature in matchedFeatures)
{
    PointF p = matchedFeature.ObservedFeature.Point.pt;
    p.Y += modelImage.Height;
    res.Draw(new LineSegment2DF(matchedFeature.SimilarFeatures[0].Feature.Point.pt, p), new Gray(0), 1);
}
#endregion



此"foreach"循环针对图像中匹配的所有特征重复执行,因此"matchedFeatures"的大小(该数组为数组)是要绘制的匹配项和线条的数量(请注意此变量末尾的s).我们可以将此值分配为整数.



This "foreach" loop repeats for all the features matched in the image therefore the the size of "matchedFeatures" which is an array is the number of matches and lines to be drawn (Please note the s on the end of this variable). We can assign this value to a integer.

int num_lines = matchedFeatures.Length;



现在,如果要显示标签的行数,则必须使用Windows窗体控件重新创建项目,并在图片框中显示结果图像.您可以将num_lines整数转换为字符串(num_lines.toString()).

为了节省您的时间,我使用Hello world示例作为参考,在结果右侧未使用的黑盒上绘制结果.在代码末尾,复制并粘贴以下内容:




Now if you wish to display the number of lines to a label then you will have to re-create the project with windows form controls and display the result image in a picture box. You can the convert to num_lines integer to a string (num_lines.toString()).

To save you some time I have used the Hello world example as reference to draw the result on the black box left unused to the right of the results. At the end of your code copy and paste this:


int num_lines = matchedFeatures.Length;
MCvFont f = new MCvFont(FONT.CV_FONT_HERSHEY_COMPLEX, 1.0, 1.0); //Create the font
res.Draw(num_lines.ToString(),ref f,new System.Drawing.Point(400, 100), new Gray(255)); //Draw to text on the image
ImageViewer.Show(res, String.Format("Matched in {0} milliseconds", watch.ElapsedMilliseconds)); //Show the image



注意这已经是示例代码的最后一行.



NOTE This is already the last line in the example code.

ImageViewer.Show(res, String.Format("Matched in {0} milliseconds", watch.ElapsedMilliseconds));



我在这里所做的是将结果Directley绘制到存储在变量"res"中的结果图像上.快速显示结果的一种简单作弊方法,答案应该是35.

干杯
克里斯



What I am doing here is drawing the results directley onto the resultant image stored in the variable "res". An easy cheat way to quickly display your results, your answer should be 35.

Cheers
Chris


这篇关于在SURFFeature程序中需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆