Function Reference
— Function File: BW2 = bwperim(BW1)
— Function File: BW2 = bwperim(BW1, n)

Find the perimeter of objects in binary images.

A pixel is part of an object perimeter if its value is one and there is at least one zero-valued pixel in its neighborhood.

By default the neighborhood of a pixel is 4 nearest pixels, but if n is set to 8 the 8 nearest pixels will be considered.