Ask Your Question

Revision history [back]

click to hide/show revision 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:

Possible cases

  1. If there is only 2 regions (marked blue in the image), you have no appendages.
  2. If you have 4 regions (marked red in the image), you've found and appendage. Remove the rightmost or leftmost pair (marked a,b and c,d) based on distance between them - appendages you've shown are thinner than the actual footprint.
  3. If you have 3 regions, it means you have a case marked green, i.e. we are moving along the line that happens to be almost horizontal and connects the appendage with the footprint. In that case, remove the rightmost or leftmost region pixels based on the smallest distance between the regions.

After that, you should be left with images that look more or less that way:

image description

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.

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:

Possible cases

  1. If there is only 2 regions (marked blue in the image), you have no appendages.
  2. If you have 4 regions (marked red in the image), you've found and appendage. Remove the rightmost or leftmost pair (marked a,b and c,d) based on distance between them - appendages you've shown are thinner than the actual footprint.
  3. If you have 3 regions, it means you have a case marked green, i.e. we are moving along the line that happens to be almost horizontal and connects the appendage with the footprint. In that case, remove the rightmost or leftmost region pixels based on the smallest distance between the regions.

After that, you should be left with images that look more or less that way:

image description

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.

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:

Possible cases

  1. If there is only 2 regions (marked blue in the image), you have no appendages.
  2. If you have 4 regions (marked red in the image), you've found and appendage. Remove the rightmost or leftmost pair (marked a,b and c,d) based on distance between them - appendages you've shown are thinner than the actual footprint.
  3. If you have 3 regions, it means you have a case marked green, i.e. we are moving along the line that happens to be almost horizontal and connects the appendage with the footprint. In that case, remove the rightmost or leftmost region pixels based on the smallest distance between the regions.

After that, you should be left with images that look more or less that way:

image description

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.