mohamadDev / aforge

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

Erosion and Dilation should be reversed #75

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The Erosion should remove data and the Dilation command should add data. 
Currently this is not the case.

Original issue reported on code.google.com by MichaelL...@gmail.com on 29 Oct 2008 at 12:48

GoogleCodeExporter commented 9 years ago
Currently it is the case - Erosion and Dilatation work as you've mentioned.

If it does not work for some reasons for you, you need to describe your case. 
It may 
happen that you just made something wrong.

Original comment by andrew.k...@gmail.com on 29 Oct 2008 at 6:40

GoogleCodeExporter commented 9 years ago
I'm not certain if you are stating there is an update. The way Erosion and 
Dilation 
work, are opposite of what they should be doing. Basically the ProcessFilter 
method 
should be swapped between the two classes.

Original comment by MichaelL...@gmail.com on 29 Oct 2008 at 6:31

GoogleCodeExporter commented 9 years ago
I am closing the issue, because it is really getting confusing.

Try IPLab application. Erosion removes pixels in binary image, Dilatation adds 
pixels. It works as it should work.

Original comment by andrew.k...@gmail.com on 29 Oct 2008 at 6:36

GoogleCodeExporter commented 9 years ago
I have the same problem.
Generated files attached.

image.Save(@"i:\SourceImage.bmp");
Int16[,] matrix = new Int16[3, 3] { 
    { 0, 1, 0 },
    { 1, 1, 1 },
    { 0, 1, 0 } };
new Dilatation(matrix).Apply(image).Save(@"i:\Dilatation.bmp");
new Erosion(matrix).Apply(image).Save(@"i:\Erosion.bmp");

Original comment by ner...@gmail.com on 6 Jan 2011 at 10:28

Attachments:

GoogleCodeExporter commented 9 years ago
As I can see from attached images everything works as it is supposed to be.

If something is not clear, I would read documentation first. Here it is:
http://www.aforgenet.com/framework/docs/html/88f713d4-a469-30d2-dc57-5ceb3321072
3.htm
http://www.aforgenet.com/framework/docs/html/90a69d73-0e5a-3e27-cc52-5864f542b53
e.htm

Also some theory may help:
http://homepages.inf.ed.ac.uk/rbf/HIPR2/erode.htm
"Most implementations of this operator will expect the input image to be 
binary, usually with foreground pixels at intensity value 255, and background 
pixels at intensity value 0."

Check your image and find that you have different case.

Original comment by andrew.k...@gmail.com on 6 Jan 2011 at 10:37

GoogleCodeExporter commented 9 years ago
http://www.aforgenet.com/framework/docs/html/90a69d73-0e5a-3e27-cc52-5864f542b53
e.htm
says:
"The filter accepts 8 and 16 bpp grayscale images and 24 and 48 bpp color 
images for processing."

I pass a 24bpp image in RGB, where FFFFFF is white, and background.
So the filter do not work with standard RGB "palette" ?

Original comment by ner...@gmail.com on 6 Jan 2011 at 2:15

GoogleCodeExporter commented 9 years ago
It works fine with 24 bpp images. As I said, images you've attached look 
correct after processing.

Original comment by andrew.k...@gmail.com on 6 Jan 2011 at 2:17

GoogleCodeExporter commented 9 years ago
I do not understand you:
I want a erosion on the foreground, which is black, which is 000000.
If you compare "SourceImage.bmp" and "Erosion.bmp", it's obvious that it's the 
background, which is white, which is FFFFFF which is beeing erode.
How can you explain this ?

Original comment by ner...@gmail.com on 6 Jan 2011 at 3:27

GoogleCodeExporter commented 9 years ago
You don't read what I write. Here it is again:
"Most implementations of this operator will expect the input image to be 
binary, usually with foreground pixels at intensity value 255, and background 
pixels at intensity value 0."

These image processing routines don't care what you believe is background. 
These routines tread black as background and white as foreground. That is it. 
So Erosion removes white (or grows black), and Dilatation grows white (removes 
black).

Please, read documentation and description of the algorithms before posting 
issues.

Original comment by andrew.k...@gmail.com on 6 Jan 2011 at 3:34

GoogleCodeExporter commented 9 years ago
Ok I understand you now.
This sentence helps me a lot:
"These image processing routines don't care what you believe is background."
Thanks for your time!

Original comment by ner...@gmail.com on 6 Jan 2011 at 3:51

GoogleCodeExporter commented 9 years ago
I agree with Andrew. When I originally submitted the ticket, I thought the 
background was white and foreground black. The Aforge library implements the 
logic in the same way that other libraries do.

Original comment by MichaelL...@gmail.com on 6 Jan 2011 at 5:22