pyautocv

(Semi) Automated Image Processing

This project is maintained by Nelson-Gon

(Semi) Automated Image Processing

Stage DOI Test-Package Travis Build PyPI version fury.io PyPI license PyPI download Month PyPI download week PyPI download day Maintenance GitHub last commit made-with-python GitHub issues GitHub issues-closed license

Project Aims

The goal of pyautocv is to provide a simple computer vision(cv) workflow that enables one to automate or at least reduce the time spent in image (pre)-processing.

Installing the package

From pypi:


pip install pyautocv

From GitHub

pip install pip install git+https://github.com/Nelson-Gon/pyautocv.git
#or
# clone the repo
git clone https://www.github.com/Nelson-Gon/pyautocv.git
cd pyautocv
python3 setup.py install

Available Class

Example Usage

To smooth a directory of images, we can use EdgeDetection’s smooth method as follows:

from pyautocv.segmentation import *
edge_detection = Segmentation("images/cats")
show_images(edge_detection.gray_images(), edge_detection.smooth())

This will give us:

Smoothened

To detect edges in a directory of images, we can use Segmentation’s detect_edges.


edge_detection = Segmentation("images/cats")
show_images(edge_detection.read_images(), edge_detection.detect_edges(operator="roberts", mask="gaussian", sigma=0))

The above will give us the following result:

Sample_colored

To use a different filter e.g Laplace,


show_images(edge_detection.read_images(), edge_detection.detect_edges(operator="laplace", mask="gaussian", sigma=0))

This results in:

Laplace

To perform thresholding, we can use the method threshold_images.

We use flowers as an example:

to_threshold = Segmentation("images/biology")
show_images(to_threshold.read_images(),to_threshold.threshold_images())

Flowers

To use a different thresholding method:


show_images(to_threshold.read_images(),to_threshold.threshold_images(threshold_method="otsu"))

The above gives us:

otsu

For cat lovers, here’s thresholding with inverse binary:

show_images(to_threshold.read_images(),to_threshold.threshold_images(threshold_method="binary_inverse"))

Result:

Cats

These and more examples are available in example2.py. Image sources are shown in sources.md. If you feel, attribution was not made, please file an issue and cite the violating image.

Thank you very much

“A language that doesn’t affect the way you think about programming is not worth knowing.” ― Alan J. Perlis


References: