I want to find areas in a binary image that correspond to long and thin curves. In the example below, structures thinner than 3 pixels but longer than 20 pixels are highlighted. Observe that the bottom-most line is split because it locally comes in contact with the Data Matrix code. The structures need not be straight, they can have a curvature.
I am quite familiar with the standard morphology operators, but they are usually isotropic and won't solve this. Is there any classical solution ? How would you solve that problem ?
Update:
I am thinking of this method:
perform thinning (erasing layers of pixels one after the other but avoiding that the connexity be altered; at least as many layers as the maximum thickness); what remains is a skeleton;
find the portions of the skeleton that are exactly one pixel wide; in other terms, only the pixels that have at most two neighbors. Keep the portions that have a sufficient length;
finally select all pixels that are closer than the maximum thickness to a long portion.
The step 2 the key to selecting thin curves and avoiding junctions. The step 3 is the most difficult.
I am still hoping that a simpler, more integrated solution is possible.

