Hi I've faced an error with the following code !
private void check_Click(object sender, EventArgs e)
BlobCounter blobCounter = new BlobCounter();
Blob blobs = blobCounter.GetObjectsInformation();
Graphics g = Graphics.FromImage((Bitmap)TargetPic.Image);
Pen redPen = new Pen(Color.Red, 2);
for (int i = 0, n = blobs.Length; i < n; i++)
List<IntPoint> edgePoints = blobCounter.GetBlobsEdgePoints(blob[i]);
if (shapeChecker.IsCircle(edgePoints, out center, out radius))
(int)(center.X - radius),
(int)(center.Y - radius),
(int)(radius * 2),
(int)(radius * 2));
The Error :: (( The name 'shapeChecker' does not exist in the current context )) Can any one tell me how to fix it ?
If you write code by yourself, such problems are resolved without anyone's help. If you use some name like —SA
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.
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.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)