Filters in image processing are matrices or kernels convolved over the images to modify their appearance or extract their specific features. Filters work by modifying an image's pixel values based on neighboring pixels' values.
There are several types of filters in image processing:
These filters reduce noise from the images by blurring them with respect to their neighborhood pixels. Here are some of the smoothing filters:
Gaussian filter: This filter applies a two-dimensional Gaussian function to the neighborhood pixels to smoothen the image. The greater the standard deviation of the Gaussian distribution, the greater the blur will be.
Original image
Image with Gaussian filter
Note: Read more about the Gaussian filter.
Median filter: This filter replaces each pixel value with the median of the neighboring pixels. It is effective in reducing the salt and pepper noise from the images.
Original image
Image with a median filter
Note: Read more about the median filter.
These filters enhance an image's details and edges, making them more pronounced. Here are some of the sharpening filters:
Laplacian filter: This filter convolves over the image based on the principle of the Laplace transform. It calculates the image matrix's second-order derivative and highlights its edges and details by emphasizing regions of rapid intensity changes.
Original image
Image with Laplacian filter
Sobel filter: It detects the edges by calculating the horizontal and vertical derivatives of the image and then combining them.
Original image
Image with Sobel edge detector
Robert filter: It detects the edges by calculating and combining derivatives of both the image diagonals.
Original image
Image with a Robert filter
Binary threshold filter: This filter converts a greyscaled image into a binary image by setting pixel values above a threshold to white and values below the threshold to black.
Original image
Image with binary threshold filter
Adaptive threshold filter: It is similar to the binary threshold filter, but it determines its threshold based on the local neighborhood of each pixel.
Original image
Image with adaptive threshold filter
These filters are widely used in morphological image processing. Following are a few morphological filters:
Dilation filter: This filter expands the boundaries of regions in an image by replacing each pixel with a maximum value in its neighborhood. It helps fill gaps, join broken lines, and enlarge objects.
Original image
Image with dilation filter
Erosion filter: This filter shrinks the boundaries of regions by replacing each pixel with the minimum value with its neighborhood. It helps remove noise, separates connected objects, and reduces object size.
Original image
Image with erosion filter
The filters mentioned above represent only a subset of the wide range of filters available in image processing. Each filter serves a specific purpose and can be applied based on the desired outcome. Furthermore, deep learning models can be leveraged to identify the most suitable filter for a specific task or objective.
Free Resources