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
Built Distribution
Hashes for image_segmenter-0.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 988b9eefb63c605b840be022584650a909dc85877ef768f870240272710402c2 |
|
MD5 | b34b3fa679e6e050885b599040e9ab84 |
|
BLAKE2b-256 | af6dd0b984d578f1279a6c05b2ec8a71f12c6dedd20ae7a6c366b96eda6c0b59 |