Skip to main content

cv_algorithms

image A Python package (Python3 ready!) that contains implementations of various OpenCV algorithms are are not available in OpenCV or OpenCV-contrib. This package is intended to be used with OpenCV 3.

Some performance-critical algorithms are written in optimized C code. The C code is accessed using cffi Currently implemented:

  • Morphological algorithms
  • Algorithms on contours
    • Masking extraction of convex polygon area from image without rotation
    • Scale around reference point or center
    • Fast computation of center by coordinate averaging
    • Center-invariant rescaling of upright bounding rectangle by x/ factors
    • Filter by min/max area
    • Sort by area
    • Create binary contour mask
    • Grassfire transform
  • Colorspace metrics & utilities:
    • Convert image to any colorspace supported by OpenCV
    • Extract any channel from any colorspace directly
    • Euclidean RGB distance
  • Other structural algorithms
    • Which neighboring pixels are set in a binary image?
  • Algorithms on text rendering
    • Center text at coordinates
    • Auto-scale text to fix into box
  • Other algorithms
    • Remove n percent of image borders
    • Popcount (number of one bits) for 8, 16, 32 and 64 bit numpy arrays
    • Resize an image, maintaining the aspect ratio

As OpenCV's Python bindings (cv2) represents images as numpy arrays, most algorithms generically work with numpy1 arrays.

Installation

Install the stable version:

pip install cv_algorithms

How to install the bleeding-edge version from GitHub

pip install git+https://github.com/ulikoehler/cv_algorithms.git

How to build yourself - we use Poetry:

poetry build

Potentially, you need to install OpenCV if not already present. I recommend first trying to install without that, since modern Python versions will take care of that automatically.

Usage

Difference of Gaussian transform documentation & example Grassfire transform documentation & example Thinning documentation & example

Here's a simple usage showcase:

import cv_algorithms
# img must be a binary, single-channel (grayscale) image.
thinned = cv_algorithms.guo_hall(img)

Contributions

Contributions of any shape or form are welcome. Please submit a pull request or file an issue on GitHub.

Copyright (c) 2016-2022 Uli Köhler <cv_algorithms@techoverflow.net>

Metadata

Release files for cv-algorithms 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cv-algorithms 1.1.1
File Size Uploaded
cv_algorithms-1.1.1.tar.gz 22.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cv-algorithms 1.1.1
File Interpreter ABI Platform
cv_algorithms-1.1.1-cp310-cp310-manylinux_2_35_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.35+ x86-64 Details

Total release size: 63.1 kB

Release files / cv_algorithms-1.1.1.tar.gz

Download URL cv_algorithms-1.1.1.tar.gz
Size 22.2 kB
Tags Source
SHA-256 checksum
How to use checksums
627653e8235414f4e0747ee682b001710002ea408c81c65d78ee368763586077
BLAKE2b-256 checksum
How to use checksums
a760be78c55a39b7bbc22ef347a3ca05f0664adbc1339fcd714170d9098b317a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.12 Linux/5.15.0-91-generic

Release files / cv_algorithms-1.1.1-cp310-cp310-manylinux_2_35_x86_64.whl

Download URL cv_algorithms-1.1.1-cp310-cp310-manylinux_2_35_x86_64.whl
Size 40.9 kB
Tags CPython 3.10 Linux glibc 2.35+ x86-64
SHA-256 checksum
How to use checksums
7937a313c48346903314c75bd3f8884310b3d3406c2b35cdca1e2778633d7d8e
BLAKE2b-256 checksum
How to use checksums
b2c62d78a2b5a3435b07f546a4b0e1cecf906c56e9a4f8a35082fa1fa80c88ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.12 Linux/5.15.0-91-generic

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.4

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page