Giter Club home page Giter Club logo

blurdetection's Introduction

BlurDetection

Blur Detection using Fast Fourier Transforms. A Fast Fourier Transform is applied to the image using the default numpy functions, once this is done the mean value in the transformed image is taken, this is then scaled with respect to the size of the image to compensate for the rippiling effect. This value is then used to threshold the image with larger values being indicative of an in focus image while lower values of blurred images. This algorithm is also capable of generating masks of blurred images within the reason by using SLIC segmentation or the far faster img_fft thresholding and dialation operations. The second method mentioned is now default and can conduct blur detection in real time.

Quick Start

Getting the app to run is pretty easy. This script will not install OpenCV. However to install the rest of the project dependencies and run the demo script use the following commands.

# Clone the repo
git clone https://github.com/WillBrennan/BlurDetection && cd BlurDetection
# Install requirements
sudo pip install numpy scikit-image
# Run the Demonstration
python main.py <image_directory> --display --mask

Usage

Usage of this as a submodule is simple, just clone into your projects directory (or preferably add as a git submodule), and your ready to go. Below is an example code usage. Under some circumstances manual tuning of the threshold value may be required to achieve good results.

import os
import cv2
import numpy
import BlurDetection

img_path = raw_input("Please Enter Image Path: ")
assert os.path.exists(img_path), "img_path does not exists"
img = cv2.imread(img_path)
img_fft, val, blurry = BlurDetection.blur_detector(img)
print "this image {0} blurry".format(["isn't", "is"][blurry])
msk, val = BlurDetection.blur_mask(img)
BlurDetection.scripts.display('img', img)
BlurDetection.scripts.display('msk', msk)
cv2.waitKey(0)

References

Image Partial Blur Detection and Classification

Demonstration

Blur Mask Demo

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.