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 19-May-2020 15:25:06
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @untitled_OutputFcn, ...
'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_OutputFcn(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.
%-------------------------------------- pushbutton1_Callback(回调函数)
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
global im imycbcr skin1 skin2 lpf %----------------宣布为全域变量
% 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)
if get (gcbo, 'Value' ) ==1;
im=imread('10.jpg' ) ; %------------------------------读入彩色图像
axes(handles.axes1)
set(handles.axes1, 'XMinorTick' , 'on' ) %-------------嵌入Axes(1) 回调函数
imshow(im) ; %------------------------------显示彩色图像
else
imformats
end
% Hint: get(hObject, ' Value' ) returns push state of togglebutton1
%-------------------------------------- pushbutton2_Callback(回调函数)
% --- 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)
global im imycbcr skin1 skin2 lpf %----------------宣布为全域变量
if get (gcbo, 'Value' ) ==1;
imycbcr = rgb2ycbcr(im) ; %------------------------转换为YCbCr颜色空间
axes(handles. axes2)
set(handles. axes2, 'XMinorTick','on' ) %-------------嵌入Axes(2) 回调函数
imshow(imycbcr) ; %----------------------显示YCbCr颜色空间图像
else
imformats
end
% Hint: get(hObject, 'Value' ) returns push state of pushbutton2
%-------------------------------------- pushbutton3_Callback(回调函数)
% --- 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)
global im imycbcr skin1 skin2 lpf %----------------宣布为全域变量
if get (gcbo, 'Value' ) ==1;
37
dim = size(im) ; % ------------------------- 求出图像大小
lpf = 1/9 * ones(3); %----------------------------低通滤波器模板
cb = imycbcr(: ,: ,2) ;
cb = filter2(lpf, cb) ;
cb = reshape(cb, 1, prod(size(cb) ) ) ;
cr = imycbcr(: , : , 3) ;
cr = filter2(lpf, cr) ;
cr = reshape(cr, 1, prod(size(cr) ) ) ;
bmean = mean(cb) ; %--------------------------------求平均值
rmean = mean(cr) ;
brcov = cov(cb, cr) ;
skin1 = zeros(dim(1) , dim(2) ) ;
for i = 1: dim(1)
for j = 1: dim(2)
cb = double(imycbcr(i, j, 2) ) ;
cr = double(imycbcr(i, j, 3) ) ;
x =[(cb-bmean);(cr-rmean)] ;
skin1(i,j) = exp(-0.5*x'*inv(brcov)*x) ; %---------------------------------计算任意像素为皮肤的概率
end
end
skin1 = filter2(lpf, skin1) ;
skin1 = skin1./max(max(skin1) ) ;
axes(handles. axes3)
set(handles. axes3, 'XMinorTick' , 'on' ) %-------------嵌入Axes(3) 回调函数
imshow(skin1) ; %------------------------------显示皮肤概率图像
else
imformats
end
% Hint: get(hObject, ' Value' ) returns push state of pushbutton3
%-------------------------------------- pushbutton4_Callback(回调函数)
% --- 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)
global im imycbcr skin1 skin2 lpf %----------------宣布为全域变量
if get (gcbo, 'Value' ) ==1;
38
%-----------------------------------------自适应门限值处理过程
previousSkin2 = zeros(size(skin1,1),size(skin1,2)) ;
changelist = [] ;
for threshold = 0.55: -0.1: 0.05
skin2 = zeros(size(skin1,1),size(skin1,2)) ;
skin2(find(skin1>threshold)) = 1;
change = sum(sum(skin2 - previousSkin2) ) ;
changelist = [changelist change] ;
previousSkin2 = skin2;
end
%----------------------------------找出最佳门限值
[C, I] = min(changelist) ;
optimalThreshold = (7-I) *0.1;
skin2 = ones(size(skin1,1),size(skin1,2)) ;
skin2(find(skin1>optimalThreshold))= 0;
skin2 = filter2(lpf, skin2) ; %------------------------中值滤波
axes(handles.axes5)
set(handles. axes5, 'XMinorTick','on' ) %-------------嵌入Axes(4) 回调函数
imshow(skin2); %------------------------------显示皮肤二值化图像
else
imformats
end
% Hint: get(hObject, ' Value' ) returns push state of pushbutton4
%-------------------------------------- pushbutton5_Callback(回调函数)
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global im imycbcr skin1 skin2 lpf %----------------宣布为全域变量
if get (gcbo, 'Value' ) ==1;
sumarea = bwarea(skin2) ; %-----------计算对象的总面积, 为利用面积进行判别做准备
[L,numobj] =bwlabel(skin2, 8) ;
avearea = sumarea/numobj; %-----------计算出对象的平均面积
A = zeros(4, numobj) ;%179
n = 1;
%-----------------------------------根据特征对每个标记进行判别, 找出人脸区域
for m=1: numobj
% ---------------------------------计算区域坐标
[x, y] = find(bwlabel(skin2) == m) ;
% ------------------------获得一副只包含该区域的图像, 让图像其他区域为黑色
bwsegment = bwselect(skin2, y, x, 8) ;
% --------------------- 计算出该区域内分割块的数目
[L, numobjs] = bwlabel(bwsegment, 4) ;
% --------------
没有合适的资源?快使用搜索试试~ 我知道了~
【人脸识别】基于matlab GUI高斯模型人脸识别定位【含Matlab源码 674期】.zip
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共4个文件
jpg:2个
m:1个
fig:1个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 18 浏览量
2023-11-27
21:58:55
上传
评论
收藏 113KB ZIP 举报
温馨提示
CSDN海神之光上传的代码均可运行,亲测可用,直接替换数据即可,适合小白; 1、代码压缩包内容 主函数:main.m; 调用函数:其他m文件;无需运行 运行结果效果图; 2、代码运行版本 Matlab 2019b;若运行有误,根据提示修改;若不会,私信博主; 3、运行操作步骤 步骤一:将所有文件放到Matlab的当前文件夹中; 步骤二:双击打开main.m文件; 步骤三:点击运行,等程序运行完得到结果; 4、仿真咨询 如需其他服务,可私信博主或扫描博客文章底部QQ名片; 4.1 博客或资源的完整代码提供 4.2 期刊或参考文献复现 4.3 Matlab程序定制 4.4 科研合作 人脸表情识别:LBP+LPQ算法融合人脸表情识别、PCA+SVM人脸表情识别 人脸识别:BP神经网络人脸识别、KL变换人脸识别、LBP人脸识别、PCA+SVM人脸识别、PCA人脸识别、人数统计
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![thumb](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
共 4 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/22c46cb7417b40989d92d67df86b9fff_tiqcmatlab.jpg!1)
![avatar-vip](https://csdnimg.cn/release/downloadcmsfe/public/img/user-vip.1c89f3c5.png)
海神之光
- 粉丝: 3w+
- 资源: 2114
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)