Note
Go to the end to download the full example code or to run this example in your browser via Binder
Estimate strength of blur#
This example shows how the metric implemented in measure.blur_effect
behaves, both as a function of the strength of blur and of the size of the
re-blurring filter. This no-reference perceptual blur metric is described in
[1].
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.ndimage as ndi
import plotly
import plotly.express as px
from skimage import (
color, data, measure
)
Generate series of increasingly blurred images#
Let us load an image available through scikit-image’s data registry. The blur metric applies to single-channel images.
image = data.astronaut()
image = color.rgb2gray(image)
Let us blur this image with a series of uniform filters of increasing size.
blurred_images = [ndi.uniform_filter(image, size=k) for k in range(2, 32, 2)]
img_stack = np.stack(blurred_images)
fig = px.imshow(
img_stack,
animation_frame=0,
binary_string=True,
labels={'animation_frame': 'blur strength ~'}
)
plotly.io.show(fig)