⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eyecrop_testim.m

📁 用人工神经网络进行人脸识别
💻 M
字号:
function [lefteye,righteye,Img] = eyecrop_testim(im)

% USAGE: this function allows the user to select and crop
% the desired eye area.

imshow(im);title('RIGHT click the cursor on the pupil (left eye)');
[clefteye,rlefteye,Plefteye] = impixel;

Mleft = imrect(im,clefteye-14,rlefteye-14,clefteye+15,rlefteye+15);

imshow(Mleft);
pause(2);

leye_lefttopx=clefteye-14;
leye_lefttopy=rlefteye-14;
leye_rightbottomx=clefteye+15;
leye_rightbottomy=rlefteye+15;

lefteye = im(leye_lefttopy:leye_rightbottomy,leye_lefttopx:leye_rightbottomx);
% adj_imleft = imadjust(lefteye,[0.4 0.6],[0.1 0.9]);

imshow(lefteye);
save lefteye;
pause(2);

% ----------------
imshow(Mleft);title('RIGHT click the cursor on the pupil (right eye)');
[crighteye,rrighteye,Prighteye] = impixel;

Mright = imrect(Mleft,crighteye-14,rrighteye-14,crighteye+15,rrighteye+15);

imshow(Mright);
pause(2);
right_lefttopx=crighteye-14;
right_lefttopy=rrighteye-14;
right_rightbottomx=crighteye+15;
right_rightbottomy=rrighteye+15;

righteye = im(right_lefttopy:right_rightbottomy,right_lefttopx:right_rightbottomx);
% adj_imright = imadjust(righteye,[0.4 0.6],[0.1 0.9]);

imshow(righteye);
save righteye;
pause(2);
imshow(Mright);
pause(2);

% get eyedistance------------
 Img = imline(Mright, clefteye, rlefteye, crighteye, rrighteye);
 imshow(Img);
 pause(2);
 
 euclidist_probe = sqrt((crighteye-clefteye).^2+(rrighteye-rlefteye).^2)
 disp(['The Euclidean distance between the eyes is ',num2str(euclidist_probe)]);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -