【图像检测】基于高斯模型实现人脸识别定位matlab代码

139 阅读3分钟

1 简介

为了解决计算机信息技术发展带来的商业贸易方面的安全问题,生物识别(特别是人脸识别技术)在商业贸易中起了重要的应用.本文通过设计基于高斯模型的人脸识别系统,采用图像转换计算相似度,采用A(CB,CR)计算颜色空间,肤色模型使用高斯模型进行人脸识别,基于先验知识进行二值化采用阈值分割法,采用水平方向,垂直方向投影等进行人脸定位,利用几何特征提取信息进行人脸检测.基于高斯模型的人脸识别系统能够满足用户对面部特征识别的需求,为移动支付、系统安全等场合提供良好的解决方法.

2 部分代码

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.

   imformats
end
% Hint: get(hObject, 'Value' ) returns push state of pushbutton5

3 仿真结果

4 参考文献

[1]周玮, 董全德, and 陈国龙. "基于高斯模型的人脸识别系统研究." 白城师范学院学报 08(2017):36-40.​

部分理论引用网络文献,若有侵权联系博主删除。

5 MATLAB代码与数据下载地址

见博客主页