anhngml / aforge

Automatically exported from code.google.com/p/aforge
Other
0 stars 0 forks source link

PointedColorFloodFill causing Stack Overflow #154

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1.Load the attached image (also at:  
http://www.digitalmetrology.com/Image/ProblemImage.jpg)

2. Setup and apply a PointedColorFill as follows:
bitmap = new Bitmap("C:\\Temp\\ProblemImage.jpg");
PointedColorFloodFill filter = new PointedColorFloodFill();
// configure the filter
filter.Tolerance = Color.FromArgb(25, 25, 25);
filter.FillColor = Color.FromArgb(255, 255, 255);
filter.StartingPoint = new AForge.IntPoint(bitmap.Width/2, bitmap.Height/2);
// apply the filter
filter.ApplyInPlace(bitmap);

3. Watch the exception pop up.  ;-)

What is the expected output? What do you see instead?
Exception.

What version of the product are you using?
2.1.4

Please provide any additional information below.

Original issue reported on code.google.com by mcmalb...@gmail.com on 19 Sep 2010 at 10:52

Attachments:

GoogleCodeExporter commented 9 years ago
I thought this looked like an interesting problem, but I can't reproduce it. 
Please check your image and demonstrating source. Two points I want to be extra 
sure about:
1) Did you re-save the demonstrating image before posting it?
2) Your demonstrating source doesn't compile. Where is the definition of bitmap 
(the variable, not the class) and could the code between the definition and the 
provided snippet have anything to do with the stack overflow?

Original comment by dales...@gmail.com on 23 Oct 2010 at 8:03

GoogleCodeExporter commented 9 years ago
Reproduced with the image from here:
http://www.digitalmetrology.com/Image/ProblemImage.jpg

Need to think about better flood fill algorithm to solve the issue instead of 
increasing stack.

Original comment by andrew.k...@gmail.com on 12 Nov 2010 at 4:19

GoogleCodeExporter commented 9 years ago
Changing implementation of PointedColorFloodFill to use queue instead of stack, 
so the image processing routine will not generate stack overflow any more. It 
is speed is a bit reduced as a result of this, but it may get noticeable only 
when processing thousands of images (depends on image size of course).

Committed in revision 1345. Will be released in version 2.1.5.

Original comment by andrew.k...@gmail.com on 15 Nov 2010 at 4:10

GoogleCodeExporter commented 9 years ago

Original comment by andrew.k...@gmail.com on 12 Jan 2011 at 11:42