Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
105 lines (88 sloc) 3.36 KB

Open Computer Vision

This MLHub package provides a quick introduction to the functionalities of the Open Computer Vision toolkit.

Currently it only demonstrates the measuring of blurriness of images through the blurry command.

Visit the github repository for more details: https://github.com/gjwgit/opencv

Usage

  • To install mlhub (Ubuntu 18.04 LTS)
$ pip3 install mlhub
  • To install and configure the demo:
$ ml install gjwgit/opencv
$ ml configure opencv

Determine an Image's Blurriness

The variance of the Laplacian approach to calculating a measure of blurriness convolves the input image with the Laplacian operator and computes the variance 😄. The default threshold for blurriness is 100 so that any image with a measure less than 100 is regarded as blurry. The larger the measure the sharper the image.

For reference see https://github.com/indyka/blur-detection.

Assess the blurriness of a folder of images:

$ for f in *.{png,jpg}; do echo -n "$f "; ml blurry opencv $f; done
street_img1.png Okay 610
street_img2.png Okay 481
street_img3.jpg Blurry 64
street_img4.jpg Okay 903
street_img5.jpg Blurry 91
street_img6.jpg Blurry 71
street_img7.jpg Blurry 75
street_img8.jpg Blurry 60
street_img9.jpg Blurry 93

Some specific examples:

$ ml blurry opencv https:digital-photography-school.com/wp-content/uploads/2014/10/DSC_3913_4_5_6_7_tonemapped-Edit.jpg
Okay 5670

$ ml blurry opencv http://cdn1.thr.com/sites/default/files/2013/11/marina_bay_sands_singapore_a_l.jpg
Okay 1303

$ ml blurry opencv https://3.bp.blogspot.com/_Mjt2vy7HUaY/TKY6tQvJzFI/AAAAAAAAAGA/4qwNjH2ivzw/s1600/sharp+focus.jpg
Okay 951

$ ml blurry opencv https://images.pexels.com/photos/338515/pexels-photo-338515.jpeg
Okay 374

$ ml blurry opencv https://www.arrivalguides.com/s3/ag-images-eu/18/20870ca6f7bc086749ea747ec0c8c86d.jpg
Okay 170

$ ml blurry opencv https://cdn.photographylife.com/wp-content/uploads/2009/09/Red1-960x638.jpg
Okay 167

$ ml blurry opencv https://www.nyip.edu/images/cms/photo-articles/stop-taking-blurry-pictures.jpg
Blurry 68

$ ml blurry opencv http://getwallpapers.com/wallpaper/full/4/5/4/314199.jpg
Blurry 43

The algorithm is not perfect, or is it just the choice of the threshold. Perhaps 150 is a better threshold?

$ ml blurry opencv https://photos1.blogger.com/blogger/4886/2467/1600/23%20-%20Blurry%20Megan%20and%20Colosseum%20at%20night.jpg
Okay 119
You can’t perform that action at this time.