Scribble From Segmentation
Generate scribble annotations or filled bounding boxes from segmentation masks using image processing techniques.
Overview
This tool converts segmentation masks into scribble annotations by applying morphological operations. It's useful for creating weak supervision labels or simplifying segmentation annotations for training purposes.
The tool:
- Processes segmentation masks and extracts individual classes
- Automatically detects and skips background classes
- Applies morphological operations to refine class boundaries
- Skeletonizes regions to create scribble-like annotations
- Can generate filled bounding boxes for each object
- Preserves the original color information for each class
Installation
Install from PyPI:
pip install scribble-from-segmentation
Or install from source:
pip install -e .
Usage
Use the command-line interface to process segmentation masks:
scribble-from-segmentation --input_dir /path/to/segmentation/masks --output_dir /path/to/output/scribbles
Arguments
--input_dir(required): Path to directory containing segmentation mask images--output_dir(required): Path to directory where scribble annotations will be saved--mode(optional): Annotation mode,scribbles(default) orbounding_boxes
Supported Image Formats
- PNG
- JPG/JPEG
- GIF
- BMP
- TIF
Python API
You can also use the tool directly in your Python code:
from scribble_from_segmentation import generate_annotations_from_segmentations
# Generate scribbles from segmentation masks
generate_annotations_from_segmentations(
input_dir="/path/to/segmentation/masks",
output_dir="/path/to/output/scribbles"
)
# Generate bounding boxes from segmentation masks
generate_annotations_from_segmentations(
input_dir="/path/to/segmentation/masks",
output_dir="/path/to/output/bboxes",
mode="bounding_boxes"
)
Requirements
- Python >= 3.8
- numpy
- opencv-python
- Pillow
- scikit-image
License
MIT License
Author
Alex Senden
Metadata
Release files for scribble-from-segmentation 0.2.1
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 |
|---|---|---|---|---|
| scribble_from_segmentation-0.2.1.tar.gz | 5.0 kB | With provenance | Details for scribble_from_segmentation-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scribble_from_segmentation-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for scribble_from_segmentation-0.2.1-py3-none-any.whl |
Total release size: 11.2 kB
Release files / scribble_from_segmentation-0.2.1.tar.gz
| Download URL | scribble_from_segmentation-0.2.1.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f787301147014c25ba5fad8d366ce1b542ea79cbc514740441f68fb913a461c1
|
|
BLAKE2b-256 checksum How to use checksums |
3064351bbc616dd97afb8639c58fc7821d27e7f817e4b6aec7614c500fad0fca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 24, 2026.
Transparency logRelease files / scribble_from_segmentation-0.2.1-py3-none-any.whl
| Download URL | scribble_from_segmentation-0.2.1-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a89dd2419bc957ec4840f0bc9a85f50ac3127938bc9dce9ddff97d6143b9d568
|
|
BLAKE2b-256 checksum How to use checksums |
458c4e5ff2cab0a818dc0f0d5258cb7fa1c0382fe3065968a71b4b469e49f24e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 24, 2026.
Transparency logSecurity for scribble-from-segmentation 0.2.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for scribble_from_segmentation-0.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 24, 2026.
Transparency logA 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.