clc;
clear;
R =im2double(imread('C:\\Users\\STUDENT1\\Desktop\\364\\band1.gif'));
G =im2double(imread('C:\\Users\\STUDENT1\\Desktop\\364\\band2.gif'));
B =im2double(imread('C:\\Users\\STUDENT1\\Desktop\\364\\band3.gif'));
I =im2double(imread('C:\\Users\\STUDENT1\\Desktop\\364\\band4.gif'));
[a b]=size(R);
Image=zeros(a*b,4);
k=1;
for i=1:a
for j=1:b
Image(k,1)=R(i,j);
Image(k,2)=G(i,j);
Image(k,3)=B(i,j);
Image(k,4)=I(i,j);
k=k+1;
end
end
Mean=mean(Image);
Covariance=cov(Image);
[V D]=eig(Covariance);
k=1;
for i=1:512
for j=1:512
Final1(i,j)=V(:,1)'*Image(k,:)';
Final2(i,j)=V(:,2)'*Image(k,:)';
Final3(i,j)=V(:,3)'*Image(k,:)';
Final4(i,j)=V(:,4)'*Image(k,:)';
k=k+1;
end
end
subplot(2,2,1);
imshow(histeq(double(Final1)));
subplot(2,2,2);
imshow(histeq(double(Final2)));
subplot(2,2,3);
imshow(histeq(double(Final3)));
subplot(2,2,4);
imshow(histeq(double(Final4)));
clear;
R =im2double(imread('C:\\Users\\STUDENT1\\Desktop\\364\\band1.gif'));
G =im2double(imread('C:\\Users\\STUDENT1\\Desktop\\364\\band2.gif'));
B =im2double(imread('C:\\Users\\STUDENT1\\Desktop\\364\\band3.gif'));
I =im2double(imread('C:\\Users\\STUDENT1\\Desktop\\364\\band4.gif'));
[a b]=size(R);
Image=zeros(a*b,4);
k=1;
for i=1:a
for j=1:b
Image(k,1)=R(i,j);
Image(k,2)=G(i,j);
Image(k,3)=B(i,j);
Image(k,4)=I(i,j);
k=k+1;
end
end
Mean=mean(Image);
Covariance=cov(Image);
[V D]=eig(Covariance);
k=1;
for i=1:512
for j=1:512
Final1(i,j)=V(:,1)'*Image(k,:)';
Final2(i,j)=V(:,2)'*Image(k,:)';
Final3(i,j)=V(:,3)'*Image(k,:)';
Final4(i,j)=V(:,4)'*Image(k,:)';
k=k+1;
end
end
subplot(2,2,1);
imshow(histeq(double(Final1)));
subplot(2,2,2);
imshow(histeq(double(Final2)));
subplot(2,2,3);
imshow(histeq(double(Final3)));
subplot(2,2,4);
imshow(histeq(double(Final4)));
No comments:
Post a Comment