-
Notifications
You must be signed in to change notification settings - Fork 0
/
cut_eyeleftregion.asv
46 lines (46 loc) · 1.16 KB
/
cut_eyeleftregion.asv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
%% Ham cat ra vung chua mat trai
% Dau vao :
% Image : Anh dau vao.
% Center : Trung tam cua vung da khuan mat.
% Dau ra :
% ima : Anh dau ra la vung chua mat trai.
% C : Do lech so voi anh goc
%By : Nguyen Van Linh
% SipLab_K52, Dien tu vien thong, Dai hoc Bach Khoa Ha Noi
function [eyeleftregion,C]=cut_eyeleftregion(Image,face,Center)
m = Center(1);
n = Center(2);
nImage = size(Image,1);
mImage = size(Image,2);
cut = 0;
if((m>160) & (n>110) & ((m+10)<mImage) & ((n+20)<nImage))
eyeleft = face((n-110):(n+20),(m-160):(m+10),:);
eyeleft_cut = Image((n-110):(n+20),(m-160):(m+10),:);
cut = 1;
else
eyeleft = face;
eyeleft_cut = Image;
cut = 0;
end
if cut==1
C1 = n-110;
C2 = m-160;
else
C1 = 0;
C2 = 0;
end
C = [C1,C2];
[p,q] = size(eyeleft);
%eyeleftregion = uint8(cat(3,zeros(p,q),zeros(p,q),zeros(p,q)));
%for i=1:p
% for j=1:q
% if(eyeleft(i,j)==1)
% for k=1:3
% eyeleftregion(i,j,k) = eyeleft_cut(i,j,k);
% end
% end
% end
%end
eyeleft
imshow(eyeleftregion), title('eyeleft_cut')
clearvars m n nImage mImage cut