【人脸识别】基于模板匹配算法实现人脸识别附matlab代码

1 简介

在一个 yale 人脸库中,有 15 个人,每人有 11 幅图像。要求选定每一个人的

若干幅图像组成样本库,由样本库得到特征库。再任取 yale 图像库的一张图片,

识别它的身份。

对于一幅图像可以看作一个由像素值组成的矩阵,也可以扩展开,看成一个

矢量。如一幅N*N象素的图像可以视为长度为N2的矢量,这样就认为这幅图像是

位于N2维空间中的一个点,这种图像的矢量表示就是原始的图像空间,但是这个

空间仅是可以表示或者检测图像的许多个空间中的一个。不管子空间的具体形式

如何,这种方法用于图像识别的基本思想都是一样的,首先选择一个合适的子空

间,图像将被投影到这个子空间上,然后利用对图像的这种投影间的某种度量来

确定图像间的相似度,最常见的就是各种距离度量。因此,本次采用PCA算法确

定一个子空间,最后使用最小距离法进行识别,并用matlab实现。

2 部分代码

clear;% % high resolution optical and sar matching%  im_Ref = imread('.\data\optical_ref.png');%  im_Sen = imread('.\data\SAR_sen.png');%  CP_Check_file = '.\data\OpticaltoSAR_CP.txt';% medium resolution optical and sar matching im_Ref = imread('.\data\Optical_ref2.tif'); im_Sen = imread('.\data\SAR_sen2.tif'); CP_Check_file = '.\data\OpticaltoSAR2_CP.txt';%lidar intensity and optical matching% im_Ref = imread('.\data\LiDARintensity_ref.tif');% im_Sen = imread('.\data\optical_sen.tif');% CP_Check_file = '.\data\LiDARtoOptical_CP.txt'; %visible and infrared image matching%im_Ref = imread('.\data\visible_ref.tif');%im_Sen = imread('.\data\infrared_sen.tif');%CP_Check_file = '.\data\VisibletoInfrared_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代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

matlab科研助手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值