Blobs.sort#
- Blobs.sort(by: str = 'area', reverse: bool = False) Blobs[source]#
Sort blobs
- Parameters:
by (str, optional) – parameter to sort on, defaults to “area”
reverse (bool, optional) – sort in ascending order, defaults to False
- Returns:
set of sorted blobs
- Return type:
Return a blobs object where the blobs are sorted according to the sort parameter:
Parameter
Description
"area"Blob area
"circularity"Blob circularity
"perimeter"Blob external perimeter length
"aspect"Aspect ratio of equivalent ellipse
"touch"Blob edge touch status
Example:
>>> from machinevisiontoolbox import Image >>> img = Image.Read('sharks.png') >>> blobs = img.blobs() >>> blobs.sort() Blobs(nblobs=4)
- References:
P. Corke, Robotics, Vision & Control for Python, Springer, 2023, Section 12.1.2.1.
- Seealso: