Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Topic: Inverse PCA
Replies: 2   Last Post: Jun 11, 2014 5:15 AM

 Messages: [ Previous | Next ]
 abhaysingh200009@gmail.com Posts: 3 Registered: 3/7/14
Inverse PCA
Posted: Mar 7, 2014 12:53 AM

Hello there, Iam a student of Engineering, from Pune University. I need some help to perform inverse PCA..

I have done up to here..

clc
clear all;
img=rand(4,4,3)
figure,imshow(img);

img1=img(:,:,1);
[m n]=size(img1);
%figure,imshow(img1);
img2=img(:,:,2);
%figure,imshow(img2);
img3=img(:,:,3);
%figure,imshow(img3);

%to get elements along rows we take imagg'
temp1=reshape(img1',m*n,1);
%figure,imshow(temp1);
temp2=reshape(img2',m*n,1);
%figure,imshow(temp2);
temp3=reshape(img3',m*n,1);
%figure,imshow(temp3);

I=[temp1 temp2 temp3];
figure,imshow(I);

%to get mean
m1=mean(I,2);
figure,imshow(m1);

%subtract mean
temp=double(I);
for i=1:3
I1(:,i)=(temp(:,i)-m1);
end
a1=double(I1);
figure(6),imshow(I1);

a=a1';
covv = a*a';

[eigenvec eigenvalue]=eig(covv);

abhi=eigenvalue;

eigenvalue = diag(eigenvalue);

[egn,index]=sort(-1*eigenvalue);

eigenvalue=eigenvalue(index);

eigenvec=eigenvec(:,index);
figure,imshow(eigenvec);

pcaoutput=a1*eigenvalue;

vt=transpose(eigenvalue);
for i=1:size(pcaoutput,2)
ima=reshape(pcaoutput(:,i)',n,m);
ima=ima';

imshow(ima,[]);
end

original=inv(abhi)*pcaoutput;
%origin=transpose(original)+m1;
imshow(original);

Iam performing PCA image fusion b/w MS & PAN Image.

Thank you..

Date Subject Author
3/7/14 abhaysingh200009@gmail.com
3/8/14 abhaysingh200009@gmail.com
6/11/14 Eddie Galarza