91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

MATLAB下人臉圖像的PCA重構,用matlab實現,代碼完整高效。

資源截圖

代碼片段和文件信息

clear?all
%allsamples=zeros([11292400]);%所有圖像
image=zeros(112*92400);
%samples=zeros(11292400);
%for?i=1:40
?%???for?j=1:10
??%??????n=(i-1)*10+j;
???%?????allsamples(::n)=imread(strcat(‘E:\att_faces\s‘num2str(i)‘\‘num2str(j)‘.pgm‘));
????%end
%end
%save(‘400pictures.mat‘‘allsamples‘)
load(‘400pictures.mat‘);
for?l=1:112
????for?m=1:92
????????k=(m-1)*112+l;
????????image(k:)=allsamples(lm:);
????end
end
imgmean=mean(image2);?%?平均圖片
avg?=?reshape(imgmean?11292);
avg=uint8(avg);
figureimshow(avg)
for?n=1:400?
??diff(:n)?=?image(:n)-imgmean;?%?diff是訓練圖和平均圖之間的差值
end
covdiff=diff‘*diff;
[vd]=eig(covdiff);
d1=diag(d);
dsort?=?flipud(d1);
vsort?=?fliplr(v);
base?=?diff?*?vsort(::)?*?diag(dsort(:).^(-1/2));

figure
for?i=1:4
????for?j=1:5
????????t=(i-1)*5+j;
????????temp?=?reshape(base(:t)?11292);
????????MAX=max(max(temp));?????????????????%求出圖像矩陣中灰度值最大的值
????????MIN=min(min(temp));?????????????????%求出圖像矩陣中灰度值最小的值
????????temp(::)=(temp(::)-MIN)/(MAX-MIN)*255;??%歸一化后再映射到0-255
????????temp=uint8(temp);
????????subplot(45t)
????????imshow(temp)
????end
end

img1=‘E:\att_faces\s1\1.pgm‘;
test1=imread(img1);
combined1(:1)=test1(1:112*92);
combined1=double(combined1);
dis1=combined1-imgmean;
factor1=base‘*dis1;
t?=?199;
temp?=?base(:1:t)*factor1(1:t);
temp?=?temp?+?imgmean;
temp?=?reshape(temp?11292);
MAX=max(max(temp));?????????????????%求出圖像矩陣中灰度值最大的值
MIN=min(min(temp));?????????????????%求出圖像矩陣中灰度值最小的值
temp(::)=(temp(::)-MIN)/(MAX-MIN)*255;??%歸一化后再映射到0-255
temp=uint8(temp);
figureimshow(temp)

img2=‘E:\att_faces\s1\3.pgm‘;
test2=imread(img2);
combined2(:1)=test2(1:112*92);
combined2=double(combined2);
dis2=combined2-imgmean;
factor2=base‘*dis2;
distance1=factor1-factor2;?%投影系數相減
sqrt(sum(abs(distance1.*distance1)))

img3=‘E:\att_faces\s3\3.pgm‘;
test3=imread(img3);
combined3(:1)=test3(1:112*92);
combined3=double(combined3);
dis3=combined3-imgmean;
factor3=base‘*dis3;
distance2=factor1-factor3;?%投影系數相減
sqrt(sum(abs(distance2.*distance2)))

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????3712930??2014-05-30?03:03??MATLAB下人臉圖像的PCA重構\400pictures.mat

?????文件???????1579??1995-02-23?18:13??MATLAB下人臉圖像的PCA重構\att_faces\README

?????文件??????10318??1994-04-18?14:17??MATLAB下人臉圖像的PCA重構\att_faces\s1\1.pgm

?????文件??????10318??1994-04-18?14:07??MATLAB下人臉圖像的PCA重構\att_faces\s1\10.pgm

?????文件??????10318??1994-04-18?14:17??MATLAB下人臉圖像的PCA重構\att_faces\s1\2.pgm

?????文件??????10318??1994-04-18?14:17??MATLAB下人臉圖像的PCA重構\att_faces\s1\3.pgm

?????文件??????10318??1994-04-18?14:17??MATLAB下人臉圖像的PCA重構\att_faces\s1\4.pgm

?????文件??????10318??1994-04-18?14:17??MATLAB下人臉圖像的PCA重構\att_faces\s1\5.pgm

?????文件??????10318??1994-04-18?14:07??MATLAB下人臉圖像的PCA重構\att_faces\s1\6.pgm

?????文件??????10318??1994-04-18?14:07??MATLAB下人臉圖像的PCA重構\att_faces\s1\7.pgm

?????文件??????10318??1994-04-18?14:07??MATLAB下人臉圖像的PCA重構\att_faces\s1\8.pgm

?????文件??????10318??1994-04-18?14:07??MATLAB下人臉圖像的PCA重構\att_faces\s1\9.pgm

?????文件??????10318??1994-04-18?14:18??MATLAB下人臉圖像的PCA重構\att_faces\s10\1.pgm

?????文件??????10318??1994-04-18?14:07??MATLAB下人臉圖像的PCA重構\att_faces\s10\10.pgm

?????文件??????10318??1994-04-18?14:18??MATLAB下人臉圖像的PCA重構\att_faces\s10\2.pgm

?????文件??????10318??1994-04-18?14:18??MATLAB下人臉圖像的PCA重構\att_faces\s10\3.pgm

?????文件??????10318??1994-04-18?14:18??MATLAB下人臉圖像的PCA重構\att_faces\s10\4.pgm

?????文件??????10318??1994-04-18?14:18??MATLAB下人臉圖像的PCA重構\att_faces\s10\5.pgm

?????文件??????10318??1994-04-18?14:07??MATLAB下人臉圖像的PCA重構\att_faces\s10\6.pgm

?????文件??????10318??1994-04-18?14:07??MATLAB下人臉圖像的PCA重構\att_faces\s10\7.pgm

?????文件??????10318??1994-04-18?14:07??MATLAB下人臉圖像的PCA重構\att_faces\s10\8.pgm

?????文件??????10318??1994-04-18?14:07??MATLAB下人臉圖像的PCA重構\att_faces\s10\9.pgm

?????文件??????10318??1994-04-18?14:18??MATLAB下人臉圖像的PCA重構\att_faces\s11\1.pgm

?????文件??????10318??1994-04-18?14:07??MATLAB下人臉圖像的PCA重構\att_faces\s11\10.pgm

?????文件??????10318??1994-04-18?14:18??MATLAB下人臉圖像的PCA重構\att_faces\s11\2.pgm

?????文件??????10318??1994-04-18?14:18??MATLAB下人臉圖像的PCA重構\att_faces\s11\3.pgm

?????文件??????10318??1994-04-18?14:18??MATLAB下人臉圖像的PCA重構\att_faces\s11\4.pgm

?????文件??????10318??1994-04-18?14:18??MATLAB下人臉圖像的PCA重構\att_faces\s11\5.pgm

?????文件??????10318??1994-04-18?14:07??MATLAB下人臉圖像的PCA重構\att_faces\s11\6.pgm

?????文件??????10318??1994-04-18?14:07??MATLAB下人臉圖像的PCA重構\att_faces\s11\7.pgm

............此處省略419個文件信息

評論

共有 條評論