Git Product home page Git Product logo

opencv-helpers's Introduction

OpenCV Helpers

Build Status

Summary

Installing

Usage Examples

Crop an image

_1 = convert_to_rgb(load('images/1.jpg'))
_2 = crop(_1, 200, 420, 100, 230)
plot_two_images(_1, _2, title='Croping')

screenshot

Grayscale an image

  _1 = convert_to_rgb(load('images/1.jpg'))
  _2 = grayscale(_1, is_rgb=True)
  plot_two_images(_1, _2, cmap_2='gray', title='GrayScaling')

screenshot

Threshold an image based on fixed criteria

_1 = convert_to_rgb(load('images/1.jpg'))
gray = grayscale(_1, is_rgb=True)
_2 = fixed_threshold(gray, 40)

plot_two_images(_1, _2, cmap_2='Greys', title="Fixed Threshold")

screenshot

_1 = convert_to_rgb(load('images/1.jpg'))
gray = grayscale(_1, is_rgb=True)
_2 = fixed_threshold(gray, 120, 255, cv.THRESH_BINARY)

plot_two_images(_1, _2, cmap_2='Greys', title="Fixed Threshold")

screenshot

Threshold an image based on adaptive criteria

_1 = convert_to_rgb(load('images/2.jpg'))
gray = grayscale(_1, is_rgb=True)
_2 = adaptive_threshold(gray, 200)

plot_two_images(_1, _2, cmap_2='Greys', title="Adaptive Threshold")

screenshot

_1 = convert_to_rgb(load('images/2.jpg'))
gray = grayscale(_1, is_rgb=True)
_2 = adaptive_threshold(gray, 180, 'gaussian', 35, 15, cv.THRESH_BINARY)

plot_two_images(_1, _2, cmap_2='Greys', title="Adaptive Threshold")

screenshot

Threshold an image using otsu's binarization

_1 = convert_to_rgb(load('images/2.jpg'))
gray = grayscale(_1, is_rgb=True)
_2 = otsu_threshold(gray, 200)['image']

plot_two_images(_1, _2, cmap_2='Greys', title="Otsu Threshold")

screenshot

_1 = convert_to_rgb(load('images/1.jpg'))
gray = grayscale(_1, is_rgb=True)
_2 = otsu_threshold(gray, 200)['image']

plot_two_images(_1, _2, cmap_2='Greys', title="Otsu Threshold")

screenshot

Thin and Stress Effects

_1 = convert_to_rgb(load('images/2.jpg'))
_2 = thin(_1, (10, 10))
plot_two_images(_1, _2, title="Thin (Erode) Effect")

screenshot

_1 = convert_to_rgb(load('images/2.jpg'))
_2 = stress(_1, (10, 10))
plot_two_images(_1, _2, title="Stress (Dilate) Effect")

screenshot

Smooth an Image

_1 = convert_to_rgb(load('images/1.jpg'))
_2 = smooth(_1, kernel=(6, 6), method="blur")
plot_two_images(_1, _2, title="Blur Effect")

screenshot

_1 = convert_to_rgb(load('images/2.jpg'))
_2 = smooth(_1, kernel=(51, 51), method="gaussian")
plot_two_images(_1, _2, title="Gaussian Blur Effect")

screenshot

Removing Noise and Filling Gaps

gray = grayscale(load('images/1.jpg'))
_1 = fixed_threshold(gray, 40)
_2 = remove_noise(_1)
_2 = fill(_1, kernel=(100, 100))
plot_two_images(_1, _2, cmap_1='Greys', cmap_2='Greys', title="MorphologyEx Effect")

screenshot

Add Border to Image

_1 = convert_to_rgb(load('images/1.jpg'))
_2 = frame(_1, 5, 5, 2, 2, color=[250, 0, 0])
plot_two_images(_1, _2, title="Image Framing")

screenshot

Contribute

Once you've made your great commits:

  • Fork The repository.
  • Create a branch with a clear name.
  • Make your changes (Please also add/change test, README if applicable).
  • Push changes to the created branch
  • Create an Pull Request
  • That's it!

Please respect the indentation rules and code style. And use 2 spaces, not tabs.

License

Unlicensed (public domain).

opencv-helpers's People

Contributors

abarrak avatar

Stargazers

 avatar Morgoth avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

ryanbekabe

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.