Thinning contour lines in a binary image
A combination of erosion and dilation (and vice versa) on a binary image can help to get rid of salt n pepper like noise leaving small lines intact. Keywords are 'rank order filters' and 'morphological filters'.
I have a binary image with contour lines and need to purify each contour line of all unnecessary pixels, leaving behind a minimally connected line.
Can somebody give me a source, code example or further information for this kind of problem and where to search for help, please?