Function File: bwperim (bw)
Function File: bwperim (bw, conn)

Find perimeter of objects in binary images.

Values from the matrix bw are considered part of an object perimeter if their value is non-zero and is connected to at least one zero-valued element, or to the outside of bw.

Element connectivity conn, to define the size of objects, can be specified with a numeric scalar (number of elements in the neighborhood):

4 or 8

for 2 dimensional matrices;

6, 18 or 26

for 3 dimensional matrices;

or with a binary matrix representing a connectivity array. Defaults to conndef (ndims (bw), "minimal") which is equivalent to conn of 4 and 6 for 2 and 3 dimensional matrices respectively.

See also: bwarea, bwboundaries, imerode, mmgrad.

Package: image