Giter Club home page Giter Club logo

blurdetection2's Introduction

Blur Detection

Blur Detection works using the total variance of the laplacian of an image, this provides a quick and accurate method for scoring how blurry an image is.

This package only depends on numpy and opencv, to install them run,

pip install -U -r requirements.txt

The repository has a script, process.py which lets us run on single images or directories of images. The blur detection method is highly dependent on the size of the image being processed. To get consistent scores we fix the image size to HD, to disable this use --variable-size. The script has options to,

# run on a single image
python process.py -i input_image.png

# run on a directory of images
python process.py -i input_directory/ 

# or both! 
python process.py -i input_directory/ other_directory/ input_image.png

. In addition to logging whether an image is blurry or not, we can also,

# save this information to json
python process.py -i input_directory/ -s results.json

# display blur-map image
python process.py -i input_directory/ -d

The saved json file has information on how blurry an image is, the higher the value, the less blurry the image.

{
    "images": ["/Users/demo_user/Pictures/Flat/"],
    "fix_size": true,
    "results": [
        {
            "blurry": false,
            "input_path": "/Users/demo_user/Pictures/Flat/IMG_1666.JPG",
            "score": 6984.8082115095549
        },
    ],
    "threshold": 100.0
}

This is based upon the blogpost Blur Detection With Opencv by Adrian Rosebrock.

Blur Mask Demo

blurdetection2's People

Contributors

davidschlachter avatar willbrennan avatar x1001000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blurdetection2's Issues

BLUR RATE

How can we make sense of blur rate? What value range does it work in?

easier normalization for image size

Hi, great project. I think there is an easier way for you to normalize for the different image sizes.
Instead of resizing to a pre-defined image size (which would make small, in-focus images to become blurry due to the upsampling), you could simply divide the "variance of laplacian" focus measure by the image dimensions. I've tried this on a dataset of images and it worked at least as well as resizing, qualitatively.

How to get the blur region mask?

Hello, i wonder how to get the demo result as shown below using the brightness to show the blur degree:
image
It will be helpful if you can give me some instrs.

requirements.txt missing

on running make

pip install -U -r requirements.txt
Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
make: *** [Makefile:2: install_deps] Error 1

fix size argument not working

I am trying to use this script on Windows and tried to add the argument --fix-size=False or --fix-size False --fix-size=false --fix-size false but the json file would always show it being set to True. I can't read python but it looks like the argument is fix-size while the variable is fix_size on the bottom of the script, I tried to adjust that but no luck so I just removed the variable all together to get it to not use it.

Is it working on linux?

Image show two times.

As Issue#7, the image log appear two times.

import subprocess

command = [
"python", r"C:\Users\Desktop\Python_study\blur\BlurDetection2-master\process.py",
"-i", r"C:\Users\Desktop\cameradata\final\test\center_part\clear\test",
"-s", r"C:\Users\Desktop\Python_study\blur\blur_data\final.json"
]

subprocess.run(command)

Here is my code. And I can't understand how to solve it.
Thank you for reading this.

Images log twice

I'm not sure if they are scanned twice but I've noticed in the json file as well as log output in the command line that it outputs the processing and score twice for one image.

Batch process move

I was wondering if this script could have an option to move the files it detects as blurry to a separate folder, like blurry

I am trying to clean up a bunch of photos by deleting the blurry ones but I'm dealing with thousands so deleting them from the json would take a lot of time.

Question: Can photos be tagged (EXIF, etc)?

I use Apple Photos. I can not delete files from the library folder willy nilly. I would like to tag photos in some way that will be picked up by the Photos app. This way I can make a smart album of possible blurry folders to peruse and delete.

Is this possible?

Threshold doesn't accept decimal values

I was dealing with blurred return values of 0.9096742109566077 and 1.0081138874399873 for example but if I tried to use --threshold 0.8 the two would still be detected as blurry.

I'm not sure if float numbers is the correct term in python.

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.