Skip to main content

author: Rich Baird

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.1.1.tar.gz (8.5 kB view hashes)

Uploaded Source

Built Distribution

image_segmenter-0.1.1-py2.py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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