四川师范大学本科毕业设计人脸检测与裁剪系统的设计与实现学生姓名院系名称计算机科学学院专业名称软件工程班级学号指导教师完成时间2016年5月10日人脸检测与裁剪系统的设计与实现内容摘要:本设计旨在开发一个从静态图像中检测人脸及对检测到的人脸图像进行归一化的软件系统,具体内容包括:1.学习OpenCV库函数的调用和内在原理及相关编程环境,掌握使用该库的库函数和接口。在学习过程中了解人脸图像归一化的目和归一化的主要内容与方法。制定了本设计采用的归一化方案,编程实现归一化算法,实现一个基于OpenCV的人脸检测和图像归一化系统。2.研究了人脸检测原理和算法,学习了OpenCV内部封装的人脸人眼检测的算法原理。自己编程实现了一种基于人类皮肤颜色特征的人脸检测算法并对人眼检测方法中的灰度投影法进行了学习和改进。实现了手动定位人眼在图像中的位置,然后根据双眼位置进行人脸图像旋转和裁剪的归一化方法。3.本文首先概述人脸检测研究背景、人脸检测的必要性、现状及发展趋势。然后介绍了OpenCV人脸检测算法和肤色人脸检测算法的原理和数学模型。之后对本设计实现的人脸检测和裁剪系统的总体设计方案和详细设计方案进行了论述。最后利用KNN最近邻分类器,对归一化前后的人脸图像进行了人脸识别实验。实验结果显示,利用本系统可以有效地进行人脸检测和归一化,归一化步骤可以提高人脸识别率。关键词:OpenCV人脸检测肤色人眼检测人脸归一化ThedesignandimplementationoffacedetectionandcuttingsystemAbstract:Thispaperaimsatdevelopafacedetectionandanormalizationsystem.1.LearningTheOpenCV(anopencomputervisionlibrary)andtheprogrammingenvironment,masteringthelibrary’sfunctionsandinterface.Getthepurposeofnormalizingandlearnsomeimportantmethodandalgorithm.Aschemeabouttheimplementonthissystemshouldbemade.ThenimplementthedetectionsystembaseonOpenCVlibrary,andfinishanormalizationalgorithmbymyself.2.IlearnsomeinternalencapsulationbasedonOpenCVbyresearchingsamefacedetectionalgorithmofOpenCV.DuringthestudyIearnedtheimportantoffaceDetection.SoIplantoimplementonedetectionalgorithmbaseonskincolorandimprovethehumaneyeLocationmethodnamed3.gray-levelprojectionmethod.Themanualpositioningofthehumaneyepositionwascompleted,andthenrotatingandcuttingaccordingtothebinocularlocation.4.FirstofallIwillgiveabriefdescribethehistory,presentsituationandthetrendoffacedetectioninthefutureInthepaper.ThentheprincipleandmathematicalmodeloftwokindsoffacedetectionalgorithmsbasedonOpenCVandskincolormustbeexplained.Afterthatthispapertalkabouttheoveralldesignofthesystemdesignanddetaildesignofthissystem.Finally,usethenearestneighborclassifier,recognizethebeforeandafternormalizedfaceimage.theexperimentprovesthattheafternormalizedfacerecognitionratehigherthantheotherone.Keywords:OpenCVfacedetectionskincoloreyeLocationnormalizationI目录1概述..............................................................11.1研究目的和意义..............................................11.2研究背景....................................................11.2.1国内现状..............................................11.2.2国外现状..............................................11.3文章的结构..................................................22预备知识及原理说明................................................22.1人脸检测定义................................................32.2人脸特点和人脸开检测的意义..................................32.2.1人脸的自然特性........................................32.2.2进行人脸检测与裁剪必要性..............................32.3一些常用的人脸检测技术......................................42.3.1基于显性特征人脸检测..................................42.3.2基于隐式特征人脸检测..................................42.4本章小结....................................................53XFace系统总体设计................................................53.1XFace系统设计..............................................53.1.1XFace系统框图........................................53.2功能说明....................................................53.2.1读取显示文件..........................................53.2.2人脸检测..............................................63.2.3检测结果归一化........................................63.2.4归一化结果保存........................................63.3本章小结....................................................64XFace系统详细设计................................................64.1XFace系统总体设计..........................................64.1.1XFace系统流程........................................64.1.2XFace系统的功能模块..................................74.2XFace系统算法详细描述......................................84.2.1OpenCV人脸检测法详细描述.............................84.2.2肤色检测模型详细描述.................................124.2.3归一化算法详细描述...................................144.3XFace系统详细设计.........................................184.3.1XFace系统关键类.....................................184.3.2XFace系统重要数据结构...............................194.4章小结.....................................................205XFace系统实现...................................................205.1OpenCV人脸检测模块实现....................................205.1.1EmguCV概述..........................................205.1.2EmguCV封装OpenCV...................................20II5.1.3EmguCV安装..........................................225.1.4OpenCV人脸定位......................................225.2肤色人脸检测模块实现......................................235.2.1二值化图像得到人脸候选区............................235.2.2候选肤色区域筛选....................................245.3归一化实现................................................245.3.1灰度投影法定位人眼..................................245.3.2旋转人脸图像........................................265.3.3裁剪归一化。........................................265.4本章小结..................................................266XFace系统运行...................................................276.1系统运行..................................................276.2XFace系统对人脸识别率的提高。.............................286.3本章小结..................................................287总结与展望.............