Giter Site home page Giter Site logo

cv_algorithms's Introduction

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 <[email protected]>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.