Search code examples
imagealgorithmnoise

Connected-Component-Labeling-Algorithm fails in some cases


I've used this alghoritm http://www.codeproject.com/Articles/336915/Connected-Component-Labeling-Algorithm to clean an image frome noise. This is the original noise enter image description here

And this is what I obtain:

enter image description here

There is still noise around the final image. Does anyone know where the algorithm fails or can recommend a more efficient algorithm? Thank you


Solution

  • The algorithm mentioned is NOT mentioned for noise cleaning. The algorithm separates different continuous areas.

    You have decided to use the algorithm for to find and separate the main blot. Why not. But it seems, you have found several close small blots, too. As it is, it seems that your prog takes 2-pixel distance as 1-pixel instance. The reasons could be:

    1. errors in code - but hardly can I imagine errors that could result in such picture. Only if you use some additional algorithm for quickening the process. Or, if you are looking for neighbours by simply looking for +1, -1 for x, y in different combinations (the bad way!), you could write 2 instead.
    2. really these small blots ARE connected to the main one by thin sequences of pixels, invisible in the scale you use to show the picture. Is it really 1:1 image?