1 | initial version |
Scan the object horizontally. Every time you spot continuous black pixels region (your contours are not one-pixel-wide), record coordinates of its pixels. After scanning each line check the number of regions you've found:
After that, you should be left with images that look more or less that way:
You can filter out the 'cutoffs' by segmenting image and comparing the number of pixels of two regions that you'll get. The rest (i.e. the protruding parts) you may handle with morphological opening using 'horizontal' kernel and then close the contour.
This solution should work assuming that the appendages you've shown are representative for what you may get. If the shapes are more diverse and/or may occur not only at the sides of the footprint, but also "under" or "over", the algorithm has to be modified.
2 | No.2 Revision |
Scan the object horizontally. Every time you spot continuous black pixels region (your contours are not one-pixel-wide), record coordinates of its pixels. After scanning each line check the number of regions you've found:
After that, you should be left with images that look more or less that way:
You can filter out the 'cutoffs' by segmenting image and comparing the number of pixels of two regions that you'll get. The rest (i.e. the protruding parts) you may handle with morphological opening using 'horizontal' kernel and then close the contour.
This solution should work assuming that the appendages you've shown are representative for what you may get. If the shapes are more diverse and/or may occur not only at the sides of the footprint, but also "under" or "over", the algorithm has to be modified.
3 | No.3 Revision |
Scan the object horizontally. Every time you spot continuous black pixels region (your contours are not one-pixel-wide), record coordinates of its pixels. After scanning each line check the number of regions you've found:
After that, you should be left with images that look more or less that way:
You can filter out the 'cutoffs' by segmenting image and comparing the number of pixels of two regions that you'll get. The rest (i.e. the protruding parts) you may handle with morphological opening using 'horizontal' kernel and then close the contour.
This solution should work assuming that the appendages you've shown are representative for what you may get. If the shapes are more diverse and/or may occur not only at the sides of the footprint, but also "under" or "over", the algorithm has to be modified.