Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

2/3/2012

1
Digital Signal Processing
Lecture 3
rd
Feb 2012
Engr. Dr. Imran Shafi
Iqra University Islamabad Campus
TA
Mr Ammar Ajmal
Lab sessions
2
COURSE GRADING POLICY
Assignments & Quizzes 20%
Late assignments are not accepted
Group assignment / project 5-10%
If not given, marks will be adjusted
elsewhere
3
elsewhere
Midterm exam 30-35%
As per University Schedule
Final exam 35-40%
As per University Schedule
IMPORTANT INFORMATION
IQRA LMS
Matlab intensive course
Operating Procedures
Your work in this class must be your own
If students are found to have collaborated
excessively or to have cheated (e.g. by copying or
sharing answers in assignments or during an
examination), all involved will at a minimum
receive grades of 0 for the first infraction
5
ece e g ades o 0 o t e st act o
Further infractions will result in failure in the
Course
No mutual discussion or talking in class
Mobile phones shall be switched off
Penalty is imposed if phone buzzes
Attendance will be taken in first 5 minutes
DSP Introduction
Application of mathematical operations
to digitally represented signals
IN OUT
A/D D/A DSP
-3 -2 -1 0 1 2 3 4
x[0]
x[1]
n
2/3/2012
2
General Introduction
Discrete Time Signal
sequence x[n]
- as opposed to continuous-time
signals x(t)
- time = independent variable
Examples
Discrete in Nature
- stock market indices
NasDaq daily closing value from Aug 1995 to Jan 1996
- population statistics
Birth in Canada from 1995-1996 to 1999-2000
Example
Sampled continuous-time (analog) signals
- Speech
Digital Images
2-D arrays (matrices) of numbers
Pixel Indexing in Matlab
The image
can be
unscramble
d using the
row and
column
permutation
The image
can be
unscramble
d using the
row and
column
permutation permutation
vectors, r &
c.
permutation
vectors, r &
c.
>>
>> xlabel('What is it?')
>> K(r,c,:) = J;
>> figure
>> image(K)
>> truesize
>> title('Yay!!!')
>> xlabel('Photo: Lawraa on
Flickr.com')
Color Transformations
(
(

218
222
222
(
(

185
222
222
(
(

114
122
17
(
(

106
227
236
(
(

103
171
240
(
(

160
171
240
(
(

171
121
17
(
(

166
230
240
(

103
(

160

(
(

u =
(
(

171
121
17
114
122
17

(
(

u =
(
(

218
222
222
185
222
222

(
(

u =
(
(

160
171
240
103
171
240

(
(

u =
(
(

166
230
240
106
227
236
Image aging: a transformation, u, that mapped:
2/3/2012
3
The Fourier Transform of an
Image
I |F{I}| Z[F{I}]
magnitude magnitude phase phase
Image size: 512x512
SD filter sigma = 8
Image size: 512x512
SD filter sigma = 8
Frequency Domain (FD) Filtering
Gaussian LPF in FD Gaussian LPF in FD Original Image Original Image Power Spectrum Power Spectrum
Image size: 512x512
SD filter sigma = 8
Image size: 512x512
SD filter sigma = 8
FD Filtering: Lowpass
Original Image Original Image Filtered Image Filtered Image Filtered Power Spectrum Filtered Power Spectrum
Image size: 512x512
FD notch sigma = 8
Image size: 512x512
FD notch sigma = 8
FD Filtering: Highpass
Original Image Original Image Filtered Image Filtered Image Filtered Power Spectrum Filtered Power Spectrum
Continuous Fourier
Transform
The continuous Fourier
transform assumes a
continuous image exists
in a finite region of an
infinite plane.
The continuous Fourier
transform assumes a
continuous image exists
in a finite region of an
infinite plane.
The BoingBoing Bloggers The BoingBoing Bloggers
Discrete Fourier Transform
The discrete Fourier
transform assumes a
digital image exists on a
closed surface, a torus.
The discrete Fourier
transform assumes a
digital image exists on a
closed surface, a torus.
2/3/2012
4
Read a Truecolor Image into Matlab Read a Truecolor Image into Matlab
Read a Truecolor Image into Matlab
Read a Truecolor Image into Matlab
Mark
Cory David
John Xeni
Crop the Image
First, select a
region using the
magnifier.
First, select a
region using the
magnifier.
left click here and hold left click here and hold
drag to here and release drag to here and release
Cut out a region
from the image
Crop the Image
From this close-up we
can estimate the
coordinates of the
region:
From this close-up we
can estimate the
coordinates of the
region:
rows: about 125 to 425 cols:
about 700 to 1050
rows: about 125 to 425 cols:
about 700 to 1050
2/3/2012
5
Crop the Image
Here it is: Here it is:
Now close the
other image
Now close the
other image
Crop the Image
Bring it to the front
using the figure
command,
Bring it to the front
using the figure
command,
Crop the Image
then type close at
the prompt.
then type close at
the prompt.
Double Exposure: Adding Two Images
Jim Woodring - Bumperillo
Mark Rayden The Ecstasy of Cecelia
Rayden Woodring The Ecstasy of Bumperillo (?)
>> cd 'D:\Classes\TLC456\Spring 2011\Graphics\matlab intro'
>> JW = imread('Jim Woodring - Bumperillo.jpg','jpg');
>> figure
>> image(JW)
>> truesize
>> title('Bumperillo')
>> xlabel('Jim Woodring')
>> MR = imread('Mark Ryden - The Ecstasy of Cecelia.jpg','jpg');
>> figure
>> image(MR)
Double Exposure: Adding Two Images
Example
Matlab
Code
Example
Matlab
Code
g ( )
>> truesize
>> title('The Ecstasy of Cecelia')
>> xlabel('Mark Ryden')
>> [RMR,CMR,DMR] = size(MR);
>> [RJW,CJW,DJW] = size(JW);
>> rb = round((RJW-RMR)/2);
>> cb = round((CJW-CMR)/2);>> JWplusMR = uint8((double(JW(rb:(rb+RMR-
1),cb:(cb+CMR-1),:))+double(MR))/2);
>> figure
>> image(JWplusMR)
>> truesize
>> title('The Ecstasy of Bumperillo')
>> xlabel('Jim Woodring + Mark Ryden')
Intensity Masking: Multiplying Two Images
Jim Woodring - Bumperillo
Mark Rayden The Ecstasy of Cecelia
Rayden Woodring Bumperillo Ecstasy (?)
2/3/2012
6
Intensity Masking: Multiplying Two Images
>> JW = imread('Jim Woodring - Bumperillo.jpg','jpg');
>> MR = imread('Mark Ryden - The Ecstasy of Cecelia.jpg','jpg');
>> [RMR,CMR,DMR] = size(MR);
>> [RJW,CJW,DJW] = size(JW);
>> rb = round((RJW-RMR)/2);
>> cb = round((CJW-CMR)/2);
>> JWplusMR = uint8((double(JW(rb:(rb+RMR-1),cb:(cb+CMR-
1),:))+double(MR))/2);
>> figure
Example
Matlab
Code
Example
Matlab
Code
>> figure
>> image(JWplusMR)
>> truesize
>> title('The Extacsy of Bumperillo')
>> xlabel('Jim Woodring + Mark Ryden')
>> JWtimesMR = double(JW(rb:(rb+RMR-1),cb:(cb+CMR-1),:)).*double(MR);
>> M = max(JWtimesMR(:));
>> m = min(JWtimesMR(:));
>> JWtimesMR = uint8(255*(double(JWtimesMR)-m)/(M-m));
>> figure
>> image(JWtimesMR)
>> truesize
>> title('EcstasyBumperillo')
Rotation
a n d m o t i o n b l u r
Image Warping
3 February 2012 33

You might also like