
- Scikit Image – Introduction
- Scikit Image - Image Processing
- Scikit Image - Numpy Images
- Scikit Image - Image datatypes
- Scikit Image - Using Plugins
- Scikit Image - Image Handlings
- Scikit Image - Reading Images
- Scikit Image - Writing Images
- Scikit Image - Displaying Images
- Scikit Image - Image Collections
- Scikit Image - Image Stack
- Scikit Image - Multi Image
- Scikit Image - Data Visualization
- Scikit Image - Using Matplotlib
- Scikit Image - Using Ploty
- Scikit Image - Using Mayavi
- Scikit Image - Using Napari
- Scikit Image - Color Manipulation
- Scikit Image - Alpha Channel
- Scikit Image - Conversion b/w Color & Gray Values
- Scikit Image - Conversion b/w RGB & HSV
- Scikit Image - Conversion to CIE-LAB Color Space
- Scikit Image - Conversion from CIE-LAB Color Space
- Scikit Image - Conversion to luv Color Space
- Scikit Image - Conversion from luv Color Space
- Scikit Image - Image Inversion
- Scikit Image - Painting Images with Labels
- Scikit Image - Contrast & Exposure
- Scikit Image - Contrast
- Scikit Image - Contrast enhancement
- Scikit Image - Exposure
- Scikit Image - Histogram Matching
- Scikit Image - Histogram Equalization
- Scikit Image - Local Histogram Equalization
- Scikit Image - Tinting gray-scale images
- Scikit Image - Image Transformation
- Scikit Image - Scaling an image
- Scikit Image - Rotating an Image
- Scikit Image - Warping an Image
- Scikit Image - Affine Transform
- Scikit Image - Piecewise Affine Transform
- Scikit Image - ProjectiveTransform
- Scikit Image - EuclideanTransform
- Scikit Image - Radon Transform
- Scikit Image - Line Hough Transform
- Scikit Image - Probabilistic Hough Transform
- Scikit Image - Circular Hough Transforms
- Scikit Image - Elliptical Hough Transforms
- Scikit Image - Polynomial Transform
- Scikit Image - Image Pyramids
- Scikit Image - Pyramid Gaussian Transform
- Scikit Image - Pyramid Laplacian Transform
- Scikit Image - Swirl Transform
- Scikit Image - Morphological Operations
- Scikit Image - Erosion
- Scikit Image - Dilation
- Scikit Image - Black & White Tophat Morphologies
- Scikit Image - Convex Hull
- Scikit Image - Generating footprints
- Scikit Image - Isotopic Dilation & Erosion
- Scikit Image - Isotopic Closing & Opening of an Image
- Scikit Image - Skelitonizing an Image
- Scikit Image - Morphological Thinning
- Scikit Image - Masking an image
- Scikit Image - Area Closing & Opening of an Image
- Scikit Image - Diameter Closing & Opening of an Image
- Scikit Image - Morphological reconstruction of an Image
- Scikit Image - Finding local Maxima
- Scikit Image - Finding local Minima
- Scikit Image - Removing Small Holes from an Image
- Scikit Image - Removing Small Objects from an Image
- Scikit Image - Filters
- Scikit Image - Image Filters
- Scikit Image - Median Filter
- Scikit Image - Mean Filters
- Scikit Image - Morphological gray-level Filters
- Scikit Image - Gabor Filter
- Scikit Image - Gaussian Filter
- Scikit Image - Butterworth Filter
- Scikit Image - Frangi Filter
- Scikit Image - Hessian Filter
- Scikit Image - Meijering Neuriteness Filter
- Scikit Image - Sato Filter
- Scikit Image - Sobel Filter
- Scikit Image - Farid Filter
- Scikit Image - Scharr Filter
- Scikit Image - Unsharp Mask Filter
- Scikit Image - Roberts Cross Operator
- Scikit Image - Lapalace Operator
- Scikit Image - Window Functions With Images
- Scikit Image - Thresholding
- Scikit Image - Applying Threshold
- Scikit Image - Otsu Thresholding
- Scikit Image - Local thresholding
- Scikit Image - Hysteresis Thresholding
- Scikit Image - Li thresholding
- Scikit Image - Multi-Otsu Thresholding
- Scikit Image - Niblack and Sauvola Thresholding
- Scikit Image - Restoring Images
- Scikit Image - Rolling-ball Algorithm
- Scikit Image - Denoising an Image
- Scikit Image - Wavelet Denoising
- Scikit Image - Non-local means denoising for preserving textures
- Scikit Image - Calibrating Denoisers Using J-Invariance
- Scikit Image - Total Variation Denoising
- Scikit Image - Shift-invariant wavelet denoising
- Scikit Image - Image Deconvolution
- Scikit Image - Richardson-Lucy Deconvolution
- Scikit Image - Recover the original from a wrapped phase image
- Scikit Image - Image Inpainting
- Scikit Image - Registering Images
- Scikit Image - Image Registration
- Scikit Image - Masked Normalized Cross-Correlation
- Scikit Image - Registration using optical flow
- Scikit Image - Assemble images with simple image stitching
- Scikit Image - Registration using Polar and Log-Polar
- Scikit Image - Feature Detection
- Scikit Image - Dense DAISY Feature Description
- Scikit Image - Histogram of Oriented Gradients
- Scikit Image - Template Matching
- Scikit Image - CENSURE Feature Detector
- Scikit Image - BRIEF Binary Descriptor
- Scikit Image - SIFT Feature Detector and Descriptor Extractor
- Scikit Image - GLCM Texture Features
- Scikit Image - Shape Index
- Scikit Image - Sliding Window Histogram
- Scikit Image - Finding Contour
- Scikit Image - Texture Classification Using Local Binary Pattern
- Scikit Image - Texture Classification Using Multi-Block Local Binary Pattern
- Scikit Image - Active Contour Model
- Scikit Image - Canny Edge Detection
- Scikit Image - Marching Cubes
- Scikit Image - Foerstner Corner Detection
- Scikit Image - Harris Corner Detection
- Scikit Image - Extracting FAST Corners
- Scikit Image - Shi-Tomasi Corner Detection
- Scikit Image - Haar Like Feature Detection
- Scikit Image - Haar Feature detection of coordinates
- Scikit Image - Hessian matrix
- Scikit Image - ORB feature Detection
- Scikit Image - Additional Concepts
- Scikit Image - Render text onto an image
- Scikit Image - Face detection using a cascade classifier
- Scikit Image - Face classification using Haar-like feature descriptor
- Scikit Image - Visual image comparison
- Scikit Image - Exploring Region Properties With Pandas
Scikit Image − Gaussian Filter
A Gaussian filter is a type of linear filter used in image processing to perform tasks like smoothing and reducing noise in images based on a Gaussian function. It effectively preserves edges while reducing noise. The main parameter of a Gaussian filter is the standard deviation (sigma), which controls the spread. A larger sigma value results in a wider and smoother Gaussian filter, while a smaller sigma value results in a narrower filter with less smoothing.
In the "scikit-image" library, the filters.gaussian() function is provided to apply Gaussian filtering to images.
Using the skimage.filters.gaussian() function
The filters.gaussian() function is used for applying a multi-dimensional Gaussian filter to an input image.
Syntax
Following is the syntax of this function −
skimage.filters.gaussian(image, sigma=1, output=None, mode='nearest', cval=0, preserve_range=False, truncate=4.0, *, channel_axis=<ChannelAxisNotSet>)
Parameters
-
The function accepts the following parameters â
- Image (array-like): the Input grayscale or color image to filter.
- Sigma (scalar or sequence of scalars, optional): Standard deviation for the Gaussian kernel. It can be a scalar or a sequence of scalars, specifying the standard deviations for each axis (in the case of multi-dimensional images).
- Output (array, optional): An output array to store the filter output. If not provided, a new array will be allocated.
- Mode (optional): Determines how the array borders are handled. Options include 'reflect', 'constant', 'nearest', 'mirror', and 'wrap'. The default is 'nearest'.
- Cval (scalar, optional): Value to fill past the edges of the input image if the mode is set to 'constant'. The default is 0.0.
- Preserve_range (bool, optional): If True, keep the original range of pixel values. If False, the input image is normalized based on the image data type. The default is False.
- Truncate (float, optional): Truncate the filter at a specified number of standard deviations. This parameter can help control the extent of the Gaussian filter. The default is 4.0.
- channel_axis (int or None, optional): Specifies the axis of the array that corresponds to channels in a multi-channel image. If None, the image is assumed to be grayscale. The default is None. This parameter was added in version 0.19 of scikit-image.
Return value
The function returns the filtered image as an ndarray.
Example
The following example demonstrates how to apply the Gaussian filter to a grayscale image using the skimage.filters.gaussian() function −
import numpy as np import matplotlib.pyplot as plt from skimage.filters import gaussian from skimage import io # Load an input image image = io.imread('Images/Fruits.jpg', as_gray=True) # Apply the Gaussian filter with standard deviation 1 sigma = 1 filtered_image = gaussian(image, sigma=sigma) # Plot the original and Gaussian filtered images fig, axes = plt.subplots(1, 2, figsize=(10, 5)) ax = axes.ravel() # Display the Original Image ax[0].imshow(image, cmap='gray') ax[0].axis('off') ax[0].set_title('Original Image') # Display the Gaussian filtered image ax[1].imshow(filtered_image, cmap='gray') ax[1].axis('off') ax[1].set_title('Gaussian filtered image \n(sigma={})'.format(sigma)) plt.tight_layout() plt.show()
Output

Example
The following example demonstrates how to use the skimage.filters.gaussian() function to apply Gaussian filtering to a color image using different standard deviations and boundary handling modes −
import numpy as np import matplotlib.pyplot as plt from skimage.filters import gaussian from skimage import io # Load an input image image = io.imread('Images/butterfly.jpg') # Apply the Gaussian filter with different standard deviations sigma1 = 0.5 filtered_image1 = gaussian(image, sigma=sigma1, channel_axis=-1) sigma2 = 1 filtered_image2 = gaussian(image, sigma=sigma2, channel_axis=-1) sigma3 = 1.3 filtered_image3 = gaussian(image, sigma=sigma3, mode='reflect', channel_axis=-1) # Plot the original and Gaussian filtered images fig, axes = plt.subplots(2, 2, figsize=(8, 5)) ax = axes.ravel() # Display the Original Image ax[0].imshow(image) ax[0].axis('off') ax[0].set_title('Original Image') # Display the Gaussian filtered image ax[1].imshow(filtered_image1) ax[1].axis('off') ax[1].set_title('Gaussian filtered image \n(sigma={})'.format(sigma1)) ax[2].imshow(filtered_image2) ax[2].axis('off') ax[2].set_title('Gaussian filtered image \n(sigma={})'.format(sigma2)) ax[3].imshow(filtered_image3) ax[3].axis('off') ax[3].set_title('Gaussian filtered image \n(sigma={}, mode=reflect)'.format(sigma3)) plt.tight_layout() plt.show()
Output
