scikit-shape Image Regularization

Some procedures require a cleaned or enhanced image. Image Regularization is used to reduce the noise or the variation in the image while maintaining or enhancing important features and structures. In this example, the weighted_smoothing function smoothes/denoises a given image by applying spatially-varying diffusion to image intensity values. The diffusion or smoothing is small on edges, locations with high gradient of image intensity, and high in the remaining areas of the image.

Download the Python code for Image Regularization.


import matplotlib.pyplot as plt
from skshape.image.enhancement import weighted_smoothing

image = plt.imread('bacteria.png') / 255.0

smoothed_image = weighted_smoothing( image )

plt.figure()
plt.subplot(1,2,1); plt.axis('off'); plt.gray()
plt.title('Original image'); plt.imshow(image)
plt.subplot(1,2,2); plt.axis('off'); plt.gray()
plt.title('Smoothed image'); plt.imshow(smoothed_image)

plt.show()
examples/image_smoothing_out.png