Goal: To implement boundary extraction using erosion.
I simply used the definition of boundary extraction and the erosion algorithm from
the last section. This was very easy to implement and worked well on the test image the
first time. I used a 3x3 square for the structuring element (with center origin). For the test
image below the algorithm finished fairly quickly (since the object is small). And it did a very
nice job for this simple image. A more challenging test might be to try extracting the boundary
of the image from the last section, but that was not done here. Also, note the boundary will
depend on the size (and shape) of the structuring element. A bigger structuring element
will make a bigger boundary.
Top) The original image with threshold 1.
Bottom) The boundary of the image.