Thinning Algorithm that ensures 8 connectivity

I need a thinning algorithm in matlab that satisfies the following requirements: 1. Connected image region must thin to connected line strycture. 2. The thinned image should be minimally 8-connected. 3. Appropiate endline location should be maintained. I use bwmorph(image,'thin') function for this but it does not satisfies all above requirements. Anyone can please provide algo that satisfies all the above mentioned 3 requirements.

 Respuesta aceptada

Ashish Uthama
Ashish Uthama el 15 de Feb. de 2012
Sonam, Try the
bwmorph(image,'thin',Inf)
syntax. Without the third input argument, the thinning process is only performed once. A Inf input tells it to repeat the process till the output stops changing.
(If that doesnt work, it might also help to post a sample image)

4 comentarios

Sonam
Sonam el 17 de Feb. de 2012
I have tried this option, but not getting desired output.
Ashish Uthama
Ashish Uthama el 17 de Feb. de 2012
Sonam, its better not to accept answers if your question is not resolved.
Please update your question with a sample image that we can try and test our approaches on.
Sonam
Sonam el 19 de Feb. de 2012
How can I attach image with my question?
Image Analyst
Image Analyst el 19 de Feb. de 2012
Upload it to tinypic.com, or read this tutorial: http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers

Iniciar sesión para comentar.

Más respuestas (1)

Image Analyst
Image Analyst el 17 de Feb. de 2012

0 votos

Sonam: I think the third condition is your problem. It's impossible for any "thick" structure, and will only be satisfied for regions that are already a line and can't be thinned anymore at all. Think about it, you are basically removing layer by layer of the outer perimeter until you get a line. If you have a cigar shape, it will get shortened - how could it not? It cannot go all the way out to the tips like it used to. If you need that, then that is a special, non-standard morphological operation that you need to do with custom code. For example, you could look at the last few pixels near the line endpoint and extrapolate (say with a line or quadratic) that a long way (long enough to poke outside your original shape), then AND (&) that image with your original binary image.

Preguntada:

el 15 de Feb. de 2012

Editada:

el 16 de Oct. de 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by