Git Product home page Git Product logo

image-blur-detection's Introduction

Image-Blur-Detection

Classification of Blurred and Non-Blurred Images

CERTH Image Blur Dataset

E. Mavridaki, V. Mezaris, "No-Reference blur assessment in natural images using Fourier transform and spatial pyramids", Proc. IEEE International Conference on Image Processing (ICIP 2014), Paris, France, October 2014.

The dataset consists of undistorted, naturally-blurred and artificially-blurred images for image quality assessment purposes. Download the dataset from here: http://mklab.iti.gr/files/imageblur/CERTH_ImageBlurDataset.zip

Unzip and load the files into a directory named CERTH_ImageBlurDataset


Variation of the Laplacian

Using OpenCV2

This method yielded an accuracy of 87.29%

cv2.Laplacian(img, cv2.CV_64F).var()

The Laplacian Operator is applied on each of the images. The variation of the result is calculated. If the variation is below the threshold, 400 in this case, the image is classified as blurry. Otherwise, it is classified as non-blurry.

To run this model:

python OpenCV_var.py


Convolutional Neural Network

To load and pickle train data and its labels:

python load_traindata.py

To load and pickle test data and its labels:

python load_testdata.py

A Convolutional Neural Network is trained which yields an accuracy of 67.70% on the evaluation dataset. The deep learning model has five layers. This accuracy can further be improved by increasing the input dimensions of the first layer in the model and the number of epochs. However, due to constraints related to computational power, I was unable to run the model.

To train the CNN:

python CNN.py


Maximum of Laplacian

Using OpenCV2

An accuracy of 63.58% is achieved using this method.

gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

numpy.max(cv2.convertScaleAbs(cv2.Laplacian(gray,3)))

The result of the Laplacian Operator is converted to an absolute scale (0-255). The max of the values is taken for each image. The threshold is set at 215. Values lower than 215, classify the image as out-of-focus or blurry. Greater than 215 is classified as non-blurred.

To run this model:

python OpenCV_max.py

image-blur-detection's People

Contributors

priyabagaria avatar

Watchers

James Cloos avatar

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.