0% found this document useful (0 votes)
18 views

L-5, 6,7 - (Digital ImageProcessing - Image Enhancement in Spatial Domain)

The document describes a digital image processing course. The course objectives are to describe and explain basic principles of digital image processing, design algorithms for basic and advanced image processing tasks, and assess algorithm performance. Key topics covered include image enhancement in the spatial domain, image sampling and quantization, point processes, histogram equalization, and intensity transformation functions like imadjust.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

L-5, 6,7 - (Digital ImageProcessing - Image Enhancement in Spatial Domain)

The document describes a digital image processing course. The course objectives are to describe and explain basic principles of digital image processing, design algorithms for basic and advanced image processing tasks, and assess algorithm performance. Key topics covered include image enhancement in the spatial domain, image sampling and quantization, point processes, histogram equalization, and intensity transformation functions like imadjust.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 130

COL LEGE OF E N GI N E ER I N G ROOR K EE

Established in 1998

Digital Image Processing (TCS-071)

Session: 2020-21

Digital Image Processing


COURSE OBJECTIVE

The aim of this course is,


 Describe and explain basic principles of digital image
processing.
 Design and implement algorithms that perform basic image
processing (e.g. noise removal and image enhancement).
 Design and implement algorithms for advanced image
analysis (e.g. image compression, image segmentation).
 Assess the performance of image processing algorithms and
systems.

Digital Image Processing


Unit 1
Introduction and Fundamentals:
Motivation and Perspective, Applications, Components of Image Processing
System, Element of Visual Perception, A Simple Image Model, Sampling and
Quantization.
Image Enhancement in Spatial Domain:
Introduction; Basic Gray Level Functions – Piecewise-Linear Transformation
Functions: Contrast Stretching; Histogram Specification; Histogram Equalization;
Local Enhancement; Enhancement using Arithmetic/Logic Operations – Image
Subtraction, Image Averaging; Basics of Spatial Filtering; Smoothing - Mean filter,
Ordered Statistic Filter; Sharpening – The Laplacian.

Digital Image Processing


Digital Image Processing

Image Enhancement in Spatial Domain


Image Sampling and Quantization
• To create a digital image, we need to convert the continuous
sensed data into digital form --> this involves sampling and
quantization
• Digitizing the coordinate values is called sampling
• Digitizing the amplitude values is called quantization
• In practice, the method of sampling is determined by the
sensor
arrangement used to generate the image
• The quality of a digital image is determined by the number of
samples and the number of gray levels
Spatial resolution and intensity resolution

• Sampling is the principal factor defining the spatial


resolution of an image, and quantization is the
principal factor defining the intensity resolution
• Spatial resolution - number of rows and columns for
example: 128 x128, 256 by 256, etc.;
• Intensity resolution - number of gray levels for
example: 8 bits, 16 bits, etc
Image Enhancement
Image Enhancement

Process an image to make the result more suitable than the


original image for a specific application
–Image enhancement is subjective (problem /application
oriented)

Image enhancement methods:


Spatial domain: Direct manipulation of pixel in an image (on
the image plane)
Frequency domain: Processing the image based on modifying the
Fourier transform of an image

Many techniques are based on various combinations of methods


from these two categories
Image Enhancement
Basic Concepts

Spatial domain enhancement methods can be generalized as


g(x,y)=T[f(x,y)]
f(x,y): input image
g(x,y): processed (output) image
T[*]: an operator on f (or a set of input images),
defined over neighborhood of (x,y)

Neighborhood about (x,y): a square or rectangular


sub-image area centered at (x,y)
Point Processes
• Point processes are the simplest of basic image processing
operations.
• A point operation takes a single input image into a single
output image in such a way that each output pixel's gray level
depends only upon the gray level of the corresponding input
pixel.
• Thus, a point operation cannot modify the spatial
relationships within an image.
• Point operations transform the gray scale of an image.
Point Processes
• Linear and nonlinear point operations
• Examples:
– Contrast Stretching
– Image Negatives
– Intensity-level Slicing
– Bit-plane Slicing
– Other Intensity Transformations
– Histogram Equalization
Basic Concepts
Basic Concepts
g(x,y) = T [f(x,y)]
Pixel/point operation:
Neighborhood of size 1x1: g depends only on f at (x,y)
T: a gray-level/intensity transformation/mapping function
Let r = f(x,y) s = g(x,y)
r and s represent gray levels of f and g at (x,y)
Then s = T(r)
Local operations:
g depends on the predefined number of neighbors of f at
(x,y)
Implemented by using mask processing or filtering
Masks (filters, windows, kernels, templates) :
a small (e.g. 3×3) 2-D array, in which the values of the
coefficients determine the nature of the process
Common Pixel Operations

 Image Negatives
 Log Transformations
 Power-Law
Transformations
Image Negatives

 Reverses the gray level order


 For L gray levels the transformation function is
s =T(r) = (L - 1) - r
Image Negatives
Image Scaling

s =T(r) = a.r (a is a constant)


Log Transformations

Function of s = cLog(1+r)
Log Transformations

Properties of log transformations


–For lower amplitudes of input image the range of gray
levels is expanded
–For higher amplitudes of input image the range of gray
levels is compressed
Application:
– This transformation is suitable for the case when the
dynamic range of a processed image far exceeds the
capability of the display device (e.g. display of the
Fourier spectrum of an image)
– Also called “dynamic-range compression / expansion”
Log Transformations
Power-Law Transformation
Power-Law Transformation

For γ < 1: Expands values of dark pixels,


compress values of brighter pixels
For γ > 1: Compresses values of dark pixels,
expand values of brighter pixels
If γ=1 & c=1: Identity transformation (s = r)

A variety of devices (image capture, printing, display) respond


according to power law and need to be corrected

Gamma (γ) correction


The process used to correct the power-law response
phenomena
Power-Law Transformation
Gamma Correction
Histogram
• Gray level histogram of an image - a function showing for
each gray level the number of
• pixels in the image that have that gray level; it is simply a
bar graph of the pixel intensities
Histogram
• Histogram gives us a convenient, easy-to-read
representation of concentration of pixels versus intensity in
an image
• Dynamic range - an range of intensity values that occur in
an image
• Contrast stretching - if image has low-dynamic range; low-
dynamic range can result from poor illumination, lack of
dynamic range in imaging sensor, wrong setting of the
sensor parameters, etc.
• Compression of dynamic range - if the dynamic range of
the image far exceeds the capability of the display device
Histogram calculation
Examples of several types of image
histograms:
Histogram Equalization
• Images with poor intensity distributions can often be
enhanced with histogram equalization <-- point process
• The goal is to obtain a uniform histogram
• • Histogram equalization will not flatten a histogram; if a
histogram has peaks and valleys it will still have them after
equalization - they will be shifted and spread over the
entire range of image intensities
• Works best on images with fine details in darker regions
• Use it carefully - good images can be often degraded by
histogram equalization
Histogram of the equalized image
Histogram Equalization-Example
Intensity (Gray-level)
Transformation Functions
Function imadjust
• Function imadjust is the basic IPT tool for intensity
transformations of gray-scale images. It has the
syntax:

g = imadjust (f, [low_in high_in], [low_out high_out], gamma)


Function imadjust

• As illustrated in figure 3.2 (above), this function maps the intensity values
in image f to new values in g, such that values between low_in and
high_in map to values between low_out and high_out.
• Values below low_in and above high_in are clipped; that is values below
low_in map to low_out, and those above high_in map to high_out.
Function imadjust
• The input image can be of class uint8, uint16, or double, and the output
image has the same class as the input.

• All inputs to function imadjust, other than f, are specified as values


between 0 and 1, regardless of the class of f. If f is of class uint8, imadjust
multiplies the value supplied by 255 to determine the actual values to use;
if f is of class uint16, the values are multiplied by 65535.

• Using the empty matrix ([ ]) for [low_in high_in] of for [low_out


high_out] results in the default values [0 1].

• If high_out is less than low_out, the output intensity is reversed.


Function imadjust
• Parameter gamma specifies the shape of the curve that maps the intensity
values of f to create g. If gamma is less than 1, the mapping is weighted
toward higher (brighter) output values. If gamma is greater than 1, the
mapping is weighted toward lower (darker) output values. If it is omitted
from the function arguments, gamma defaults to 1 (linear mapping).
Function imadjust
Examples
• Example1:

>> f = imread ('baby-BW.jpg');


>> g = imadjust (f, [0 1], [1 0]);
>> imshow(f), figure, imshow (g);
>> imshow(f), figure, imshow (g);

f g
Function imadjust
Examples
• Cont. Example1:

This process, which is the digital equivalent of obtaining a photographic


negative, is particularly useful for enhancing white or gray detail
embedded in a large dark region.

The negative of an image can be obtained also with IPT function


imcomplement:

g = imcomplement (f);
Function imadjust
Examples
• Example2:

>> g = imadjust (f, [0.5 0.75], [0 1], .5);


>> imshow(f), figure, imshow (g);

f g
Function imadjust
Examples
• Example3:

>> g = imadjust (f, [0.5 0.75], [0.6 1], 0.5);


>> imshow(f), figure, imshow (g);

f g
Function imadjust
Examples
• Example4:

>> g = imadjust (f, [ ], [ ], 2);


>> imshow(f), figure, imshow (g);

f g
Logarithmic Transformations
• The shape of logarithmic function curve, is similar to the gamma curve
where gamma < 1, where low values set to 0 and high values set to 1 on
both scales.

• The shape of the gamma curve is variable (because of the change of low
and high values), while the shape of the log function is fixed.

• Logarithmic transformations are implemented using the expression:


g = c * log (1 + double (f))
Logarithmic Transformations
• But this function changes the data class of the image to double, so
another sentence to return it back to should be done:

gs = im2uint8 (mat2gray(g));

• Use of mat2gray brings the values to the range [0 1] and im2uint8 brings
them to the range [0 255]
Logarithmic Transformations
• Example:

>> g = log(1 + double(f));


>> gs = im2uint8(mat2gray(g));
>> imshow(f), figure, imshow (g), figure, imshow(gs);

f g g
s
Contrast-Stretching Transformation
The function shown in the figure below, is called a contrast-stretching
transformation function, because it compresses the input levels lower than m into
a narrow range of dark levels in the output image. Similarly, it compresses the
values above m into a narrow band of light levels in the output. The result is an
image of higher contrast.

The limiting case shown below (b), shows the output of a binary image. This
function is called Thresholding, as mentioned earlier. Thresholding, is a simple tool
that can be used for image segmentation.
Contrast-Stretching Transformation
• The function takes the form of:

Where r represents the intensities of the input image, s the


corresponding intensity values in the output image, and E
controls the slope of the function.
Contrast-Stretching Transformation
• This equation is implemented in MATLAB for the entire
image as

Note the use of eps to prevent overflow if f has any 0


values.
Contrast-Stretching Transformation

• Example1:
>>g = 1 ./ (1+ (100 ./(double(f) + eps)) .^ 20);
>> imshow(f), figure, imshow(g);
Contrast-Stretching Transformation

• Example2:
>> g = 1 ./ (1+ (50 ./(double(f) + eps)) .^ 20);
>> imshow(f), figure, imshow(g);
Contrast-Stretching Transformation

• Example3:
>> g = 1 ./ (1+ (150 ./(double(f) + eps)) .^ 20);
>> imshow(f), figure, imshow(g);
Image Enhancement in
Frequency Domain
Introduction
Background (Fourier Series)

 Any function that periodically repeats itself can be


expressed as the sum of sines and cosines of
different frequencies each multiplied by a
different coefficient
 This sum is known as Fourier Series
 It does not matter how complicated the function
is; as long as it is periodic and meet some mild
conditions it can be represented by such as a sum
 It was a revolutionary discovery
Background (Fourier Transform)

 Even functions that are not periodic can be expressed as


the integrals of sines and cosines multiplied by a
weighing function
 This is known as Fourier Transform
 A function expressed in either a Fourier Series or
transform can be reconstructed completely via an
inverse process with no loss of information
 This is one of the important characteristics of these
representations because they allow us to work in the
Fourier Domain and then return to the original domain
of the function
Fourier Transform

• ‘Fourier Transform’ transforms one function into


another domain , which is called the frequency
domain representation of the original function
• The original function is often a function in the
Time domain
• In image Processing the original function is in the
Spatial Domain
• The term Fourier transform can refer to either the
Frequency domain representation of a function or
to the process/formula that "transforms" one
function into the other.
Our Interest in Fourier Transform

• We will be dealing only with functions (images) of


finite duration so we will be interested only in Fourier
Transform
Applications of Fourier Transforms

 1-D Fourier transforms are used in Signal Processing


 2-D Fourier transforms are used in Image Processing
 3-D Fourier transforms are used in Computer Vision
 Applications of Fourier transforms in Image processing: –
– Image enhancement,
– Image restoration,
– Image encoding / decoding,
– Image description
One Dimensional Fourier Transform and its
Inverse
 The Fourier transform F (u) of a single variable, continuous
function f (x) is

 Given F(u) we can obtain f (x) by means of the Inverse


Fourier Transform
Discrete Fourier Transforms (DFT)

1-D DFT for M samples is given as

The Inverse Fourier transform in 1-D is given as


Discrete Fourier Transforms (DFT)

1-D DFT for M samples is given as

The inverse Fourier transform in 1-D is given as


Two Dimensional Fourier Transform and its
Inverse
 The Fourier transform F (u,v) of a two variable, continuous
function f (x,y) is

 Given F(u,v) we can obtain f (x,y) by means of the Inverse


Fourier Transform
2-D DFT
Fourier Transform
2-D DFT
Shifting the Origin to the Center
Shifting the Origin to the Center
Properties of Fourier Transform

 The lower frequencies corresponds to slow


gray level changes

 Higher frequencies correspond to the fast


changes in gray levels (smaller details such
edges of objects and noise)
DFT Examples
DFT Examples
Filtering using Fourier Transforms
Example of Gaussian LPF and HPF
Filters to be Discussed
Filtering
• Our basic model for filtering in the frequency domain is

G u , v   H u , v F u , v 

result filter Fourier transform of


image to be smoothed

• We’ll briefly discuss 3 types of filters in the order of increasing


smoothness:
– Ideal
– Butterworth
– Gaussian
• Preprocessing: F is shifted so that the DC coefficient is in the
center.
Filtering in Frequency Domain: Basic Steps

Basic Steps
1. Multiply pixel f(x,y) of the
input image by (-1)x+y.
2. Compute F(u,v), the DFT
3. G(u,v)=F(u,v)H(u,v)
4. g1(x,y)=F-1{G(u,v)}
5. g(x,y) = g1(x,y)*(-1)x+y
Uses of image filtering
• Noise Reduction
– Low Pass Filter
• Image Recovery
– Wiener Filter
• Edge Detection
– High Pass Filter
The Filtering Operation
• Convolution
– Continuous (Analog)

f*g= ∫ f(τ) g(t - τ) dτ


– Discrete (Digital)

f(i) * g(i) = Σ f(j) g(i-j)


Sliding Window Approach
Design Considerations
• Filter Creation
– Choosing Coefficients
• Border Considerations
– Wrap-around
– Extend border
– Ignore border
Types of Filters
• Low Pass or Averaging Filter
[010]
[141]
[010]
Types of Filters
• High Pass
– Horizontal Edge Detection (Sobel)
[1 2 1]
[ 0 0 0]
[ -1 –2 –1 ]
– Vertical Edge Detection (Sobel)
[ 1 0 -1 ]
[ 2 0 -2 ]
[ 1 0 -1 ]
Low Pass Filtering

A low-pass filter attenuates high frequencies and retains low frequencies


unchanged. The result in the spatial domain is equivalent to that of a smoothing
filter; as the blocked high frequencies correspond to sharp intensity changes, i.e.
to the fine-scale details and noise in the spatial domain image.
Ideal Filtering:Low-Pass (ILPF)
• The low-frequency components are toward the center.
• Multiplying the transform by a matrix to remove or
minimize the values away from the center.
• Ideal low-pass matrix H

1 if D(u , v )  D 0
H (u , v )  
0 otherwise
• The inverse DFT of H.F is the smoothed image.

D(u,v) is distance
from the origin of
the Fourier
transform, shifted
to the center
Demo

An image with its Fourier spectrum. The superimposed


circles have radii of 5, 15, 30, 80, and 230
Results
D=5

D=15 D=30

D=80 D=230
High Pass Filtering

A high-pass filter, on the other hand, yields edge


enhancement or edge detection in the spatial
domain, because edges contain many high
frequencies. Areas of rather constant gray level
consist of mainly low frequencies and are therefore
suppressed.
Ideal Filtering:High-Pass (IHPF)
• Opposite to low-pass filtering: eliminating
center and keeping the others.
0 if D(u , v )  D 0
H (u , v )  
1 otherwise

D0=15 D0=30 D0=80


Band Pass Filtering

A bandpass attenuates very low and very high frequencies,


but retains a middle range band of frequencies. Bandpass
filtering can be used to enhance edges (suppressing low
frequencies) while reducing the noise at the same time
(attenuating high frequencies).

Bandpass filters are a combination of both lowpass and


highpass filters. They attenuate all frequencies smaller than a
frequency Do and higher than a frequency D1 , while the
frequencies between the two cut-offs remain in the resulting
output image.
Ideal Low Pass Filter
Ideal Low Pass Filter
Ideal Low Pass Filter (example)
Butterworth Low Pass Filter
Butterworth Low Pass Filter
Butterworth Low Pass Filter (example)
Gaussian Low Pass Filters
Gaussian Low Pass and High Pass
Filters
Gaussian Low Pass Filters
Gaussian Low Pass Filters (example)
Gaussian Low Pass Filters (example)
Sharpening Fourier Domain Filters
Sharpening Spatial Domain Representations
Sharpening Fourier Domain Filters (Examples)
Sharpening Fourier Domain Filters (Examples)
Sharpening Fourier Domain Filters (Examples)
A Model of the Image Degradation/
Restoration Process
A Model of the Image Degradation/
Restoration Process

• The degradation process can be modeled as a degradation


function H that, together with an additive noise term η(x,y)
operates on an input image f(x,y) to produce a degraded image
g(x,y)
Digital Image Processing
Fourier Transform
Introduction
• The Fourier Transform is generally used
Jean Baptiste to decompose a signal into various
Joseph Fourier sinusoidal components.
• For an image, the output of the
transformation is the representation of
the image in frequency space, while the
input image is the real space
equivalent.
• In the Fourier space image, each point
represents a particular frequency
contained in the real domain image.
Significance
• The Fourier Transform allows us to perform tasks which
would be impossible to perform any other way; its
efficiency allows us to perform other tasks more quickly.
• The Fourier Transform provides a powerful alternative to
linear spatial filtering; it is more efficient to use the
Fourier transform than a spatial filter for a large filter.
• The Fourier Transform also allows us to isolate and
process particular image frequencies, and so perform
low-pass and high-pass filtering with a great degree of
precision.
Some Intuition
y  f ( x)
• A periodic function
may be written as
the sum of sines y  sin x
and cosines of
varying amplitudes 1
y  sin 2 x
3
and frequencies.
1
y  sin 4 x
5
Examples =>
1 1
f ( x)  sin x  sin 2 x  sin 4 x
3 5
Some Intuition
• Some functions will y  f ( x)
require only a finite
number of functions in
their decomposition;
others will require an
infinite number.

1 1 1 1
f x   sin x  sin 3 x  sin 5 x  sin 7 x  sin 9 x  ...
3 5 7 9
1-D Continuous
• f(x) is a linear combination of simple periodic
patterns. Spatial frequency (measured in
whole cycle per unit of x)


f ( x)   F (u )e i 2xu
du

Simple periodic patterns
Inverse Fourier transform
Weight function for the given frequency

Image co-

F (u )   f ( x ) e  i 2xu ordinate
• Where dx

Fourier transform
1
1-D Discrete (con’d)
• In image processing, we deal with a
discrete function.
• Since we only have to obtain a finite
(a)
number of values, we only need a
finite number of functions to do it.
• For example: 1 1 1 1 -1 -1 -1 -1,
which we may take as a discrete
approximation to the square wave (b)
of figure (a). This can be expressed
as the sum of two sine functions, (b)
and (c)
(c)
Definition of 1-D DFT
Suppose f  [ f 0 , f1 , f 2 , , f N 1 ]
is a sequence of length N. Define its discrete Fourier transform
F  [ F0 , F1 , F2 , , FN 1 ]
N 1
1 xu
where Fu 
N

x 0
exp[2 i ]  f x
N
We can express this definition as matrix multiplication
F  Ff
1 mn
Where F is an NxN matrix defined by Fm , n  exp[ 2 i ]
N N
Definition of 1-D DFT
2 i
Given N, we shall define   exp[ ]
N
1 mn 1 mn
So that Fm , n   Fm ,n  exp[ 2 i ]
N N N

Then we can write

F
Example
Suppose f  [1, 2,3, 4] so that N=4. Then
2 i
  exp[ ]
4
 i
 exp[ ]
2
 
 cos( )  i sin(  )
2 2
 i
1 1 1 1  1 1 1 1 
1 i (i ) 2 (i )3  1 i 1 i 
Then we have F 
1 (i ) 2 (i ) 4 (i ) 6
 1 1 1 1
   
1 (i ) (i )6 (i )9  1 i 1 i 
3

1 1 1 1  1   10 
    
1 1 i 1 i   2  1  2  2i 
F 
4 1 1 1 1  3  4  2 
    
F Ff 1 i  1 i 4
    2  2i 
The Inverse DFT
N 1
 xu 
Inverse DFT: f x   exp 2i Fu
u 0  N
Difference with forward transform:
(1). There is no scaling factor 1/N
(2). The sign inside the exponential function has been changed to positive
Inverse DFT can also be expressed as matrix product

where
1  2 i 
w  exp 
w  N 
Matlab Functions: fft/ifft
• Example:
» a=[1 2 3 4 5 6 7 8 9]

» b=fft(a)

45.0 -4.5 +12.3i -4.5 + 5.3i -4.5 + 2.5i


-4.5 + 0.7i -4.5 - 0.7i -4.5 - 2.5i -4.5 - 5.3i
-4.5 -12.3i

» ifft(b)

1.0 - 0.0i 2.0 - 0.0i 3.0 - 0.0i 4.0 - 0.0i


5.0- 0.0i 6.0 - 0.0i 7.0 + 0.0i 8.0 + 0.0i
9.0 + 0.0i
Properties of 1-D DFT
• Linearity: Suppose f and g are two vectors of same
length, and p and q are scalars, with h = pf + qg. If F,G
and H are the DFT’s of f,g and h, then
H = pF + qG
• Shifting: Suppose we multiply each element xn of a vector
x by (-1)n i.e., we change the sign of every second
element. Let the resulting vector be denoted x’. Then
DFT X’ of x’ is equal to the DFT X of x with the swapping
of the left and right halves.
Applications of some of the properties are
shown in next lecture
Example

» x = [ 2 3 4 5 6 7 8 1]
» x1 = (-1).^[0:7].*x
x1 = 2 -3 4 -5 6 -7 8 -1

» X=fft(x') » X1=fft(x1')

X = X1 =
36.0000 4.0000
-9.6569 + 4.0000i 1.6569 + 4.0000i
-4.0000 - 4.0000i -4.0000 + 4.0000i
1.6569 - 4.0000i -9.6569 - 4.0000i
4.0000 36.0000
1.6569 + 4.0000i -9.6569 + 4.0000i
-4.0000 + 4.0000i -4.0000 - 4.0000i
-9.6569 - 4.0000i 1.6569 - 4.0000i

Then the DFT X1 of x1 is equal to the DFT X of x with the


swapping of the left and right halves.
Properties of 1-D DFT (con’d)
• Conjugate symmetry: If x is real, and of length
N, then its DFT X satisfies the condition
,where X k isX the
N k complex Xconjugate
N k of
X N  k out previous
for all k=1,2,3,…,N-1. (check
slide)
• Circular convolution: Suppose x and y are two
vectors of the same length N. Then we define
their convolution to be the vector,
z  x , where
y 1 N 1
zk   xn yk n
n n0
Example
1
z0  ( x0 y0  x1 y1  x2 y2  x3 y3 )
4
1
z1  ( x0 y1  x1 y0  x2 y1  x3 y2 )
4
1
z2  ( x0 y2  x1 y1  x2 y0  x3 y1 )
4
1
z3  ( x0 y3  x1 y2  x2 y1  x3 y0 )
4

 y0 y1 y2 y3 y0 y1 y2 y3 
  y0 y3 y2 y1 y0 y1 y2 y3 

Thus y1  y3 , y2  y2 , y3  y1


Properties of 1-D DFT (con’d)
• Circular convolution: can be defined in terms of
polynomial products.
– Suppose p(u) the polynomial in u whose coefficients are
elements of x. Let q(u) be the polynomial whose coefficients are
elements of y. From the product p(u)q(u)(1+uN), and extract the
coefficients of uN to u2N-1, these will be the required circular
convolution

– Example: x  [1, 2, 3, 4], y  [5, 6, 7,8]


we have p (u )  1  2u  3u 2 and
4u 3
q ( u )  5  6 u  7 u 2
 8u 3

Then we expand
p (u ) q (u )(1  u 4 )  5  16u  34u 2  60u 3  66u 4  68u 5  66u 6  60u 7  61u 8  52u 9  32u 10
Extracting the coefficients of u4,u5,…., u7 we obtain

x  y  [66, 68, 66, 60]


Importance of Convolution
• Suppose x and y are vectors of equal length. Then the DFT
of their circular convolution is equal to the element-by-
element product of the DFT's of x and y.
• If Z,X,Y are the DFT’s of z=x*y, x and y respectively, then
Z=X.Y
Example: » fft(cconv(a,b)') » fft(a').*fft(b')
ans = ans =
1.0e+002 *
1.0e+002 *
2.6000
2.6000 -0.0000 - 0.0800i
-0.0000 - 0.0800i 0.0400
0.0400 -0.0000 + 0.0800i
-0.0000 + 0.0800i
More on DFT
• In general, the transform into the frequency domain
will be a complex valued function, that is, with
magnitude and phase.
magnitude  Fu  Freal * Freal  Fimag * Fimag
 Fimag 
phase  tan  1

 Freal 
Fu  Fu exp i 
• The DC coefficient: The value F(0)
N 1 N 1
1 1
F ( 0) 
N

x 0
f x exp( 0) 
N
f
x 0
x

average of the input series.


Some Properties of
x
Transform Pair
1 u
• Scaling relationship: f    aF au ; f ax   F 
a a a
• Time Shift / Frequency Modulation:
f x  a   F u e i 2au / M ; f x e i 2ax / M  F u  a 
• The transform of a delta function at the origin is a
constant
Unit 1 N 1
1
impulse 1/N F u     x e i 2 ux N  
N x 0 N
f(x) F(u)
• The transform of a constant function is a DC value
only. N 1
 xu 
f x   exp  2i Fu
u 0  N

F(u)
f(x)
THANK YOU!

Digital Image Processing

You might also like