Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One way of finding the ends would be to use a hit-or-miss transform with all possible structuring elements. For 8-connectivity that would be 8 of them. The code would be quite simple, but the processing time would not be optimal. Another way would be to scan the image pixel by pixel, line by line and leave only pixels that have one neighbor - zero the rest. This should be much faster.

Somewhat similar "riddle" was posted here for example:

I think that this is a very interesting to have such riddles. Provided that users will answer them. The question is if the answers should be in a form of a description or a concrete working algorithm?