cmask2polygons
Convert Color label mask to Polygons per class
Install
$ pip install cmask2polygons
How to Use
from cmask2polygons import get_polygons_per_class
color_mask_path = '. . .'
color_mask = cv2.cvtColor(cv2.imread(color_mask_path), cv2.COLOR_BGR2RGB)
# Key:str, Val:tuple
cls_color_map = {
"class_name_1": (125, 125, 125), # RGB Color
"class_name_2": (70, 20, 225),
. . .
}
# Get Polygons from Color Label Mask
polygons_per_class = get_polygons_per_class(
color_mask=color_mask,
cls_color_map=cls_color_map,
min_area=100.0,
epsilon_param=8e-4,
pt_type=int,
add_closept=False,
)
Arguments
color_mask: RGB Image (numpy.ndarray)cls_color_map: Color Value per Class (dict)min_area: Minimum area of object (float). Default is 100.0epsilon_param: Value for polygon approximating (float). Default is 8e-4pt_type: Data type of points. Default isintadd_closept: Append end point (== start point) for representing closed. Default isFalse
Return
- Data type:
dict- Key: Class name (
str) - Value: list of polygon x (
pt_type), y (pt_type) coordinates
- Key: Class name (
Metadata
Release files for cmask2polygons 1.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cmask2polygons-1.1.3.tar.gz | 3.3 kB | Without provenance | Details for cmask2polygons-1.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cmask2polygons-1.1.3-py3-none-any.whl | Python 3 | none | any | Details for cmask2polygons-1.1.3-py3-none-any.whl |
Total release size: 7.0 kB
Release files / cmask2polygons-1.1.3.tar.gz
| Download URL | cmask2polygons-1.1.3.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1384acbaa3804599b0233a771073ea0e3003634046b4a10c4428cefa3af314fb
|
|
BLAKE2b-256 checksum How to use checksums |
a7ae5124ea6a96077cfb2ea75b540d2a30db9d2a6c903e79e9387fb2fe10143a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.5
|
Release files / cmask2polygons-1.1.3-py3-none-any.whl
| Download URL | cmask2polygons-1.1.3-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aad2b888c28c2c1d0bfd5eda1b5f604d502387ebf5131f5cd55f3b93244f1304
|
|
BLAKE2b-256 checksum How to use checksums |
5e5fdb5c22b2e41a989fbe2fb31b5d99e5e0d3b63ecd56172def8e08dea12106
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.5
|
Security for cmask2polygons 1.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.