资源简介
基于PCA的人脸识别定位,包含测试数据,真实可用

代码片段和文件信息
clc;
clear;
data = load(‘/Users/apple/Downloads/test.mat‘);
faces = data.FACES;
scale = 208/(max(max(faces)) - min(min(faces))); % normalize the image
faces = scale*(faces - min(min(faces)));
test = data.test;
figure;
imshow(test[]);
[rowscols] = size(test);
faces = faces‘;
[coeffscorelatenttsquare] = princomp(faces);
k = 1;
vector = zeros(121*1211600);
for i = 21 : rows - 19
for j = 21 : cols - 19
face_temp = test(i-20:i+19j-20:j+19);
vector(k:) = reshape(face_temp11600);
k = k + 1;
end
end
F = mean(faces);
P = coeff(:1:9);
x_tilde = zeros(146411600);
for i = 1 : 1600
for j = 1 : 14641
x_tilde(ji) = vector(ji) - F(1i);
end
end
score = x_tilde * P;
distance = ones(146411);
lambda = (1/6) * (sum(latent(1:61)));
rho = (1/3) * (sum(latent(7:91)));
for i = 1 : 14641
distance(i1) = sum(score(i1:6).^2)/lambda ...
+ (sum(x_tilde(i:).^2) - sum(score(i1:6).^2))/rho;
end
b = reshape(distance121121);
figure;
imshow(b[]);
title(‘distance‘ ‘FontSize‘ 15);
Pos = zeros(39);
% show the location of the faces identified
figure;
for i = 1:9
[rowcolval] = findPos(b);
Pos(1i) = row;
Pos(2i) = col;
Pos(3i) = val;
b = cleanNear(browcol);
subplot(33i);
imshow(b[]);
hold on;
plot(Pos(2i)Pos(1i)‘rs‘‘MarkerSize‘2);
end
figure;
imshow(test[]);
for i = 1 : 9
hold on;
plot(Pos(2i)+20Pos(1i)+20‘rs‘‘MarkerSize‘2);
end
% calculate the weight of the identified faces.
a = zeros(99);
k = 1;
for i = 1 : 9
row = Pos(1i);
col = Pos(2i);
subimage = test(row-20:row+19col-20:col+19);
subvector = reshape(subimage11600) - F;
a(k:) = subvector * coeff(:1:9);
k = k + 1;
end
% calculate the weight of the original training image.
g = zeros(99);
g(1:) = (faces(7:) - F) * coeff(:1:9);
g(2:) = (faces(4:) - F) * coeff(:1:9);
g(3:) = (faces(9:) - F) * coeff(:1:9);
g(4:) = (faces(8:) - F) * coeff(:1:9);
g(5:) = (faces(2:) - F) * coeff(:1:9);
g(6:) = (faces(6:) - F) * coeff(:1:9);
g(7:) = (faces(5:) - F) * coeff(:1:9);
g(8:) = (faces(1:) - F) * coeff(:1:9);
g(9:) = (faces(3:) - F) * coeff(:1:9);
% calculate the norm of the dfference between weights ai for each
% of the identified faces and the corresponding weights for the
%original training faces.
l = zeros(91);
for i = 1:9
temp = a(i:) - g(i:);
s = sum(temp.^2);
l(i1) = s^0.5;
end
% plot the distance vs.training face number
plot_dis = zeros(19);
plot_dis(11) = Pos(38);
plot_dis(12) = Pos(35);
plot_dis(13) = Pos(39);
plot_dis(14) = Pos(32);
plot_dis(15) = Pos(37);
plot_dis(16) = Pos(36);
plot_dis(17) = Pos(31);
plot_dis(18) = Pos(34);
plot_dis(19) = Pos(33);
figure;
plot(plot_dis);
title(‘distance vs training face number‘ ‘FontSize‘ 15);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-04-08 14:24 PCA浜鸿劯璇嗗埆\
文件 2879 2017-04-08 14:23 PCA浜鸿劯璇嗗埆\face_localization.m
目录 0 2017-04-08 14:24 __MACOSX\
目录 0 2017-04-08 14:24 __MACOSX\PCA浜鸿劯璇嗗埆\
文件 120 2017-04-08 14:23 __MACOSX\PCA浜鸿劯璇嗗埆\._face_localization.m
文件 41588 2017-03-31 10:43 PCA浜鸿劯璇嗗埆\faces.mat
文件 577 2017-03-31 10:43 __MACOSX\PCA浜鸿劯璇嗗埆\._faces.mat
文件 48847 2017-03-31 10:43 PCA浜鸿劯璇嗗埆\test.mat
文件 576 2017-03-31 10:43 __MACOSX\PCA浜鸿劯璇嗗埆\._test.mat
- 上一篇:HSMM程序matlab
- 下一篇:物体在空间中的运动轨迹预测
相关资源
- 读取txt文件内容matlab代码实现
- 细胞图像分割matlab代码
- 基于MP的时频分析MATLAB代码
- WCDMA matlab代码
- 图像降噪Matlab代码
- matlab人脸识别和特征提取
- 圣诞树(matlab代码)
- 心音信号处理分析(附matlab代码)
- Pattern Recognition and Machine Learning(高清
- 均值滤波和FFT频谱分析Matlab代码
- 欧拉放大论文及matlab代码
- GPS信号的码捕获matlab代码.7z
- 高光谱图像pca分析特征提取
- matlab读取SP3文件
- 图像的饱和度,亮度,色调的matlab代
- 肤色检测matlab代码
- sutton强化学习随书MATLAB代码
- pca源码matlab
- 压缩鬼成像matlab代码
- matlab人脸识别
- 压缩感知(Compressed Sensing CS)matlab代
- 基于OFDMA系统的多用户资源分配算法,
- PCA人脸识别Eigenface特征脸Matlab
- Allan方差分析MATLAB代码,含MPU6050八小
- 均匀球体剖面重力异常正演模拟Matl
- 印章识别matlab代码
- 连续潮流matlab代码
- 线性拟合仿真-最小二乘法、正交回归
- 矩阵填充MATLAB代码
- 大型飞机航拍图处理matlab代码
评论
共有 条评论