-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuoctinhtrongconnguoi.asv
30 lines (30 loc) · 1.48 KB
/
uoctinhtrongconnguoi.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
%% Chuong trinh nay lam viec voi cac con nguoi
% Tinh ra dien tich cua bon vung duoc chia tu tam cua con nguoi
% Tinh ra vec to giua tam cua con nguoi va dom sang trong con nguoi
% Dau vao :
% box : Anh co chua mat
% C1_iris : Toa do hang cua tam con nguoi
% C2_iris : Toa do cot cua tam con nguoi
% C3_iris : Ban kinh cua tam con nguoi
% Dau ra :
% connguoi : Anh con nguoi duoc cat
% anpha : Goc hop boi tam con nguoi va dom sang
% area1,area2,area3,area4 : Dien tich bon vung duoc noi o tren
% By : Nguyen Van Linh
% SipLab_K52, Dien tu vien thong, Dai hoc Bach Khoa Ha Noi.
function [connguoi,anpha,area1,area2] = uoctinhtrongconnguoi(box,C1_iris,C2_iris,C3_iris)
% Dau tien cat ra vung con nguoi
connguoi = box((C1_iris-C3_iris):(C1_iris+C3_iris),(C2_iris-C3_iris):(C2_iris+C3_iris),:);
connguoi = im2double(rgb2gray(connguoi));
connguoi1 = connguoi;
sizeconnguoi = size(connguoi);
square = (-1)*connguoi;
square(round(sizeconnguoi(1)/4):round(3*sizeconnguoi(1)/4),round(sizeconnguoi(1)/4):round(3*sizeconnguoi(1)/4)) = 0;
connguoi = connguoi + square;
connguoi = im2bw(connguoi,graythresh(connguoi));
[connguoi,domsang] = maxregion(connguoi);
[anpha,rho] = cart2pol([round(sizeconnguoi(1)/2),round(sizeconnguoi(1)/2)],domsang);
area1 = connguoi1(1:round(sizeconnguoi(1)/2),1:sizeconnguoi(1));
area2 = connguoi1(round(sizeconnguoi(1)/2):sizeconnguoi(1),1:sizeconnguoi(1));
area1 = mean(mean(area1(:)));
area2 = mean(mean(area2(:)));