Skip to main content

Image Segmenter

Project description

ImageSegmenter

This Python package provides a class ImageSegmenter for annotating images with bounding boxes using various image processing techniques.

Table of Contents

Background

Image segmentation and annotation is a crucial part of any machine learning project that deals with images. The ImageSegmenter class provided in this package simplifies this process. It uses various image processing techniques like morphological operations, thresholding, and channel selection to help generate accurate bounding boxes. It also includes the ability to visualize the results, save the annotations, and apply various filters.

Installation

The ImageSegmenter package requires:

  • OpenCV
  • NumPy
  • Matplotlib
  • VOCWriter (For saving annotations)

To install these dependencies, you can use pip:

pip install opencv-python numpy matplotlib voc-writer

To use the ImageSegmenter class, simply include it in your Python script:

from image_segmenter import ImageSegmenter

Usage

Here's an example usage of the ImageSegmenter class:

from image_segmenter import ImageSegmenter

# Instantiate the ImageSegmenter
annotator = ImageSegmenter()

# Read an image
image = annotator.read_image('path_to_image')

# Convert to grayscale
image_gray = annotator.select_colorsp(image, 'gray')

# Apply thresholding
thresholded = annotator.threshold(image_gray)

# Apply morphological operations
morphed = annotator.morph_op(thresholded, 'open')

# Find contours
bboxes = annotator.get_bboxes(morphed)

# Visualize the results #
#########################

# draw bounding boxes
annotated = annotator.draw_bboxes(image, bboxes)

# show the image
annotator.display_image(image, annotated)

#########################

# Save the annotations
annotator.save_annotations('path_to_save_annotations', image, bboxes)

TODO

  • Write tests
  • add multi-label support
  • add support for other image formats
  • add support for other image processing techniques
  • add support for other annotation formats

Special Thanks

A special thanks to Kukil, the author of this guide from which these methods were generated

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

image_segmenter-0.2.1.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

image_segmenter-0.2.1-py2.py3-none-any.whl (8.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file image_segmenter-0.2.1.tar.gz.

File metadata

  • Download URL: image_segmenter-0.2.1.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for image_segmenter-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8a362c8f824f0a68d628d2400ca8c0832c58086b1edf6e69ada77edb54316471
MD5 5bfde3808ad847da7cfbb6860f96afb2
BLAKE2b-256 81b9ad1bdeac25d51ea587fab58c35f7bf9c52513ad7c54e04d6db164f94264d

See more details on using hashes here.

File details

Details for the file image_segmenter-0.2.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for image_segmenter-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c593a3f47b86f6a18e1948e50d1fb54d459a048a64b8b9166e2ad6b8689edaf3
MD5 1501e56fcbffa4b9e962ba32146d9c13
BLAKE2b-256 4182cf29cc24d7123ec00fe47111478b0cad8d3ddfb6f028d22a501278947efd

See more details on using hashes here.

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