Sei sulla pagina 1di 16

Digital Signal Processing (Lab)

Lab Report # 03: Z-Transform and image feature extractions


Lab Instructor: Sir Fawad

Objective
• To know the pole and zeros position of a discrete-time system
• To identify the stability of a system from pole zeros position
• Extraction of images from the various folder in the database
• To extract edges of the objects in the images
• To write the flow chart and introduction of the assigned projects.

Task # 01

Find pole and zero position of the following Transfer function:

a. H(Z) = 2𝑍^−2 − 5𝑍^−1+10/𝑍^−2 +𝑍^−1 + 1


b. H(Z) = 𝑍^−2 – 𝑍^−1+0/𝑍^−2 +𝑍^−1 + 34

c. H(Z) = 10𝑍^−2 +20/𝑍^−2 +5𝑍^−1


Part (a)

Code

clc

clear all

sys=tf([2 5 -10] , [1 1 1]);

p = pole(sys)
r = zero(sys)
a=pzplot(sys)

Output

Submitted By
Syed Hassan Sohail
16-TE-79
Digital Signal Processing (Lab)
Lab Report # 03: Z-Transform and image feature extractions
Lab Instructor: Sir Fawad

Part (b)

Code

clc
clear all
sys=tf([1 -1 0] , [1 1 34]);
q = pole(sys)
s = zero(sys)
b=pzplot(sys)

Submitted By
Syed Hassan Sohail
16-TE-79
Digital Signal Processing (Lab)
Lab Report # 03: Z-Transform and image feature extractions
Lab Instructor: Sir Fawad

Output

Part (c)

Code

clc
clear all
sys=tf([10 0 20] , [1 5 0]);
Submitted By
Syed Hassan Sohail
16-TE-79
Digital Signal Processing (Lab)
Lab Report # 03: Z-Transform and image feature extractions
Lab Instructor: Sir Fawad

m = pole(sys)
t = zero(sys)
c=pzplot(sys)

Output

Task # 02
Submitted By
Syed Hassan Sohail
16-TE-79
Digital Signal Processing (Lab)
Lab Report # 03: Z-Transform and image feature extractions
Lab Instructor: Sir Fawad

Find the Transfer function of the following difference equation also show their pole zero plot:
a. y(n-2) + 5y(n-1) = x(n-2) + 10x(n-1)
b. 3y(n-2) + y(n-1) =10 x(n-2) + 10x(n-1)
Part (a)
Code

clc
clear all
%part 1
sys=tf([1 10 0] , [1 5 0]);
c=sys;
p = pole(sys)
r = zero(sys)
a=pzplot(sys)

Output

Submitted By
Syed Hassan Sohail
16-TE-79
Digital Signal Processing (Lab)
Lab Report # 03: Z-Transform and image feature extractions
Lab Instructor: Sir Fawad

Part (b)

Code

sys=tf([10 10 0] , [3 1 0]);
d=sys;
q = pole(sys)
s = zero(sys)
b=pzplot(sys)
Output

Submitted By
Syed Hassan Sohail
16-TE-79
Digital Signal Processing (Lab)
Lab Report # 03: Z-Transform and image feature extractions
Lab Instructor: Sir Fawad

Task # 03

Create 2 folders each folder must contain at least 5 images. Read all images through Demo.m
file. Extract edges of the objects in the images using a canny detector.

Submitted By
Syed Hassan Sohail
16-TE-79
Digital Signal Processing (Lab)
Lab Report # 03: Z-Transform and image feature extractions
Lab Instructor: Sir Fawad

Code

clc
clear all;
close all;
Train_Feature=[];
Train_Label=[];
Dataset='data';
files=ls(Dataset)
files(1,:)=[]
files(1,:)=[]
%length(files)
for i=1:size(files,1)
files2=strcat(Dataset,'\',files(i,:))
files3=ls(files2)
files3(1,:)=[]
files3(1,:)=[]
for j=1:size(files3,1)
files4=strcat(files2,'\',files3(j,:))
%files5=ls(files4)
a=imread(files4);
I=imresize(a,[600,600]);
imshow(I)
pause(3)
G=rgb2gray(I);
A=edge(G,'Canny');
imshowpair(I,A,'montage')
end
end

Output
Submitted By
Syed Hassan Sohail
16-TE-79
Digital Signal Processing (Lab)
Lab Report # 03: Z-Transform and image feature extractions
Lab Instructor: Sir Fawad

Submitted By
Syed Hassan Sohail
16-TE-79
Digital Signal Processing (Lab)
Lab Report # 03: Z-Transform and image feature extractions
Lab Instructor: Sir Fawad

Submitted By
Syed Hassan Sohail
16-TE-79
Digital Signal Processing (Lab)
Lab Report # 03: Z-Transform and image feature extractions
Lab Instructor: Sir Fawad

Submitted By
Syed Hassan Sohail
16-TE-79
Digital Signal Processing (Lab)
Lab Report # 03: Z-Transform and image feature extractions
Lab Instructor: Sir Fawad

Submitted By
Syed Hassan Sohail
16-TE-79
Digital Signal Processing (Lab)
Lab Report # 03: Z-Transform and image feature extractions
Lab Instructor: Sir Fawad

Task # 04

Create 2 folders each folder must contain at least 5 images. Read all images through Demo.m
file. Extract HoG features of each image and save that feature as the .mat file in your directory.

Submitted By
Syed Hassan Sohail
16-TE-79
Digital Signal Processing (Lab)
Lab Report # 03: Z-Transform and image feature extractions
Lab Instructor: Sir Fawad

Code

clc
clear all;
close all;
Train_Feature=[];
Train_Label=[];
Dataset='data';
files=ls(Dataset)
files(1,:)=[]
files(1,:)=[]
%length(files)
for i=1:size(files,1)
files2=strcat(Dataset,'\',files(i,:))
files3=ls(files2)
files3(1,:)=[]
files3(1,:)=[]
for j=1:size(files3,1)
files4=strcat(files2,'\',files3(j,:))
%files5=ls(files4)
a=imread(files4);
I=imresize(a,[600,600]);
imshow(I)
pause(2)
G=rgb2gray(I);
F= extractHOGFeatures(G);
Train_Feature=[Train_Feature;F];
if(files(i,:)=='1')
Train_Label=[Train_Label;1];
else
Train_Label=[Train_Label;0];
Submitted By
Syed Hassan Sohail
16-TE-79
Digital Signal Processing (Lab)
Lab Report # 03: Z-Transform and image feature extractions
Lab Instructor: Sir Fawad

end
%pause(1)
end
end
save('Train_Feature','Train_Feature')
save('Train_Label','Train_Label')

Output

Task # 05

Draw a flow chart of your project in power point.

Submitted By
Syed Hassan Sohail
16-TE-79
Digital Signal Processing (Lab)
Lab Report # 03: Z-Transform and image feature extractions
Lab Instructor: Sir Fawad

Submitted By
Syed Hassan Sohail
16-TE-79

Potrebbero piacerti anche