Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Calculate the sharpness of an image with the CPBD metric

Project description

About

CPBD is a perceptual-based no-reference objective image sharpness metric based on the cumulative probability of blur detection developed at the Image, Video and Usability Laboratory of Arizona State University.

[The metric] is based on the study of human blur perception for varying contrast values. The metric utilizes a probabilistic model to estimate the probability of detecting blur at each edge in the image, and then the information is pooled by computing the cumulative probability of blur detection (CPBD).

This software is a Python port of the reference MATLAB implementation. To approximate the behaviour of MATLAB’s proprietary implementation of the Sobel operator, it uses an implementation inspired by GNU Octave.

Credits

If you publish research results using this code, I kindly ask you to reference the papers of the original authors of the metric as stated in the previous section as well as their reference implementation in your bibliography. See also the copyright statement of the reference implementation in the license file. Thank you!

Installation

$ pip install cpbd

Usage

In [1]: import cpbd

In [2]: from scipy import ndimage

In [3]: input_image = ndimage.imread('/tmp/LIVE_Images_GBlur/img4.bmp', mode='L')

In [4]: cpbd.compute(input_image)
Out[4]: 0.75343203230148048

Development

$ git clone git@github.com:0x64746b/python-cpbd.git
Cloning into 'python-cpbd'...
$ cd python-cpbd
$ pip install -U '.[dev]'

To quickly run the tests with the invocation interpreter:

$ python setup.py test

To test the library under different interpreters:

$ tox

Performance

The following graph visualizes the accuracy of this port in comparison with the reference implementation when tested on the images of the LIVE database:

Performance on LIVE database

Project details


Release history Release notifications

This version
History Node

1.0.7

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
cpbd-1.0.7.tar.gz (7.1 kB) Copy SHA256 hash SHA256 Source None Feb 19, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page