Segmentation mask overlay
If you ever wonder to overlay your segmentations onto a picture in the smoothiest way, you're in a right place.
Installation
pip install segmentation-mask-overlay
Description
Here you can take your segmentation map, put on an image individually or in a company. If you have a bunch of them, they will blend if touch each other.
You can even name them one by one, providing labels.
That's it! As simple as is. Now you are completely ready to laminate images with your segmentation.
How to use
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
from segmentation_mask_overlay import overlay_masks
# [Example] Load image
image = Image.open("cat.jpg").convert("L")
image = np.array(image)
# [Example] Mimic list of masks
masks = []
for i in np.linspace(0, image.shape[1], 10, dtype="int"):
mask = np.zeros(image.shape, dtype="bool")
mask[i : i + 100, i : i + 200] = 1
masks.append(mask)
# [Optional] prepare labels
mask_labels = [f"Mask_{i}" for i in range(len(masks))]
# [Optional] prepare colors
cmap = plt.cm.tab20(np.arange(len(mask_labels)))[..., :-1]
# Laminate your image!
fig = array = overlay_masks(image, np.stack(masks, -1), mask_labels, return_type="mpl")
# Do with that image whatever you want to do.
fig.savefig("cat_masked.png", bbox_inches="tight", dpi=300)
CHANGELOG
- v0.4.4:
- Dropped mandatory label arg in
overlay_masks() - Added one-channel binary masks handling in
overlay_masks()
- Dropped mandatory label arg in
Metadata
Release files for segmentation-mask-overlay 0.4.4
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 |
|---|---|---|---|---|
| segmentation-mask-overlay-0.4.4.tar.gz | 279.9 kB | Without provenance | Details for segmentation-mask-overlay-0.4.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| segmentation_mask_overlay-0.4.4-py3-none-any.whl | Python 3 | none | any | Details for segmentation_mask_overlay-0.4.4-py3-none-any.whl |
Total release size: 289.3 kB
Release files / segmentation-mask-overlay-0.4.4.tar.gz
| Download URL | segmentation-mask-overlay-0.4.4.tar.gz |
|---|---|
| Size | 279.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ee821b153f829ceefcadc0fa042284afc97657963994c5acbc65c60ff89d640
|
|
BLAKE2b-256 checksum How to use checksums |
3f5d49adde17b4aaafd0a3e1b52d70e66023366c0c8aac1256222e513c824c16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.11.3 pkginfo/1.8.3 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.10.8
|
Release files / segmentation_mask_overlay-0.4.4-py3-none-any.whl
| Download URL | segmentation_mask_overlay-0.4.4-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c28112b2da01db1a00b048838182766c097e88255dcd7b2206aef24732e76526
|
|
BLAKE2b-256 checksum How to use checksums |
ec7400adf089539754bc9cc6fd1a2f5b9b20776b2dca82e7193b32c6ae1434d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.11.3 pkginfo/1.8.3 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.10.8
|
Security for segmentation-mask-overlay 0.4.4
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.