Essentials of Mechatronics  ISBN: 0-471-72341-X- ©John Billingsley 2006 - published John Wiley & Sons, Inc

12/3/4.htm  Binary edge finder

This starts off in the same way, setting up a ragged diamond and smoothing it.
Next it processes the image with a 3x3 filter in order to find the edge of the image.

The 'add up all nine' smoothing filter can be though of as a 3x3 filter
where the coefficients are all 1.

The coefficients of the edge-finder in this first example are

      0 -1  0
     -1  4 -1
      0 -1  0

where these numbers are used to multiply each point and its neighbours, setting the new value according to the sum.
You can try it out on the 'back of an envelope' to see that it will put the boundary outside the original shape.

Run edgebin1.bas or edgebin1.htm.