dsdl.geometry.polygon
Polygon
Bases: BaseGeometry
Source code in /Users/bin/anaconda3/envs/dsdl/lib/python3.10/site-packages/dsdl/geometry/polygon.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
|
openmmlabformat: List[List[float]]
property
Returns:
Type | Description |
---|---|
List[List[float]]
|
All the points of all the polygon item. The format is |
polygons
property
Returns:
Type | Description |
---|---|
A list of all the PolygonItem objects in the current polygon object. |
__init__(value)
A Geometry class which abstracts a polygon object (which meas there may be multi closed shapes).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
A list of a number of PolygonItem objects. |
required |
Source code in /Users/bin/anaconda3/envs/dsdl/lib/python3.10/site-packages/dsdl/geometry/polygon.py
point_for_draw(mode='lt')
Get the point's coordinate where a legend is fit to draw.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mode |
str
|
The position model. Only "lb", "lt", "rb", "rt" are permitted, which mean get the coordinate of left bottom, left top, right bottom and right top corresponding. |
'lt'
|
Returns:
Type | Description |
---|---|
[int, int]
|
The coordinate correspond to the |
Source code in /Users/bin/anaconda3/envs/dsdl/lib/python3.10/site-packages/dsdl/geometry/polygon.py
visualize(image, palette, **kwargs)
Draw the current polygon object on an given image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image |
The image where the polygon to be drawn. |
required | |
palette |
The palette which stores the color of different category name. |
required | |
**kwargs |
Other annotations which may be used when drawing the current polygon object, such as |
{}
|
Returns:
Type | Description |
---|---|
The image where the current polygon object has been drawn on. |
Source code in /Users/bin/anaconda3/envs/dsdl/lib/python3.10/site-packages/dsdl/geometry/polygon.py
PolygonItem
Bases: BaseGeometry
Source code in /Users/bin/anaconda3/envs/dsdl/lib/python3.10/site-packages/dsdl/geometry/polygon.py
openmmlabformat: List[float]
property
Returns:
Type | Description |
---|---|
List[float]
|
All the points of the format [x1, y1, x2, y2, ...]. |
points: List[List[float]]
property
Returns:
Type | Description |
---|---|
List[List[float]]
|
The coordinates of the current polygon item. The format is |
points_x: List[float]
property
Returns:
Type | Description |
---|---|
List[float]
|
The horizontal axis of all the points which the current polygon item consists of. The format is [x1, x2, x3, ...]. |
points_y: List[float]
property
Returns:
Type | Description |
---|---|
List[float]
|
The vertical axis of all the points which the current polygon item consists of. The format is [y1, y2, y3, ...]. |
__init__(points)
A Geometry class which abstracts a single polygon item object (which means there is only one closed shape).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
points |
List[List[float]]
|
The coordinates of a polygon object, whose format is |
required |
Attributes:
Name | Type | Description |
---|---|---|
_data(list[list[float]]) |
The coordinates of a polygon object, whose format is |
Source code in /Users/bin/anaconda3/envs/dsdl/lib/python3.10/site-packages/dsdl/geometry/polygon.py
point_for_draw(mode='lt')
Get the point's coordinate where a legend is fit to draw.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mode |
str
|
The position model. Only "lb", "lt", "rb", "rt" are permitted, which mean get the coordinate of left bottom, left top, right bottom and right top corresponding. |
'lt'
|
Returns:
Type | Description |
---|---|
The coordinate corresponding to the |
Source code in /Users/bin/anaconda3/envs/dsdl/lib/python3.10/site-packages/dsdl/geometry/polygon.py
to_tuple()
Returns:
Type | Description |
---|---|
The coordinates of the current polygon item. The format is |
RLEPolygon
Bases: BaseGeometry
Source code in /Users/bin/anaconda3/envs/dsdl/lib/python3.10/site-packages/dsdl/geometry/polygon.py
mask
property
ref: https://www.kaggle.com/paulorzp/run-length-encode-and-decode
mask_rle: run-length as string formated (start length) shape: (height,width) of array to return Returns numpy array, 1 - mask, 0 - background
__init__(rle_data, image_shape)
rle_data: rle list image_shape: [H, W]