CVR
CVR
A Gaussian Filter is a low pass filter used for reducing noise (high frequency
components) and blurring regions of an image. The filter is implemented as an Odd
sized Symmetric Kernel (DIP version of a Matrix) which is passed through each pixel
of the Region of Interest to get the desired effect. The kernel is not hard towards
drastic color changed (edges) due to it the pixels towards the center of the kernel
having more weightage towards the final value then the periphery. A Gaussian Filter
could be considered as an approximation of the Gaussian Function (mathematics). In
this article we will learn methods of utilizing Gaussian Filter to reduce noise in
images using Python programming language.
Where,
x → X coordinate value
y → Y coordinate value
σ → Standard Deviation
Using the above function a gaussian kernel of any size can be calculated, by
providing it with appropriate values. A 3×3 Gaussian Kernel Approximation(two-
dimensional) with Standard Deviation = 1, appears as follows
Syntax: Filter(Kernel)
Takes in a kernel (predefined or custom) and each pixel of the image through it
(Kernel Convolution).
Blurred Image
Explanation:
Firstly we imported the Image and ImageFilter (for using filter()) modules of the
PIL library. Then we created an image object by opening the image at the path
IMAGE_PATH (User defined). After which we filtered the image through the filter
function, and providing ImageFilter.GaussianBlur (predefined in the ImageFilter
module) as an argument to it. The kernel dimensions of ImageFilter.GaussianBlur is
5×5. In the end we displayed the image.
image = image.filter(ImageFilter.GaussianBlur)
to
image = image.filter(ImageFilter.GaussianBlur(radius=x))
where x => blur radius (size of kernel in one direction, from the center pixel)
image = Image.open(r"FILE_PATH")
General Classification:
Smoothing Spatial Filter
Smoothing filter is used for blurring and noise reduction in the image. Blurring is
pre-processing steps for removal of small details and Noise Reduction is
accomplished by blurring.
Mean Filter: Linear spatial filter is simply the average of the pixels contained in
the neighborhood of the filter mask. The idea is replacing the value of every pixel
in an image by the average of the grey levels in the neighborhood define by the
filter mask. Below are the types of mean filter:
Averaging filter: It is used in reduction of the detail in image. All coefficients
are equal.
Weighted averaging filter: In this, pixels are multiplied by different
coefficients. Center pixel is multiplied by a higher value than average filter.
Order Statistics Filter: It is based on the ordering the pixels contained in the
image area encompassed by the filter. It replaces the value of the center pixel
with the value determined by the ranking result. Edges are better preserved in this
filtering. Below are the types of order statistics filter:
Minimum filter: 0th percentile filter is the minimum filter. The value of the
center is replaced by the smallest value in the window.
Maximum filter: 100th percentile filter is the maximum filter. The value of the
center is replaced by the largest value in the window.
Median filter: Each pixel in the image is considered. First neighboring pixels are
sorted and original values of the pixel is replaced by the median of the list.
Sharpening Spatial Filter
It is also known as derivative filter. The purpose of the sharpening spatial filter
is just the opposite of the smoothing spatial filter. Its main focus in on the
removal of blurring and highlight the edges. It is based on the first and second
order derivative.