图像处理,c# [英] Image processing , c#

查看:62
本文介绍了图像处理,c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我遇到了以下代码的错误!

Hi I''ve faced an error with the following code !

private void check_Click(object sender, EventArgs e)
        {
            // locate objects using blob counter
            BlobCounter blobCounter = new BlobCounter();
            blobCounter.ProcessImage((Bitmap)PictureBox1.Image);
            Blob[] blobs = blobCounter.GetObjectsInformation();
            // create Graphics object to draw on the image and a pen
            Graphics g = Graphics.FromImage((Bitmap)TargetPic.Image);
            Pen redPen = new Pen(Color.Red, 2);
            // check each object and draw circle around objects, which
            // are recognized as circles
            for (int i = 0, n = blobs.Length; i < n; i++)
            {
                List<IntPoint> edgePoints = blobCounter.GetBlobsEdgePoints(blob[i]);

                AForge.Point center;
                float radius;

                if (shapeChecker.IsCircle(edgePoints, out center, out radius))
                {
                    g.DrawEllipse(redPen,
                        (int)(center.X - radius),
                        (int)(center.Y - radius),
                        (int)(radius * 2),
                        (int)(radius * 2));
                }
            }

            redPen.Dispose();
            g.Dispose();
        }



错误::((名称''shapeChecker''在当前上下文中不存在))任何人都可以告诉我如何修复它?


The Error :: (( The name ''shapeChecker'' does not exist in the current context )) Can any one tell me how to fix it ?

推荐答案

如果您自己编写代码,这些问题在没有任何人帮助的情况下得到解决。如果您使用某些名称,如 shapeChecker ,您知道在哪里定义它。



你做了什么几乎没用。你工具别人的代码,你真的不懂。你甚至不明白你应该定义你曾经使用的一切。难怪编译器无法编译它。 解决方案是:定义它。但如果你不自己编写代码并尝试使用复制粘贴的萨满祭祀,那么有一点用处。



如果您不知道如何定义类型的成员或变量,那么进行图像识别根本就没有意义。你需要先学习基础知识,这将是一个很长的路。



-SA
If you write code by yourself, such problems are resolved without anyone''s help. If you use some name like shapeChecker, you know where did you define it.

And what you do it nearly useless. You tool someone''s code you don''t really understand. You don''t even understand that you should define everything you ever use. No wonder the compiler cannot compile it. The solution would be: define it. But there is a little use if you don''t write code by yourself and trying some shamanic ritual with copy-paste.

If you don''t know how to define a type''s member or a variable, going in for image recognition makes no sense at all. You need to learn the very basics first, and it would be a pretty long way.

—SA

这个错误非常容易调试,您可以在整个项目的某个地方定义它但在您提供的代码范围内无效,只需尝试修改shapeChecker的定义(使用搜索工具查找所有引用它在你的项目中)。我猜你已经定义了一个名为ShapeChecker的类,它有一些方法可以检查一些指定的形状。



你还应该搜索''C#中的变量范围'到更全面地了解编程范围。
This error is very very easy to debug, you may define it somewhere in your whole project but not valid in the scope of the code you provided, just try to modify the definition of shapeChecker (use Search tool to find all references of it in your project). I guess you have defined a class called ShapeChecker which has some methods to check for some specified shapes.

You should also search for ''variable scope in C#'' to know more thoroughly about scope in programming.


这篇关于图像处理,c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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