skimage2.measure.perimeter#

skimage2.measure.perimeter(image, neighborhood=4)[source]#

Calculate total perimeter of all objects in binary image.

Parameters:
imagendarray of shape (M, N)

Binary input image.

neighborhood4 or 8, optional

Neighborhood connectivity for border pixel determination. It is used to compute the contour. A higher neighborhood widens the border on which the perimeter is computed.

Returns:
perimeterfloat

Total perimeter of all objects in binary image.

References

[1]

K. Benkrid, D. Crookes. Design and FPGA Implementation of a Perimeter Estimator. The Queen’s University of Belfast. http://www.cs.qub.ac.uk/~d.crookes/webpubs/papers/perimeter.doc

Examples

>>> import _skimage2 as ski2
>>> # coins image (binary)
>>> img_coins = ski2.data.coins() > 110
>>> # total perimeter of all objects in the image
>>> ski2.measure.perimeter(img_coins, neighborhood=4)
7796.867...
>>> ski2.measure.perimeter(img_coins, neighborhood=8)
8806.268...