squareness
cellseg_gsontools.geometry.squareness(polygon, **kwargs)
¶
Compute the squareness of a polygon.
Note
Squareness is a measure of how close an object is to a square.
Squareness: $$ \left(\frac{4*\sqrt{A_{poly}}}{P_{poly}}\right)^2 $$
where \(A_{poly}\) is the area of the polygon and \(P_{poly}\) is the perimeter of the polygon.
Note
For irregular shapes, squareness is close to zero and for circular shapes close to 1.3. For squares, equals 1
Parameters:
Name | Type | Description | Default |
---|---|---|---|
polygon |
Polygon
|
Input shapely polygon object. |
required |
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
The squareness value of a polygon. |