Professional Documents
Culture Documents
Mc ch:
Vn dng cc kin thc l thuyt v s dng Matlab trong cng vic ca mnh.
Cng vic:
1. Ti nh mu ln v
hin th
a = 'D:\lena.jpeg';
figure(1), imshow(a);
2. Chuyn nh mu
sang nh xm v hin
th
a = 'D:\lena.jpeg';
b = imread(a);
c = rgb2gray(b);
b = imread(a);
figure,imshow(c);
c = rgb2gray(b);
3. Tnh Histogram ca
nh xm v hin th
figure,imhist(c);
a = 'D:\lena.jpeg';
im_green = im;
im_blue = im;
im_green(:,:,3) = 0;
figure, imshow(im_green);
% Blue channel only
im_blue(:,:,1) = 0;
im_blue(:,:,2) = 0;
figure, imshow(im_blue);
c = rgb2gray(b);
a = 'D:\lena.jpeg';
d = im2bw(c);
im=imread(a);
im_red = im;
figure(5),imshow(d5);
h6 = fspecial('motion');
d6 = imfilter(c,h6);
figure(6),imshow(d6);
h7 = fspecial('prewitt');
d7 = imfilter(c,h7);
figure(7),imshow(d7);
h8 = fspecial('sobel');
d8 = imfilter(c,h8);
figure(8),imshow(d8);
e = bwperim(c);
I=rgb2gray(i);
for i=1:10
figure(3),imshow(e);
BW=im2bw(I);
y1=1;y2=c;
figure,imshow(BW)
for j=1:10
SE =
strel('arbitrary',eye(5));
9. Dng connect
component trn nh (c
thm ti liu v connect
component): mc ch l
khoanh vng cc i
tng trn nh sau khi
chuyn sang nh
phn.
d = imerode(c,SE);
a = 'D:\lena.jpeg';
x1=1;x2=r;
figure(2),imshow(d);
s=r*c;
a = 'D:\lena.jpeg';
b = imread(a);
c = im2bw(b,0.5);
figure(1),imshow(c);
%%%%% minimisation
of background portion
a = 'D:\lena.jpeg';
b = imread(a);
c = rgb2gray(b);
d = edge(c,'sobel');
figure, imshow(d);
if (y2<=c | y2>=9*c)
| (x1==1 | x2==r*10)
[n1 n2]=size(BW);
r=floor(n1/10);
c=floor(n2/10);
loc=find(BW(x1:x2,
y1:y2)==0);
[o p]=size(loc);
pr=o*100/s;
if pr<=100
BW(x1:x2,
y1:y2)=0;
end
x1=x1+r; x2=x2+r;
end
r1=x1;r2=x2;s1=y1;s2=y2
figure,imshow(BW)
;
pr1=0;
end
imshow(BW);
end
y1=y1+c;
y2=y2+c;
%%%%% detection of
face object
L = bwlabel(BW,8);
BB = regionprops(L,
'BoundingBox');
BB1=struct2cell(BB);
[s1 s2]=size(BB2);
end
mx=0;
figure,imshow(I);
for k=3:4:s2-1
hold on;
p=BB2(1,k)*BB2(1,k+1);
rectangle('Position',[BB2(
1,j-2),BB2(1,j1),BB2(1,j),BB2(1,j+1)],'E
dgeColor','r' )
if p>mx &
(BB2(1,k)/BB2(1,k+1))<1.
8
a
mx=p;
j=k;
end
BB2=cell2mat(BB1);
10. Bt u tm hiu phng php tr nn pht hin i tng chuyn ng, s p dng vo bi tp 2.
(bi tp ny lm trong 1 tun k t hm nay, tun sau s kim tra tng ngi, nu c thay i s thng
bo li)
V nh gi mn hc:
1.
2.
Kim tra gia k s kim tra vit tt c cc ni dung trn lp, chia lp thnh 02 nhm nh.
3. Kim tra cui k: mi ngi lm 1 ng dng x l nh, chun b tng t by gi, s trao i thm
trn lp, c th cc hng: pht hin i tng chuyn ng, loi b bng (shadow), theo vt i tng
chuyn ng, nhn dng ch ci, ch s, nhn dng i tng s dng trong khu bp nh cc, chn,
a,; nhn dng tri cy, nhn dng bin bo giao thng, nhn dng xe my, nhn dng t,
Mi thc mc th th lin lc c gii p.