Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
abhaysingh200009@gmail.com

Posts: 3
Registered: 3/7/14
Inverse PCA
Posted: Mar 7, 2014 12:53 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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)
%img = imread('E:\ms.jpg');
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


hp=imread('E:\pan.jpg');
original=inv(abhi)*pcaoutput;
%origin=transpose(original)+m1;
imshow(original);




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

Thank you..



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.