Assignment For Image Processing: Blurring
Assignment For Image Processing: Blurring
Blurring
Blurring is used in pre-processing tasks, such as removal of small details from an image
prior to (large) object extraction.
In Digital image processing, blurring is used to make an image smooth in which edges are
not observed. Suppose, we have an image in which there are 508*340=172,720 pixels. If we
want to blur this image, then all the 172,720-pixel values will be changed by using the
blurring technique and convolution as we know that in an image, there are 8 pixels around it.
When these pixels are combined as 8+1=9, a 3x3 matrix is formed. In our image, there are
172,720 pixels, so there will be 172,720 matrices of 3x3 orders. By applying convolution in
all 172,720 matrices with a common matrix called the kernel. The kernel is a special matrix,
it changes the pixels using convolution to make an image blur. A low pass filter is used for
blurring as it allows the low frequency to allow and stop the high frequency. The term
frequency means to change the value of the pixel.
In filter it is divided by 9 for normalization otherwise value of a pixel will increase resulting
in more contrast which is not the goal.
Explanation
Use of the first filter yields the standard average of the pixels under the mask.
Which is the average of the intensity levels of the pixels in the neighborhood defined
by the mask
A spatial averaging filter in which all coefficients are equal sometimes is called a box
filter.
Two 3x3 smoothing (averaging) filter masks.
The constant multiplier in front of each mask is equal to 1 divided by the sum of the
values of its coefficients, as is required to compute an average.
The second mask in Figure is a little more interesting.
This mask yields a so called weighted average, terminology used to indicate that
pixels are multiplied by different coefficients, thus giving more importance (weight) to
some pixels at the expense of others.
Manan Sharma Image Processing Roll no :-3
Formula
The general implementation for filtering an M X N image with a weighted averaging
filter of size m x n (m and n odd) is given by the expression-
The above image shows us the before and after changes of the filter (i.e Average filter)
Linear filters blurs all image structures points, edges and lines, reduction of image
quality
Linear filters thus not used a lot for removing noise
Manan Sharma Image Processing Roll no :-3
The best-known filter in this category is the median filter, which, as its name
implies, replaces the value of a pixel by the median of the intensity values in the
neighborhood of that pixel (the original value of the pixel is included in the
computation of the median).
Median filters are quite popular because, for certain types of random noise, they
provide excellent noise-reduction capabilities, with considerably less blurring than
linear smoothing filters of similar size.
Median filters are particularly effective in the presence of impulse noise, also
called salt-and-pepper noise because of its appearance as white and black dots
superimposed on an image.
The median, of a set of values is such that half the values in the set are less than
or equal to the median and half are greater than or equal to the median.
Explanation
The median filter works by moving through the image pixel by pixel, replacing
each value with the median value of neighbouring pixels.
The pattern of neighbours is called the "window", which slides, pixel by pixel
over the entire image 2 pixel, over the entire image.
In order to perform median filtering at a point in an image, we first sort the
values of the pixel in the neighborhood, determine their median, and assign
that value to the corresponding pixel in the filtered image.
Manan Sharma Image Processing Roll no :-3
Note that noise pixels are considered to be very different from the median.
Using this idea median filter can remove this type of noise problems while
preserving edges.
Edge Detection
Edge Detection
Edge detection is the approach used most frequently for segmenting images based
on abrupt change in intensity.
Ideally, edges should be 1 pixel thin. In practice, they are blurred and noisy.
Edge Models- classified according to their intensity profiles
o Step Edge
A step edge involves a transition between two intensity levels occurring
over a distance of single pixel.
o Ramp Edge
Digital images are having edges that are blurred and noisy.
The slope of ramp is inversely proportional to the degree of blur.
Edge point is not well defined but contained in any point in the ramp.
o Roof Edge
Models of lines through a region.
Manan Sharma Image Processing Roll no :-3
Embossing Implementation
Implementation of Embossing
Python code for implementation of Embossing
#Importing libraries
#Embossing function
Output:-
Original Image:-
Embossed Image:-