人工神经网络在图像处理与识别中的应用(翻译的IEEE英文原版(精) 下载本文

内容发布更新时间 : 2024/12/22 16:27:58星期一 下面是文章的全部内容请认真阅读。

function []=TwoDPCA % %%úce recognition clear all close all clc M=200; traincopy=3;

eignum=100;%%%选取100个特征值。 cel=cell(1,M; cellafter=cell(1,M; tt=clock; S=[]; ii=1;

str=strcat('E:\\人脸\\2dfacedatabase\\ORL\\s1\\1.pgm'; img=imread(str; [ia ib]=size(img; sum=zeros(ia,ib; B=zeros(ia,ib; for i=1:40

for j=1:5

str=strcat('E:\\人脸\\2dfacedatabase\\ORL\\s1\\1.pgm'; eval('img=imread(str;'; sum=double(sum+double(img; cel{1,ii}=img; ii=ii+1; end end

meanA=sum/M; cov=zeros(ib; for i=1:M img=cel{1,i};

B=double(img-double(meanA; temp=B'*B;

cov=double(cov+double(temp; end

[vv dd]=eig(cov; num2=size(vv;

% Sort and eliminate those whose eigenvalue is zero

v=[]; d=[];

for i=1:size(vv,2 if(dd(i,i>1e-4 v=[v vv(:,i]; d=[d dd(i,i]; end end

num1=size(v,2;

%sort, will return an ascending sequence [B index]=sort(d; ind=zeros(size(index; dtemp=zeros(size(index; vtemp=zeros(size(v; len=length(index; for i=1:len dtemp(i=B(len+1-i; ind(i=len+1-index(i; vtemp(:,ind(i=v(:,i; end

d=dtemp; v=vtemp; imgafter=[]; for i=1:M for j=1:eignum img=cel{1,i};

temp1=double(img*double(v(:,j; imgafter=[imgafter temp1]; end

cellafter{1,i}=imgafter; imgafter=[]; end

timeconsume=etime(clock,tt; testimg=M/traincopy; findimgnum=traincopy; suc=0; % figure(5; for k=1:testimg

InputImage =imread(strcat('E:\\人脸\\2dfacedatabase\\ORL\\s',int2str(k,'\\10.pgm';