Blobs.perimeter#

property Blobs.perimeter: Any#

Perimeter of the blob

Returns:

Perimeter, one point per column

Return type:

ndarray(2,N)

Return the coordinates of the pixels that form the blob’s external perimeter. This is an 8-way connected chain of edge pixels.

Example:

>>> from machinevisiontoolbox import Image
>>> im = Image.Read('shark2.png')
>>> blobs = im.blobs()
>>> blobs[0].perimeter.shape
(2, 471)
>>> np.set_printoptions(threshold=10)
>>> blobs[0].perimeter
array([[367, 366, 365, ..., 370, 369, 368],
       [300, 301, 301, ..., 300, 300, 300]], shape=(2, 471), dtype=int32)
>>> blobs.perimeter
[array([[367, 366, 365, ..., 370, 369, 368],
       [300, 301, 301, ..., 300, 300, 300]], shape=(2, 471), dtype=int32), array([[167, 166, 165, ..., 170, 169, 168],
       [100, 101, 101, ..., 100, 100, 100]], shape=(2, 471), dtype=int32)]

(Source code, png, hires.png, pdf)

../../_images/machinevisiontoolbox-Blobs-perimeter-1.png

Note

The perimeter is not closed, that is, the first and last point are not the same.

Seealso:

perimeter_approx perimeter_hull plot_perimeter polar