Ch-3 Spatial and Frequency Domain Image Processing
Ch-3 Spatial and Frequency Domain Image Processing
Education
1
Chapter Three
2
Outline
Spatial and Frequency Domain Image Processing
Image Enhancement
Image enhancement techniques
Spatial domain
Frequency domain
Image Filtering
3
Image Enhancement
4
Spatial Domain Methods
Spatial means working in space i.e.(given
image).
we deal with images as it is.
The value of the pixels of the image change with
respect to scene.
It means working with pixel values or raw data.
Let g(x , y) be original image
Where g is gray level values and (x , y) is co-
ordinates
For 8-bit image, g can take values from 0-255
Where 0--- BLACK
255--- WHITE and
Others---shades of GRAY
5
Cont.
In an image with size 256*256 (x,y) can
assume any values from (0,0) to (255,255).
6
Cont.
7
Point Processing
8
Digital Image Negative
Negative means inverting gray levels.
Particularly suited for enhancing white or gray detail embedded in the
dark regions of an images, especially when the black areas are
dominant in size.
Useful in large applications e.g. X-ray images.
9
Cont.
Generally, s=(L-1)-r
Where L=>total number of gray levels(e.g. 256
for 8-bit image)
10
Contrast Stretching
Reason
Poor Illumination
Wrong setting of lens aperture
Idea behind contrast stretching is to make dark porting darker
and bright portion brighter.
Increase dynamic range of the gray levels in the image being
processed
In the below figure, solid line indicates contrast stretching.
Dark portion is being made darker by assigning slope of <1
Bright portion is being made brighter by assigning slope of >1
Any set of slopes cant be generalize for all kind of images
The location points(r1,s1) and (r2,s2) controls the shape of the
transformation function.
Formulation is given below
s = 1.r ; for 0<=r<=a
= m(r-a)+v ; ;for a<=r<=b
= n(r-b)+w; for b<=r<=L-1
11
Cont.
12
Thresholding
Extreme contrast stretching yields Thresholding
In contrast Stretching figure, if 1 and n slope are made
Zero and if m slope is increased then we get
Thresholiding Transformation.
If r1=r2,s1=0 and s2=L-1
Then we get Thresholding function
Expressing goes as under
s=0; if r<=a
s=L-1; if r>a
Where L is number of gray levels.
Note: it is subjective phenomenon.
Thresholded image has maximum contrast as it has only
Black and white gray values.
13
Cont.
14
Gray Level Slicing(Intensity Slicing)
16
Bit Plane Slicing
Instead of highlighting gray-level ranges, Here, we find the
contribution made by each bit to the final image.
Consider a 256 * 256 image with 256 gray levels i.e. 8 bit
representation for each pixel. E.g. Black is represented as
0000_0000 and white by 1111_1111.
Consider LSB value of each pixel and plot image. Continue till
MSB is reached.
All 8-bit images will be binary.
Observing the images we conclude that
Higher order images contain visually sufficient data.
Lower order bits contain suitable details of image
Hence, PBS can be used in image Compression.
We can transmit only higher order bits and remove lower
order bits
E.g. stegnography
17
Cont.
18
Dynamic Range Compression(Log
Transformation)
20
Power law transformation
Power law transform can be used to increase
dynamic range of image
The transformation is shown for different
values of ‘μ’ which is also the gamma
correction factor
By changing μ, we obtain the family of
transformation curves.
Nonlinearity encountered during image
capturing, storing and display can be
corrected using gamma correction.
Example
CRT(Cathode Ray Tube)
MR(magnitude resonance)
21
Cont.
22
Histogram Processing
In Statistics, Histogram is a graphical
representation showing a visual impression of
the distribution of data.
An Image Histogram is a type of histogram
that acts as a graphical representation of the
lightness/color distribution in a digital image.
It plots the number of pixels for each value.
The histogram of a digital image with gray
levels in the range [0, L-1] is a discrete
function h(rk) = nk, where rk is the kth gray level
and nk is the number of pixels in the image
having gray level rk.
23
Cont.
24
Why Histogram?
Histograms are the basis for numerous spatial
domain processing techniques
Histogram manipulation can be used
effectively for image enhancement
Histograms can be used to provide useful
image statistics
Information derived from histograms are quite
useful in other image processing applications,
such as image compression and segmentation.
25
Examples
26
Assignment-1(10%)
29
Image Restoration
Noise in images is the vital factor which degrades the
quality of the images.
Reducing noise from the satellite images, medical images
etc., is a challenge for the researchers in digital image
processing.
Several approaches are there for noise reduction.
What is image restoration?
Image restoration is the process of recovering the
original image that has been degraded by noise using
a prior knowledge of the degradation phenomenon.
Goal of image restoration
Improve the quality and naturalness of an image in some
predefined sense
Features
A Prior knowledge:
A prior knowledge of the degradation phenomenon is
considered
Objective process:
Modeling the degradation and apply the inverse process to
recover the original image
Noise in an image
Noise in image is any degradation in an image signal,
caused by external disturbances during image
digitalization and/or image transmission.
Source of noise
Image acquisition: sensor heat while capturing an image
e.g., light levels, sensor temperature, etc.
g(x,y)=h(f(x,y))+h(x,y)f(x,y)=h-1(g(x,y))-h(x,i)
Types of Image Noise
Salt and pepper noise
Its also known as impulse noise. this
noise can be caused by sharp & sudden
disturbances in the image signal.
Its appearance is randomly scattered
white or black (or both)
An effective noise reduction method for
this type of noise is a median filter or a
morphological filter.
Gaussian noise
Gaussian noise is statistical noise having
a probability density function (PDF)
equal to that of the normal distribution
Gaussian noise is caused by random
fluctuations in the signal.
its modeled by random values added to
an image.
Types of Image Noise
Speckle noise
It is a granular 'noise' that inherently exists
in and degrades the quality of the image
It is caused by coherent processing of
backscattered signals from multiple
distributed targets.
Speckle noise can be modeled by random
values multiplied by pixel values of an
image.
Periodic noise
Periodic noise is appearance when signal is
subject to a periodic, rather than a random
disturbance.
Periodic noise in an image arises typically
from electrical or electromechanical
interference during image acquisition.
Periodic noise can be reduced significantly
via frequency domain filtering
Properties of image noise
Spatial properties of noise (e.g. additive noise)
Statistical behavior of the gray-level values of pixels
Noise parameters, correlation with the image
Apply spatial domain image restoration techniques
one pixel at a time and the calculation is repeated until the entire
image has been filtered and a "new" image has been generated.
By varying the calculation performed and the weightings of the
(x, y-1)
(x-1, y) P (x,y) (x+1, y)
(x, y+1)
Max filter
f ( x, y ) max g ( s, t )
( s ,t )S xy
Spatial Noise filtering techniques
Mean filtering: current pixel will be replaced by
average of its neighboring pixel values
Median filtering: current pixel will be replaced by
median or middle pixel value of its neighboring
pixels
New generated filtering: current pixel will be
replaced by arithmetic mean of mid-1, mid, mid+1
of its neighboring pixels
Midpoint filter
f ( x, y ) 1 max g ( s, t ) min g ( s, t )
2 ( s ,t )S xy ( s ,t )S xy
Spatial Filtering: Mean Filtering
46
Mean filtering Example
• What is the new image obtained after applying
mean filtering using a 3x3 window
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 10 20 30 30 30 20 10
0 0 90 0 0 0 0 0 0 0
0 20 40 60 60 60 40 20
0 0 0 0 0 0 0 0 0 0
0 30 60 90 90 90 60 30
0 30 50 80 80 90 60 30
0 30 50 80 80 90 60 30
0 20 30 50 50 60 40 20
10 20 30 30 30 30 20 10
10 10 10 0 0 0 0 0
Spatial filtering: Median Filtering
• Median filtering is very widely used in digital image
processing because it preserves edges while removing
noise.
• The median filter is a sliding-window spatial filter.
It replaces the value of the center pixel with the
median of the intensity values in the neighborhood
of that pixel.
Median filtering is a nonlinear operation often used
in image processing to reduce "salt and pepper"
noise because of its appearance as white and black
dots overlaid on an image.
A median filter is more effective than convolution
when the goal is to simultaneously reduce noise and
preserve edges.
• For every pixel, a 3x3 neighborhood with the pixel as
center is considered. In median filtering, the value of
the pixel is replaced by the median of the pixel values
in the 3x3 neighborhood.
Example: The resulting image after applying
median filtering
Exercise 1
What is the new value of the central pixel with value 8
(in the below 3x3 image) after applying median
filtering?
Answers: a) 7 b) 1 c) 3 d)9
Exercise 2
What are the values of the
shaded boxes with yellow colour
after applying median filtering?
Answers:
c)
a) b)
Assignment for next week
of neighboring pixels.
The following figure shows how to compute the (4,2) output pixel of the
60