clc, clear, close all
a1=imread('000.bmp');[m,n]=size(a1);
dirname ='ImageChips';
files =dir(fullfile(dirname,'*.bmp'));
a=zeros(m,n,19);
c=zeros(m,n,19);
pic=[];for ii =1:length(files)
filename =fullfile(dirname,files(ii).name);a(:,:,ii)=imread(filename);
end
b=a/255;%先找到第一条
first=1;for ii=2:length(files)ifstd(b(:,1,ii))<std(b(:,1,first))
first=ii;
end
end
c(:,:,1)=b(:,:,first);
max_clum=zeros(1,length(files));for jj=1:length(files)-1for kk=1:length(files)
x=c(:,72,jj);
y=b(:,1,kk);
r1=sum((x-mean(x)).*(y-mean(y)));
r2=sqrt(sum((x-mean(x)).^2))*sqrt(sum((y-mean(y)).^2));
r=r1/r2;max_clum(kk)=r;
end
[max_count,index]=max(max_clum);c(:,:,jj+1)=b(:,:,index);
end
for mm=1:length(files)
pic=[pic,c(:,:,mm)];
end
imshow(pic,[]);