资源简介
这是完整可运行的MATLAB代码写的表情识别代码。
代码片段和文件信息
% Tolga Birdal‘s original code is heavily modified by Md. Iftekhar Tanveer
% (go2chayan@gmail.com)
% Modifications by Md. Iftekhar Tanveer:
% code optimized for the following assumptions:
% 1. Only one face in scene and it is the primary object
% 2. Faster noise reducion and face detection
% Originaly by Tolga Birdal
% Implementation of the paper:
% “A simple and accurate face detection algorithm in complex background“
% by Yu-Tang Pai Shanq-Jang Ruan Mon-Chau Shie Yi-Chi Liu
% Additions by Tolga Birdal:
% Minimum face size constraint
% Adaptive theta thresholding (Theta is thresholded by mean2(theata)/4
% Parameters are modified by to detect better. Please check the paper for
% parameters they propose.
% Check the paper for more details.
% usage:
% I=double(imread(‘c:\Data\girl1.jpg‘));
% detect_face(I);
% The function will display the bounding box if a face is found.
function [aaSN_fillFaceDat]=detect_face(I)
close all;
% No faces at the beginning
Faces=[];
numFaceFound=0;
I=double(I);
H=size(I1);
W=size(I2);
%%%%%%%%%%%%%%%%%% LIGHTING COMPENSATION %%%%%%%%%%%%%%%
C=255*imadjust(I/255[0.3;1][0;1]);
% figureimshow(C/255);
% title(‘Lighting compensation‘);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%% EXTRACT SKIN %%%%%%%%%%%%%%%%%%%%%%
YCbCr=rgb2ycbcr(C);
Cr=YCbCr(::3);
S=zeros(HW);
[SkinIndexRowSkinIndexCol] =find(10 for i=1:length(SkinIndexRow)
S(SkinIndexRow(i)SkinIndexCol(i))=1;
end
m_S = size(S);
S(m_S(1)-7:m_S(1):) = 0;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%% REMOVE NOISE %%%%
% figure;imshow(S);
SN=zeros(HW);
for i=1:H-5
for j=1:W-5
localSum=sum(sum(S(i:i+4 j:j+4)));
SN(i:i+5 j:j+5)=(localSum>20);
end
end
% figure;imshow(SN);
Iedge=edge(uint8(SN));
% figure;imshow(Iedge);
SE = strel(‘square‘9);
SN_edge = (imdilate(IedgeSE));
%
% SN_edge = SN_edge1.*SN;
% figure;imshow(SN_edge);
SN_fill = imfill(SN_edge‘holes‘);
% figure;imshow(SN_fill);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%% FIND SKIN COLOR BLOCKS %%%%
[LlenRegions] = bwlabel(SN_fill4);
AllDat = regionprops(L‘BoundingBox‘‘FilledArea‘);
AreaDat = cat(1 AllDat.FilledArea);
[maxArea maxAreaInd] = max(AreaDat);
FaceDat = AllDat(maxAreaInd);
FaceBB = [FaceDat.BoundingBox(1)FaceDat.BoundingBox(2)...
FaceDat.BoundingBox(3)-1FaceDat.BoundingBox(4)-1];
aa=imcrop(rgb2gray(uint8(I)).*uint8(SN_fill)FaceBB);
% figureimshow(aa);
% title(‘Identified Face‘);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2753 2009-04-22 23:01 EigenFace\detect_face.m
文件 1033707 2009-04-20 15:11 EigenFace\EigenFace.ctf
文件 5763 2009-04-20 14:43 EigenFace\EigenFace.m
文件 11524 2009-04-20 15:11 EigenFace\EigenFace.xex
文件 33261 2009-04-22 23:08 EigenFace\ex
文件 1018 2009-04-20 13:49 EigenFace\LabelFile.txt
文件 1364 2009-05-20 11:30 EigenFace\license.txt
文件 1818 2009-04-20 16:25 EigenFace\README- How to Run.txt
文件 56944 2009-04-18 10:17 EigenFace\Test\Image001.jpg
文件 57198 2009-04-18 10:17 EigenFace\Test\Image002.jpg
文件 57554 2009-04-18 10:17 EigenFace\Test\Image003.jpg
文件 56881 2009-04-18 10:17 EigenFace\Test\Image004.jpg
文件 56004 2009-04-18 10:17 EigenFace\Test\Image005.jpg
文件 48005 2009-04-18 10:17 EigenFace\Test\Image006.jpg
文件 56704 2009-04-18 10:17 EigenFace\Test\Image007.jpg
文件 57739 2009-04-18 10:17 EigenFace\Test\Image008.jpg
文件 56293 2009-04-18 10:17 EigenFace\Test\Image009.jpg
文件 57995 2009-04-18 10:17 EigenFace\Test\Image010.jpg
文件 57025 2009-04-18 10:17 EigenFace\Test\Image011.jpg
文件 58108 2009-04-18 10:17 EigenFace\Test\Image012.jpg
文件 56482 2009-04-18 10:17 EigenFace\Test\Image013.jpg
文件 54871 2009-04-18 10:17 EigenFace\Test\Image014.jpg
文件 56865 2009-04-18 10:17 EigenFace\Test\Image015.jpg
文件 57803 2009-04-18 10:17 EigenFace\Test\Image016.jpg
文件 56164 2009-04-18 10:17 EigenFace\Test\Image017.jpg
文件 55699 2009-04-18 10:17 EigenFace\Test\Image018.jpg
文件 57196 2009-04-18 10:17 EigenFace\Test\Image019.jpg
文件 57335 2009-04-18 10:17 EigenFace\Test\Image020.jpg
文件 58031 2009-04-18 10:17 EigenFace\Test\Image021.jpg
文件 57715 2009-04-18 10:17 EigenFace\Test\Image022.jpg
............此处省略67个文件信息
相关资源
- 结构分析中的有限元法与Matlab程序设
- 车牌识别带有设计报告,图片,Matl
-
《Matlab Simuli
nk与控制系统仿真》. - MATLAB App Designer 教程.pdf
- Matlab绘图总结二维,三维显示等
- 基于Matlab的光学实验仿真
- matlab实现sift算法匹配
- matlab分水岭
- 《MATLAB程序设计教程(第二版)》-电
- 基于MATLAB的MEMS表面形貌重构
- matlab最优潮流
- 数字图像课程设计MATLAB实现简单找茬
- 粗糙集属性约简matlab
- Apriori算法matlab代码实现,带数据集和
- MATLAB_2014b(64位)补丁文件crack
- 基于matlab的人脸识别271850
- 机器视觉论文基于matlab的间单图像处
- 生物建模与仿真之matlab部分
- lle算法详解及matlab代码实现
- 基于matlab的模糊边缘检测
- 系统辨识大牛Ljung编写的MATLAB系统辨识
- 基于matlab的指纹识别系统271063
- 高斯混合模型matlab代码&文章讲解
- 2D2DPCA人脸识别matlab代码/ORL库
- PCA人脸识别MATLAB代码/ORL库
- matlab mcmc tutorial
- 三相全控整流桥仿真模型+报告+文献
- 基于matlab体绘制技术的医学影像三维
- 深度学习和matlab源代码
- 《MATLAB优化算法案例分析与应用》随
评论
共有 条评论