Skip to main content

Generate scribble annotations from segmentation masks

Project description

Scribble From Segmentation

Generate scribble annotations from segmentation masks using advanced image processing techniques.

Overview

This tool converts segmentation masks into scribble annotations by applying morphological operations and skeletonization. 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
  • 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

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_scribbles_from_segmentations

# Generate scribbles from segmentation masks
generate_scribbles_from_segmentations(
    input_dir="/path/to/segmentation/masks",
    output_dir="/path/to/output/scribbles"
)

Requirements

  • Python >= 3.8
  • numpy
  • opencv-python
  • Pillow
  • scikit-image

License

MIT License

Author

Alex Senden

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scribble_from_segmentation-0.0.4.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scribble_from_segmentation-0.0.4-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file scribble_from_segmentation-0.0.4.tar.gz.

File metadata

File hashes

Hashes for scribble_from_segmentation-0.0.4.tar.gz
Algorithm Hash digest
SHA256 67c99d85138a318ae1437cb9af992587902c5d1574ce4f40f488e027cf21f041
MD5 4a567dfae28a84d8939b471ebffd3f08
BLAKE2b-256 3a5e069d33fdf92f0d3aacd2720648ac4ca49df836ad2c8e4552ad3b2ae78b30

See more details on using hashes here.

Provenance

The following attestation bundles were made for scribble_from_segmentation-0.0.4.tar.gz:

Publisher: pypi-publish.yml on alexsenden/scribble-from-segmentation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scribble_from_segmentation-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for scribble_from_segmentation-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 95fff9eb67a83f6b0307b11b9791547fdb46154f3e42daca1fc794478d5e9b2f
MD5 0bfab539f88cb40217b4dac5069302f2
BLAKE2b-256 4aeb1ebcf7d5a5c8d097468e1e2a4a276a815e7357fb46c215f056d78f8d139e

See more details on using hashes here.

Provenance

The following attestation bundles were made for scribble_from_segmentation-0.0.4-py3-none-any.whl:

Publisher: pypi-publish.yml on alexsenden/scribble-from-segmentation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page