function varargout = untitled(varargin)
% UNTITLED MATLAB code for untitled.fig
% UNTITLED, by itself, creates a new UNTITLED or raises the existing
% singleton*.
%
% H = UNTITLED returns the handle to a new UNTITLED or the handle to
% the existing singleton*.
%
% UNTITLED('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in UNTITLED.M with the given input arguments.
%
% UNTITLED('Property','Value',...) creates a new UNTITLED or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before untitled_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to untitled_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help untitled
% Last Modified by GUIDE v2.5 10-Jul-2022 14:35:54
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @untitled_OpeningFcn, ...
'gui_OutputFcn', @untitled_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before untitled is made visible.
function untitled_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to untitled (see VARARGIN)
% Choose default command line output for untitled
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes untitled wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = untitled_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
fileName = '44.MP4';
%image_path=
obj = VideoReader(fileName);
numFrames = obj.NumberOfFrames;% 读取视频的帧数CurrentTime
for i = 1 : numFrames
axes(handles.axes1)
frame = read(obj,i);% 读取每一帧
imshow(frame);%显示每一帧
namestyle=sprintf('%06d',i);
imwrite(frame,strcat('1/',namestyle,'.png'),'png');% 保存每一帧
%imwrite(frame,strcat(num2str(i),'.png'),'png');% 保存每一帧
end
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
aj=[]
%img=imread('sy.jpg');
n=1;%input('请输入开始检测的帧');
m=132;%input('请输入结束检测的帧');
for ix=n:7
img=imread(['1\00000',num2str(ix),'.png']);
axes(handles.axes2)
img=img;%(1:size(img,1)*0.78,1:end,:);
%img=imresize(img);%(1:size(img,1)*0.38,1:end);
imshow(rgb2gray(img));title('Original IMG');
hold on
detector = vision.CascadeObjectDetector;
release(detector);
detector.ClassificationModel='RightEye';
detector.MergeThreshold=134;%适当增加合并阈值
bboxes=detector(img);
LeftEye=insertObjectAnnotation(img,'rectangle',bboxes,'RightEye');
%figure(5);subplot(211);imshow(LeftEye);title('LeftEye');
release(detector);
if ix==1
ss1=bboxes;
end
if size(bboxes,1)>1
s1=bboxes(1,2);
s2=bboxes(1,4);
s3=bboxes(1,1);
s4=bboxes(1,3);
d=(img(s1:s1+s2,s3:s3+s4,:));
%imshow(d)
%rectangle('Position',[s1,s2,s3,s4]);%,'Curvature',cur) %adds curvature to the sides
rectangle('Position',[s2,s1,s4,s3],...
'LineWidth',2,'LineStyle','-')
else
bboxes=ss1;
s1=bboxes(1,2);
s2=bboxes(1,4);
s3=bboxes(1,1);
s4=bboxes(1,3);
d=(img(s1:s1+s2,s3:s3+s4,:));
%imshow(d)
%rectangle('Position',[s1,s2,s3,s4]);%,'Curvature',cur) %adds curvature to the sides
rectangle('Position',[s2,s1,s4,s3],...
'LineWidth',2,'LineStyle','-')
pause(0.01)
end
imwrite(d,['ee1\',num2str(ix),'.jpg']);
%else
% imwrite(d,['ee1\',num2str(ix-1),'.jpg']);
%end
end
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
aj1=[]
%img=imread('sy.jpg');
for ix=1:6
d=imread(['ee1\',num2str(ix),'.jpg']);
[d1,d2,d3]=size(d)
d=rgb2gray(d);
%imshow(d)
%RightEye=im2bw(img(176:176+34,515:515+57,:),0.8);
%imshow(d)
eyes=imresize(d,[35 35]);
% 显示原始图像
axes(handles.axes3)
%imshow(eyes);
%drawnow;
% 伽马增强+反色处理+形态学闭运算平滑连通域
%figure%axes(handles.axes3);
se=5;
eyes_gamma=imadjust(eyes,[],[],0.960);
eyesBin=1-imbinarize((eyes_gamma),0.3);
eyesBin=imclose(eyesBin,se);
imshow(eyesBin);
title('eye')
drawnow;
% 提取最大连通域即人眼的虹膜区域
%figure%axes(handles.axes3);
% 提取最大连通域
[L num]=bwlabel(eyesBin,8);
maxL=mode(L(L~=0));
eyesBin(find(L~=maxL))=0;
% 提取虹膜的矩形边界
[r c]=find(eyesBin==1);
minX=min(c);
maxX=max(c);
minY=min(r);
maxY=max(r);
if max(eyesBin)==0
minX=16;
maxX=16;
minY=16;
maxY=16;
end
% 计算虹膜区域的均值中心
Xmean=mean([minX,maxX]);
Ymean=mean([minY,maxY]);
y1=abs(minY-maxY);
% 绘制定位经纬线
target=eyesBin;
target(:,minX)=1;
target(:,maxX)=1;
target(minY,:)=1;
target(maxY,:)=1;
axes(handles.axes4)
imshow(target);
%if y1<5
%title(strcat('eye1=',num2str(y1),' ,疲劳'))
%else
% title(strcat('eye1=',num2str(y1),' ,不疲劳'))
%end
%hold on,
%plot(Xmean,Ymean,'Marker','*','MarkerSize',13,'MarkerEdgeColor','r','MarkerFaceColor','r'),
%hold off;
aj1=[aj1,y1];
% 显示klt追踪
%era/article/details/92149411
end
axes(handles.axes5)
save aj1.mat aj1
title(['显示的疲劳概率为',num2str(3/7)])
dd=sort(aj1)
axes(handles.axes6)
plot(dd,'-*')
title('眼睛的开度数值')
没有合适的资源?快使用搜索试试~ 我知道了~
基于GUI的设计 眼睛开度 眼睛定位 疲劳监测系统
共136个文件
png:121个
jpg:7个
m:5个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 14 浏览量
2022-07-10
14:41:41
上传
评论 1
收藏 14.48MB RAR 举报
温馨提示
基于GUI的设计 眼睛开度 眼睛定位 疲劳监测系统
资源推荐
资源详情
资源评论
收起资源包目录
基于GUI的设计 眼睛开度 眼睛定位 疲劳监测系统 (136个子文件)
untitled.fig 99KB
2.jpg 2KB
6.jpg 2KB
5.jpg 2KB
4.jpg 2KB
7.jpg 2KB
3.jpg 2KB
1.jpg 2KB
untitled.m 7KB
Copy_of_Untitled3.m 2KB
dui7777.m 1KB
Untitled3.m 406B
dui444.m 372B
aj1.mat 180B
44.mp4 104KB
000116.png 152KB
000115.png 152KB
000114.png 151KB
000113.png 151KB
000117.png 151KB
000096.png 150KB
000097.png 150KB
000094.png 150KB
000093.png 150KB
000112.png 149KB
000095.png 149KB
000111.png 149KB
000091.png 149KB
000092.png 149KB
000090.png 149KB
000110.png 149KB
000089.png 148KB
000106.png 148KB
000107.png 148KB
000108.png 147KB
000109.png 147KB
000105.png 147KB
000104.png 147KB
000121.png 146KB
000103.png 146KB
000102.png 146KB
000101.png 145KB
000100.png 144KB
000099.png 143KB
000098.png 143KB
000119.png 143KB
000120.png 143KB
000118.png 141KB
000046.png 128KB
000047.png 128KB
000007.png 128KB
000019.png 128KB
000018.png 128KB
000013.png 128KB
000014.png 128KB
000026.png 128KB
000038.png 128KB
000045.png 128KB
000030.png 128KB
000022.png 128KB
000042.png 128KB
000004.png 128KB
000025.png 128KB
000032.png 128KB
000029.png 128KB
000043.png 128KB
000008.png 128KB
000039.png 128KB
000015.png 128KB
000017.png 128KB
000044.png 128KB
000023.png 128KB
000037.png 128KB
000006.png 128KB
000010.png 128KB
000031.png 128KB
000020.png 128KB
000011.png 128KB
000021.png 128KB
000041.png 128KB
000012.png 128KB
000009.png 128KB
000016.png 128KB
000033.png 128KB
000028.png 128KB
000024.png 128KB
000005.png 128KB
000040.png 128KB
000027.png 128KB
000036.png 128KB
000003.png 128KB
000035.png 128KB
000002.png 128KB
000034.png 127KB
000001.png 127KB
000087.png 109KB
000081.png 109KB
000075.png 109KB
000083.png 109KB
000073.png 109KB
共 136 条
- 1
- 2
资源评论
matlab_python22
- 粉丝: 148
- 资源: 128
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功