Low pass filters in image preprocessing in computer vision

Sumitkrsharma
4 min readApr 17, 2024

--

Word “Filter” becomes popular in images after “Snapchat, Instagram” filters which enables user to beautify their images, for their posts over social media platforms, but sometimes we wondered about their working and willing know about behind the scenes of commonly used filters on which this post is about to helps readers to briefly understand the working of the low pass filters, basically filters are classified as low pass and high pass later in post readers will know what this low and high makes differences. So, Let’s starts with filters and then explore low pass filters.

What are filters?

Filters are operations that are used to enhance the image visual appearance, it allows to highlight some regions more than others, and extracting the information from th image based on the required use case.

Low pass filters?

Imagine you captured a landscape image, having tiny leaves spreading over the scape and want to soften their appearance, then low pass filters make your task easier. As name suggests it is preprocessing technique that only passes or allows low frequency components of an image whenever applied, by convolving the image with kernel such as average kernel that softens the sharp regions in image.

Popular low pass filters

Gaussian Blur Filter : commonly used for noise reduction, image denoising, and edge-preserving smoothing.

Mean Filter : commonly used for noise reduction and smoothing images.

Median Filter: commonly used for removing salt-and-pepper noise while preserving image details.

Anisotropic Diffusion Filter:commonly used for denoising and edge-preserving smoothing.

Wiener Filter: commonly used for noise reduction in images corrupted by additive noise.

Non-Local Means Filter: commonly used for removing Gaussian noise while preserving image details.

Total Variation (TV) Denoising: commonly used for denoising and image restoration.

Kuwahara Filter: commonly used for noise reduction and edge-preserving smoothing.

Wavelet Denoising: commonly used for noise denoising images corrupted by various types of noise.

Low-Pass Fourier Transform: commonly used for smoothing images and reducing noise in the frequency domain.

Poisson Noise Reduction Filter: commonly used for reduce Poisson noise.

Gabor Filter: commonly used for detecting edges and textures in images.

Homomorphic Filter: commonly used for enhancing images captured under varying lighting conditions.

Adaptive Histogram Equalization : commonly used for improving the visibility of details for both bright and dark section of the image.

Contrast Limited Adaptive Histogram Equalization : commonly used for enhancing image contrast while preserving natural appearance.

Gradient-Based Filter: commonly used for edge detection, feature extraction, and image segmentation.

Exponential Smoothing Filter: commonly used for noise reduction in time-series data and sequential images.

Numerical example

Image matrix , consider 3x3 input image

[[10, 20, 30],
[40, 50, 60],
[70, 80, 90]]

Gaussian filter matrix

[[1, 2, 1], [2, 4, 2], [1, 2, 1]]

Applying convolutional -by element wise multiplication in order to find new center pixel of the input image.

(10*1) + (20*2) + (30*1) +
(40*2) + (50*4) + (60*2) +
(70*1) + (80*2) + (90*1) = 620/16 (as sum of filter matrix is “16")

620/16 = 38.75

So, the new value of the center pixel of the input image is 38.75.

[[10, 20, 30],
[40, 38.75, 60],
[70, 80, 90]]

Repeat the steps for each pixels give us new image matrix.

Example python implmentation

import cv2

import numpy as np

from google.colab.patches import cv2_imshow

# Load the image

image = cv2.imread(‘/content/car.jpg’)

# Display the original image

cv2_imshow(image)

cv2.waitKey(0)

cv2.destroyAllWindows()

# Apply low-pass filter (Gaussian blur)

filtered_image = cv2.GaussianBlur(image, (5, 5), 0)

# Display the filtered image

cv2_imshow(filtered_image)

cv2.waitKey(0)

cv2.destroyAllWindows()

Original image

Filtered image

Common python libararies utlizes for using low pass filter programmatically

Opencv

Tensorflow and Pytorch

PIL (Pillow)

Scikit-image

Mahotas

SciPy

Applications

Medical Imaging

Photography

Areial imaging

Remote sensing

Video comapression

Advantages

Detail perservation

Noise reduction

Compression without hamper the quality of image

Artifact reduction

Disadvantages

High processing time

Blurry artifacts

Elimination of textures of image

Edge distortion

Conclusion

In conclusion low-pass filters are preservers of the low frequency components of the image, which helps in image enhancement, and noise reduction. Complex real-world problems such as medical imaging, remote and remote sensing using it as baseline process which improves the overall effectiveness of these use cases. Hope this post able to delivery brief understanding about the low-pass filters used in image preprocessing techniques.

--

--