【人脸识别】基于模板匹配算法实现人脸识别附matlab代码
【人脸识别】基于模板匹配算法实现人脸识别附matlab代码
TT_Matlab
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,完整matlab代码或者程序定制加qq1575304183。
1 简介
在一个 yale 人脸库中,有 15 个人,每人有 11 幅图像。要求选定每一个人的
若干幅图像组成样本库,由样本库得到特征库。再任取 yale 图像库的一张图片,
识别它的身份。
对于一幅图像可以看作一个由像素值组成的矩阵,也可以扩展开,看成一个
矢量。如一幅N*N象素的图像可以视为长度为N 2 的矢量,这样就认为这幅图像是
位于N 2 维空间中的一个点,这种图像的矢量表示就是原始的图像空间,但是这个
空间仅是可以表示或者检测图像的许多个空间中的一个。不管子空间的具体形式
如何,这种方法用于图像识别的基本思想都是一样的,首先选择一个合适的子空
间,图像将被投影到这个子空间上,然后利用对图像的这种投影间的某种度量来
确定图像间的相似度,最常见的就是各种距离度量。因此,本次采用PCA算法确
定一个子空间,最后使用最小距离法进行识别,并用matlab实现。
2 部分代码
clear;
% % high resolution optical and sar matching
% im_Ref = imread(
’.dataoptical_ref.png’
);
% im_Sen = imread(
’.dataSAR_sen.png’
);
% CP_Check_file =
’.dataOpticaltoSAR_CP.txt’
;
% medium resolution optical and sar matching
im_Ref = imread(
’.dataOptical_ref2.tif’
);
im_Sen = imread(
’.dataSAR_sen2.tif’
);
CP_Check_file =
’.dataOpticaltoSAR2_CP.txt’
;
%lidar intensity and optical matching
% im_Ref = imread(
’.dataLiDARintensity_ref.tif’
);
% im_Sen = imread(
’.dataoptical_sen.tif’
);
% CP_Check_file =
’.dataLiDARtoOptical_CP.txt’
;
%visible and infrared image matching
%im_Ref = imread(
’.datavisible_ref.tif’
);
%im_Sen = imread(
’.datainfrared_sen.tif’
);
%CP_Check_file =
’.dataVisibletoInfrared_CP.txt’
;
disthre =
1.5
; % the threshod of match errors the deflaut
is
1.5
.
for
% high resolution image covering urban areas, we
%
should
set
it to a larger
threshod
(
such
as
2.0
).
% This
is
beccause that the geometric distortions between such images
%
is
very complicated, and the transfrom model used
%
by
us
(
such
as
projective model
) can only prefit
% the geometric distortion. Therefore, a larger threshod
% have the more flexibility
% template matching
using
DLSC
[CP_Ref,CP_Sen,CMR]
= DLSC_match(im_Ref,im_Sen,CP_Check_file,disthre);
x= sprintf(
’the correct match ratio is %4.3f’
,CMR);
disp(x)
%diplay the tie points
figure;
imshow(im_Ref),hold
on
;
plot(CP_Ref(:,
1
),CP_Ref(:,
2
),
’yo’
,
’MarkerEdgeColor’
,
’k’
,
’MarkerFaceColor’
,
’y’
,
’MarkerSize’
,
5
);hold
on
;
title(
’reference image’
);
figure;
imshow(im_Sen),hold
on
;
plot(CP_Sen(:,
1
),CP_Sen(:,
2
),
’yo’
,
’MarkerEdgeColor’
,
’k’
,
’MarkerFaceColor’
,
’y’
,
’MarkerSize’
,
5
);hold
on
;
title(
’sensed image’
);
3 仿真结果
4 参考文献
[1]罗鑫, 赵永进, 柳长春,等. 基于PCA算法人脸识别的matlab实现[J]. 科学技术创新, 2013, 000(002):103-104.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
-
2023年血糖新标准公布,不是3.9-6.1,快来看看你的血糖正常吗? 2023-02-07
-
2023年各省最新电价一览!8省中午执行谷段电价! 2023-01-03
-
GB 55009-2021《燃气工程项目规范》(含条文说明),2022年1月1日起实施 2021-11-07
-
PPT导出高分辨率图片的四种方法 2022-09-22
-
2023年最新!国家电网27家省级电力公司负责人大盘点 2023-03-14
-
全国消防救援总队主官及简历(2023.2) 2023-02-10
-
盘点 l 中国石油大庆油田现任领导班子 2023-02-28
-
我们的前辈!历届全国工程勘察设计大师完整名单! 2022-11-18
-
关于某送变电公司“4·22”人身死亡事故的快报 2022-04-26