Giter Site home page Giter Site logo

imageblurdetectwithopencv's Introduction

ImageBlur Detection

To check whether an image is blurred or not in Android. Image should be selected from Gallery.

OpenCV library is used for Blur detection.

Download OpenCV by selecting a stable version of Android pack from here. Integrating OpenCV to studio-project is quite a long procedure. Please refer this awesome article.

Threshold value

If the sharpness of image is lesser than this value, then that image is marked as blurred.

Screenshots

Blurred Image Not Blurred Image

APK Size

APK size is the main concern when we want to integrate with OpenCV.

Apk size

  • Debug APK size - 86 MB
  • Debug APK size with Progaurd - 84.4 MB
  • Debug APK size with Progaurd and R8 - 80 MB
  • Debug APK size with Progaurd + R8 + NDK abiFilters(including only armv7 and x86) - 24 MB

Workaround to minimise apk size

  • Splitting apks by including only those architectures that we need to support. Also include universal apk.
 splits {
            abi {
                enable true
                reset()
                include "armeabi-v7a","x86"
                universalApk true
            }
        }
  • Creating an apk according to w.r.t architectures included. Also including universal apk.
ext.versionCodes = ['armeabi-v7a': 4, 'x86': 5]
import com.android.build.OutputFile
android.applicationVariants.all { variant ->
    variant.outputs.each { output ->
        def abiFilter = output.getFilter(OutputFile.ABI)
        def abiMultiplier = 0
        if (abiFilter != null) {
            abiMultiplier = project.ext.versionCodes.get(abiFilter)
        }
        output.versionCodeOverride = abiMultiplier * 1000 + android.defaultConfig.versionCode
    }
}

Problem with this approach is we have to upload all the apks separately for google play console, including univeral apk. Credits

Factors which decides the quality of an Image

  • Mega Pixels of Camera - Doesn’t necessarily impact image quality, more MP!=more quality.
  • Camera Sensor quality - Hardware component which decides image quality. Better sensor will result in better picture quality.
  • Pixel Size - more pixel size will give more picture quality. 16MP Samsung S5 and S6 has 1.12µm but 12MP Samsung S7 has 1.4µm.
  • Aperture - Hole/Opening in the Camera through which light travels. Larger apertures are better, To control the amount of light reaching the image sensor. 
  • Shutter Speed - Length of time with which sensor is exposed to light. More shutter speed is, the more light is available to focus.
Ex : For moving objects, slower SP results in blurred images
  • Image Size - Doesn’t necessarily impact image quality, more image size!=more quality.

How to decide threshold value?


Threshold is a critical parameter to verify the blurriness of image.

  • Too small of a value, and you’ll accidentally mark images as blurry when they are not.
  • With too large of a threshold, you’ll mark images as non-blurry when in fact they are. Credits

So finally, What value to use for threshold?

It all depends on the dataset of images. Currently we are keeping it as 500.

Useful info

According to stats, armv7 is the most commonly used android architectures.

imageblurdetectwithopencv's People

Watchers

Richa Shah 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.