【图像识别】基于Haar分类器实现五官定位matlab代码
1 简介
人脸检测是人脸分析的首要环节,其处理的问题是确认图像中是否存在人脸,如果存在则对人脸进行定位。人脸检测的应用领域相当广泛,是实现机器智能化的重要步骤之一。AdaBoost算法是1995年提出的一种快速人脸检测算法,是人脸检测领域里程碑式的进步,这种算法根据弱学习的反馈,适应性地调整假设的错误率,使在效率不降低的情况下,检测正确率得到了很大的提高。本文对影响AdaBoost人脸检测训练算法速度的至关重要的两方面:Haar特征和积分图的概念和理论进行了仔细的阐明。同时给出了AdaBoost的算法,并深入探讨了其中的一些关键问题——弱学习器的构造、选取等问题。本文还将AdaBoost训练出来的多个强分类器连接在一起,形成同时具备高检测率和低误识率的级联分类器——Haar分类器。最后用Haar分类器实现人脸检测并通过检测五官来检验检测结果。
图像目标的检测与识别向来是机器视觉领域的重要研究内容。其中,人脸图像信息的处理技术一直都是模式识别与机器视觉研究领域内关注的重要问题,是现阶段基于生物特征的身份识别技术的重要组成部分之一。作为人脸信息处理中的一项关键技术,人脸检测的应用背景已经远远超出了人脸识别系统的范畴,在身份验证、基于内容的图像检索、数字视频处理、视觉监测等方面都有着重要的应用价值。
人脸是一种完全开放的信息源,是图像和视频中最重要的视觉图像之一。通过人脸可以得到一个人的性别、年龄、表情和身份等个体信息。人脸分析的相关研究希望用户的身份、状态和意图的信息能够从图像中提取出来,然后由计算依此做出反应(比如通过观察用户脸部表情来分析心情并进行相应反应)。
人脸检测是指在输入图像中确定所有存在的人脸的位置、大小的过程。人脸识别或辨认、人脸定位以及人脸追踪等都与人脸检测密切相关。
早期的人脸识别算法都是在假设已经得到了一个正面人脸或者假设人脸很容易获得的前提下进行的,但是随着人脸分析应用范围的不断扩大和开发实际系统需求的不断提高,这种假设下的研究不再能满足需求。人脸检测开始作为独立的研究内容发展起来。
近年来出现了大量的人脸检测方法,其中Paul Viola和Michael Jones于2001年提出的Adaboost算法是第一个实时的人脸检测算法,从根本上解决了检测的速度问题,同时具有较好的识别效果。
本文研究AdaBoost人脸检测方法的训练流程,研究了Adaboost算法的实现步骤,设计并实现基于Haar分类器的人脸检测系统,并通过检测五官来检验检测结果。
2 部分代码
function varargout = gui(varargin) % GUI MATLAB code for gui.fig % GUI, by itself, creates a new GUI or raises the existing % singleton*. % % H = GUI returns the handle to a new GUI or the handle to % the existing singleton*. % % GUI('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in GUI.M with the given input arguments. % % GUI('Property','Value',...) creates a new GUI or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before gui_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to gui_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 gui% Last Modified by GUIDE v2.5 19-Dec-2016 02:28:04% Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ...'gui_Singleton', gui_Singleton, ...'gui_OpeningFcn', @gui_OpeningFcn, ...'gui_OutputFcn', @gui_OutputFcn, ...'gui_LayoutFcn', [] , ...'gui_Callback', []); if nargin && ischar(varargin{1})gui_State.gui_Callback = str2func(varargin{1}); endif nargout[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); elsegui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT% --- Executes just before gui is made visible. function gui_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 gui (see VARARGIN)% Choose default command line output for gui handles.output = hObject;% Update handles structure guidata(hObject, handles);% UIWAIT makes gui wait for user response (see UIRESUME) % uiwait(handles.figure1);% --- Executes during object creation, after setting all properties. function axes1_CreateFcn(hObject, eventdata, handles) % hObject handle to axes1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called set(hObject,'xTick',[]); % 去掉坐标轴 set(hObject,'ytick',[]); % 去掉坐标轴 set(hObject,'box','on'); % 去掉坐标轴 % Hint: place code in OpeningFcn to populate axes1% --- Executes during object creation, after setting all properties. function axes2_CreateFcn(hObject, eventdata, handles) % hObject handle to axes2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called set(hObject,'xTick',[]); % 去掉坐标轴 set(hObject,'ytick',[]); % 去掉坐标轴 set(hObject,'box','on'); % 去掉坐标轴 % Hint: place code in OpeningFcn to populate axes2% --- Executes during object creation, after setting all properties. function axes3_CreateFcn(hObject, eventdata, handles) % hObject handle to axes3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called set(hObject,'xTick',[]); % 去掉坐标轴 set(hObject,'ytick',[]); % 去掉坐标轴 set(hObject,'box','on'); % 去掉坐标轴 % Hint: place code in OpeningFcn to populate axes3% --- Executes during object creation, after setting all properties. function axes4_CreateFcn(hObject, eventdata, handles) % hObject handle to axes3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called set(hObject,'xTick',[]); % 去掉坐标轴 set(hObject,'ytick',[]); % 去掉坐标轴 set(hObject,'box','on'); % 去掉坐标轴 % Hint: place code in OpeningFcn to populate axes3% --- Executes during object creation, after setting all properties. function axes5_CreateFcn(hObject, eventdata, handles) % hObject handle to axes3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called set(hObject,'xTick',[]); % 去掉坐标轴 set(hObject,'ytick',[]); % 去掉坐标轴 set(hObject,'box','on'); % 去掉坐标轴 % Hint: place code in OpeningFcn to populate axes3% --- Executes during object creation, after setting all properties. function axes6_CreateFcn(hObject, eventdata, handles) % hObject handle to axes3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called set(hObject,'xTick',[]); % 去掉坐标轴 set(hObject,'ytick',[]); % 去掉坐标轴 set(hObject,'box','on'); % 去掉坐标轴 % Hint: place code in OpeningFcn to populate axes3% --- Executes during object creation, after setting all properties. function axes7_CreateFcn(hObject, eventdata, handles) % hObject handle to axes3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called set(hObject,'xTick',[]); % 去掉坐标轴 set(hObject,'ytick',[]); % 去掉坐标轴 set(hObject,'box','on'); % 去掉坐标轴 % Hint: place code in OpeningFcn to populate axes3function axes8_CreateFcn(hObject, eventdata, handles) % hObject handle to axes3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called set(hObject,'xTick',[]); % 去掉坐标轴 set(hObject,'ytick',[]); % 去掉坐标轴 set(hObject,'box','on'); % 去掉坐标轴 % Hint: place code in OpeningFcn to populate axes3function axes9_CreateFcn(hObject, eventdata, handles) % hObject handle to axes3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called set(hObject,'xTick',[]); % 去掉坐标轴 set(hObject,'ytick',[]); % 去掉坐标轴 set(hObject,'box','on'); % 去掉坐标轴 % Hint: place code in OpeningFcn to populate axes3function edit1_Callback(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit1 as text % str2double(get(hObject,'String')) returns contents of edit1 as a double% --- Executes during object creation, after setting all properties. function edit1_CreateFcn(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white'); endfunction edit2_Callback(hObject, eventdata, handles) % hObject handle to edit2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit2 as text % str2double(get(hObject,'String')) returns contents of edit2 as a double% --- Executes during object creation, after setting all properties. function edit2_CreateFcn(hObject, eventdata, handles) % hObject handle to edit2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white'); endfunction edit3_Callback(hObject, eventdata, handles) % hObject handle to edit3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit3 as text % str2double(get(hObject,'String')) returns contents of edit3 as a double% --- Executes during object creation, after setting all properties. function edit3_CreateFcn(hObject, eventdata, handles) % hObject handle to edit3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white'); end% --- Executes during object creation, after setting all properties. function pushbutton3_CreateFcn(hObject, eventdata, handles) % hObject handle to pushbutton3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns calledfunction edit4_Callback(hObject, eventdata, handles) % hObject handle to edit4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit4 as text % str2double(get(hObject,'String')) returns contents of edit4 as a double% --- Executes during object creation, after setting all properties. function edit4_CreateFcn(hObject, eventdata, handles) % hObject handle to edit4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white'); end% --- Executes on button press in radiobutton1. function radiobutton1_Callback(hObject, eventdata, handles) % hObject handle to radiobutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)% Hint: get(hObject,'Value') returns toggle state of radiobutton1% --- Executes on button press in radiobutton2. function radiobutton2_Callback(hObject, eventdata, handles) % hObject handle to radiobutton2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)% Hint: get(hObject,'Value') returns toggle state of radiobutton2
3 仿真结果
4 参考文献
[1]刘子源, 蒋承志. 基于OpenCV和Haar特征分类器的图像人数检测[J]. 辽宁科技大学学报, 2011(04):50-54.
【图像识别】基于Haar分类器实现五官定位matlab代码相关推荐
- 【图像识别】基于 Haar分类器实现五官定位matlab源码含 GUI
一.简介 1 Haar分类器的前世今生 人脸检测属于计算机视觉的范畴,早期人们的主要研究方向是人脸识别,即根据人脸来识别人物的身份,后来在复杂背景下的人脸检测需求越来越大,人脸检测也逐渐作为一个单独的 ...
- 基于Haar分类器的OpenCV人脸检测实例
一.人脸的Haar特征分类器是什么 人脸的Haar特征分类器就是一个XML文件,该文件中会描述人脸的Haar特征值.当然Haar特征的用途可不止可以用来描述人脸这一种,用来描述眼睛,嘴唇或是其它物体也 ...
- 【图像识别】基于计算机视觉实现红绿灯识别含Matlab代码
1 简介 交通信号灯控制主要是利用检测技术和传感技术来检测交通参数,以此为基础进行控制.在交通压力日渐增大的背景下,各个路口车流量不均衡的问题逐渐凸显出来,往往一边路口车流量较小而绿灯开启时间长,另一 ...
- 数字水印进阶篇——基于DWT-SVD的数字水印(附matlab代码)
引言 之前写过一篇介绍空间域LSB的数字水印算法,有需要的朋友可以看看 数字水印入门篇--空间域LSB的数字水印(附matlab代码) 因空间域的数字水印是通过直接在图像上改变像素的方式来隐藏水印信息 ...
- 【图像识别-指纹识别】指纹特征提取附matlab代码
1 内容介绍 一 指纹增强 采用Lin Hong等人提出的基于Gabor滤波的方法进行指纹增强,可分为以下步骤: 标准化:标准化是把图像的平均灰度和方差调整到预定的级别上,以减少脊线上的灰度差异,方 ...
- 【图像去噪】基于三边滤波器实现图像去噪附matlab代码
1 简介 近年来,随着计算机视觉领域的发展,雾天图像的清晰化问题逐渐成为该领域的研究热点.目前对于图像去雾技术的研究大体上可以分为两类[1]:基于大气散射物理模型的图像去雾方法和基于图像增强的去雾方法 ...
- 【背包问题】基于禁忌搜索算法求解背包问题附Matlab代码
1 内容介绍 设计了一种基于禁忌搜索的遗传算法,利用遗传算法提供的并行搜索主框架,结合禁忌算法的个体串行搜索方式,能扩大搜索空间,快速实现全局优化.把基于禁忌搜索的遗传算法与启发式方法相结合用来求解背 ...
- 【图像重建】基于遗传算法实现二值图像重建附matlab代码
1 内容介绍 图像质量的优劣对人类视觉和各种计算机视觉系统都十分重要,因此图像复原一直是数字图像处理的重要研究内容.作为图像复原的一个分支,超分辨率图像重建问题得到人们越来越多的关注.在视频监控.卫星 ...
- 【熵与特征提取】基于“信息熵”的特征指标及其MATLAB代码实现(功率谱熵、奇异谱熵、能量熵)
<三体>中对监听员的日常工作有这样一段描述: ...1379 号监听站已经存在了上千年,像这样的监听站,在三体世界中有⼏千个,它们全神贯注地聆听着宇宙间可能存在的智慧⽂明的信息... .. ...
最新文章
- UTF-8 BOM头
- 参加第六届ITAT C语言程序设计大赛复赛-----数学溃败
- 单引号和冒号不能存入mysql么_mysql单引号和双引号的用法
- react(87)--批量删除进行置空操作
- mysql redis教程_MySQL redis学习与应用
- Linux学习总结(49)——应当竭力避免在系统中运行的 Linux 命令
- 十四、View Port 2.0
- JAVA_JSP考勤带请假的管理系统
- Heartbeat配置方案
- 电脑tdr太低是什么意思_SOLIDWORKS TDR 错误解决办法
- iOS开发之NSLocalizedString,多个本地化语言(Xcode9.2)
- 会议__零碎知识点总结
- 《Java语言程序设计与数据结构》编程练习答案(第七章)(一)
- Oracle 对比两张表的数据是否一致
- 漫画人物头像总是画不好?快看看这些注意点你有没有中招!
- singleton模式 C++
- JDK8的Stream操作你还不会用吗?
- win10远程桌面连接ubuntu20(RDP)
- 汇编语言王爽课程设计二
- 外媒关注:中国版Twitter新浪微博推出微米对抗微信
热门文章
- 榜单发布!国产智能驾驶域控制器市场竞争力TOP10供应商
- 专家有料 | 张祖优:腾讯云DevSecOps实践与开源治理探索
- Java word转pdf Linux/windows跨平台 格式完美(利用命令行调用libreoffice)
- 【附源码】计算机毕业设计SSM民宿客房管理系统
- ie11加载项启用不了 java,IE11或IE10中的管理加载项按钮是灰色的不能用怎么办
- (solved)[/usr/bin/python2: No module named pip]
- List of problems to be solved
- 蓝桥杯之二阶魔方旋转
- RV1126RV1109 buildroot 增加串口屏测试
- python做个奶茶店程序