.. _sphx_glr_auto_examples_filters: Filtering and restoration ------------------------- .. raw:: html <div class="sphx-glr-thumbnails"> .. thumbnail-parent-div-open .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to remove small objects from grayscale images. The top-hat transform [1]_ is an operation that extracts small elements and details from given images. Here we use a white top-hat transform, which is defined as the difference between the input image and its (mathematical morphology) opening."> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_tophat_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_tophat.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Removing small objects in grayscale images with a top hat filter</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="Hysteresis is the lagging of an effect---a kind of inertia. In the context of thresholding, it means that areas above some low threshold are considered to be above the threshold if they are also connected to areas above a higher, more stringent, threshold. They can thus be seen as continuations of these high-confidence areas."> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_hysteresis_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_hysteresis.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Hysteresis thresholding</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="In this example, we deconvolve a noisy version of an image using Wiener and unsupervised Wiener algorithms. These algorithms are based on linear models that can't restore sharp edge as much as non-linear methods (like TV restoration) but are much faster."> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_restoration_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_restoration.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Image Deconvolution</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="Fast Fourier transforms (FFTs) assume that the data being transformed represent one period of a periodic signal. Thus the endpoints of the signal to be transformed can behave as discontinuities in the context of the FFT. These discontinuities distort the output of the FFT, resulting in energy from "real" frequency components leaking into wider frequencies."> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_window_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_window.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Using window functions with images</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="This example compares the following mean filters of the rank filter package:"> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_rank_mean_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_rank_mean.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Mean filters</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="Unsharp masking is a linear image processing technique which sharpens the image. The sharp details are identified as a difference between the original image and its blurred version. These details are then scaled, and added back to the original image:"> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_unsharp_mask_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_unsharp_mask.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Unsharp masking</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="The algorithm is based on a PSF (Point Spread Function), where PSF is described as the impulse response of the optical system. The blurred image is sharpened through a number of iterations, which needs to be hand-tuned."> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_deconvolution_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_deconvolution.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Image Deconvolution</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="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]_."> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_blur_effect_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_blur_effect.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Estimate strength of blur</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="In information theory, information entropy is the log-base-2 of the number of possible outcomes for a message."> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_entropy_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_entropy.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Entropy</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="In this example, we show how to find an optimally calibrated version of any denoising algorithm."> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_j_invariant_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_j_invariant.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Calibrating Denoisers Using J-Invariance</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="Inpainting [1]_ is the process of reconstructing lost or deteriorated parts of images and videos."> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_inpaint_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_inpaint.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Fill in defects with inpainting</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="Band-pass filters attenuate signal frequencies outside of a range (band) of interest. In image analysis, they can be used to denoise images while at the same time reducing low-frequency artifacts such a uneven illumination. Band-pass filters can be used to find image features such as blobs and edges."> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_dog_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_dog.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Band-pass filtering by Difference of Gaussians</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="In this example, we denoise a noisy version of a picture using the total variation, bilateral, and wavelet denoising filters."> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_denoise_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_denoise.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Denoising a picture</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="The discrete wavelet transform is not `shift-invariant`_. Shift invariance can be achieved through an undecimated wavelet transform (also called stationary wavelet transform), at cost of increased redundancy (i.e. more wavelet coefficients than input image pixels). An alternative way to approximate shift-invariance in the context of image denoising with the discrete wavelet transform is to use the technique known as "cycle spinning". This involves averaging the results of the following 3-step procedure for multiple spatial shifts, n:"> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_cycle_spinning_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_cycle_spinning.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Shift-invariant wavelet denoising</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="Some signals can only be observed modulo 2*pi, and this can also apply to two- and three dimensional images. In these cases phase unwrapping is needed to recover the underlying, unwrapped signal. In this example we will demonstrate an algorithm [1]_ implemented in skimage at work for such a problem. One-, two- and three dimensional images can all be unwrapped using skimage. Here we will demonstrate phase unwrapping in the two dimensional case."> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_phase_unwrap_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_phase_unwrap.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Phase Unwrapping</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="In this example, we denoise a detail of the astronaut image using the non-local means filter. The non-local means algorithm replaces the value of a pixel by an average of a selection of other pixels values: small patches centered on the other pixels are compared to the patch centered on the pixel of interest, and the average is performed only for pixels that have patches close to the current patch. As a result, this algorithm can restore well textures, that would be blurred by other denoising algorithm."> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_nonlocal_means_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_nonlocal_means.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Non-local means denoising for preserving textures</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="Attribute operators (or connected operators) [1]_ is a family of contour preserving filtering operations in mathematical morphology. They can be implemented by max-trees [2]_, a compact hierarchical representation of the image."> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_attribute_operators_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_attribute_operators.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Attribute operators</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="Wavelet denoising relies on the wavelet representation of the image. Gaussian noise tends to be represented by small values in the wavelet domain and can be removed by setting coefficients below a given threshold to zero (hard thresholding) or shrinking all coefficients toward zero by a given amount (soft thresholding)."> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_denoise_wavelet_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_denoise_wavelet.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Wavelet denoising</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="The Butterworth filter is implemented in the frequency domain and is designed to have no passband or stopband ripple. It can be used in either a lowpass or highpass variant. The cutoff_frequency_ratio parameter is used to set the cutoff frequency as a fraction of the sampling frequency. Given that the Nyquist frequency is half the sampling frequency, this means that this parameter should be a positive floating point value < 0.5. The order of the filter can be adjusted to control the transition width, with higher values leading to a sharper transition between the passband and stopband."> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_butterworth_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_butterworth.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Butterworth Filters</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="In this example, we show how to find an optimally calibrated version of any denoising algorithm."> .. only:: html .. image:: /auto_examples/filters/images/thumb/sphx_glr_plot_j_invariant_tutorial_thumb.png :alt: :ref:`sphx_glr_auto_examples_filters_plot_j_invariant_tutorial.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Full tutorial on calibrating Denoisers Using J-Invariance</div> </div> .. thumbnail-parent-div-close .. raw:: html </div> .. toctree:: :hidden: /auto_examples/filters/plot_tophat /auto_examples/filters/plot_hysteresis /auto_examples/filters/plot_restoration /auto_examples/filters/plot_window /auto_examples/filters/plot_rank_mean /auto_examples/filters/plot_unsharp_mask /auto_examples/filters/plot_deconvolution /auto_examples/filters/plot_blur_effect /auto_examples/filters/plot_entropy /auto_examples/filters/plot_j_invariant /auto_examples/filters/plot_inpaint /auto_examples/filters/plot_dog /auto_examples/filters/plot_denoise /auto_examples/filters/plot_cycle_spinning /auto_examples/filters/plot_phase_unwrap /auto_examples/filters/plot_nonlocal_means /auto_examples/filters/plot_attribute_operators /auto_examples/filters/plot_denoise_wavelet /auto_examples/filters/plot_butterworth /auto_examples/filters/plot_j_invariant_tutorial