好文档 - 专业文书写作范文服务资料分享网站

基于matlab的人脸识别技术

天下 分享 时间: 加入收藏 我要投稿 点赞

ProjectedTestImage = Eigenfaces'*Difference; % 测试图像的特征向量 Euc_dist = [];

for i = 1 : Train_Number%对每列

q = ProjectedImages(:,i);%取出训练图像

temp = ( norm( ProjectedTestImage - q ) )^2;%欧氏距离 Euc_dist = [Euc_dist temp];% end

[Euc_dist_min , Recognized_index] = min(Euc_dist);%得到差值最小的图像的索引号 OutputName = strcat(int2str(Recognized_index),'.jpg');%得到文件名

Example.m

% A sample script, which shows the usage of functions, included in % PCA-based face recognition system (Eigenface method) %

% See also: CREATEDATABASE, EIGENFACECORE, RECOGNITION clear all clc

close all

% You can customize and fix initial directory paths

TrainDatabasePath = uigetdir('D:\\人脸库\\PCA_based Face Recognition System',... 'Select training database path' );

TestDatabasePath = uigetdir('D:\\人脸库\\\\PCA_based Face Recognition System',... 'Select test database path');

prompt = {'Enter test image name (a number between 1 to 10):'}; dlg_title = 'Input of PCA-Based Face Recognition System'; num_lines= 1; def = {'1'};

TestImage = inputdlg(prompt,dlg_title,num_lines,def);

TestImage = strcat(TestDatabasePath,'\\',char(TestImage),'.jpg'); im = imread(TestImage);

T = CreateDatabase(TrainDatabasePath); [m, A, Eigenfaces] = EigenfaceCore(T);

OutputName = Recognition(TestImage, m, A, Eigenfaces); SelectedImage = strcat(TrainDatabasePath,'\\',OutputName); SelectedImage = imread(SelectedImage); imshow(im) title('测试图像');

figure,imshow(SelectedImage); title('识别图像');

str = strcat('Matched image is : ',OutputName); disp(str)

11

基于matlab的人脸识别技术

ProjectedTestImage=Eigenfaces'*Difference;%测试图像的特征向量Euc_dist=[];fori=1:Train_Number%对每列q=ProjectedImages(:,i);%取出训练图像temp=(norm(ProjectedTe
推荐度:
点击下载文档文档为doc格式
9h52p3lgq252amw9lhr375cln2z0an008fk
领取福利

微信扫码领取福利

微信扫码分享