05-07-2013 01:17 PM
hi!
i have to get luminance image of an original image by applying pca on the originol one. i have done my work but here is a problem. i want to get luminance image by applying pca but the resultant image is not clear. here is the attached vi. would u plz see it and correct it for me? i have got the luminance image through many simple ways but i have to do this by pca. i think the problem is in the final result, the result of multiplication , i have to increase its values by some way. but i dont know that way.. kindly help me.
thnx in advanc
05-08-2013 05:50 PM
Hi Kitty14,
What exactly is the behavior you're seeing? Could you post some screenshots of the images that you're getting? It would also be helpful if you could describe the math that your program is doing, just looking at the block diagram, it's not immediately clear.
05-17-2013 12:08 AM
hi David.
i have to get luminance image by first getting pca coefficients and then doing some operation on these coefficient matrix.
here is the code in matlab. this is a function that i have called in original programe.
function [luminance] = PCA1(RGB)
% USAGE [luminance channel] = PCA1(RGB)
%
% INPUT
% RGB: rgb image
% OUTPUT
% luminance channel:
%
% from matrix representation to vector
r = RGB(:,:,1);
g = RGB(:,:,2);
b = RGB(:,:,3);
[rS cS d] = size(RGB);
rVec = r(:);
gVec = g(:);
bVec = b(:);
Ivec = cat(2,rVec,gVec,bVec);
% compute eigen vector
[eigenVec score eigenVal ts] = princomp(Ivec);
figure
imshow(eigenVec)
% the luminance is normalized to 1
V = eigenVec/(sum(eigenVec(:,1)));
figure
imshow(V)
% transformation from RGB to PCA representation
Bvec = Ivec*V;
% from vector representation to matrix
luminance = reshape(Bvec(:,1),rS,cS);
i have implemented it in lab view but the result is not clear.
here are the attachements. the first 1 shows u the originol image and result in matlab and 2nd shows the result that i have got in lab view by operating above vi.
plz help me asap.
thnx
kitty14
05-20-2013 12:53 PM
Hi Fairy55,
I would recommend taking a look at the documentation for the PCA VI. This should help you gain some insight as to what the PCA VI is actually doing behind the scenes. Then you should be able to reconcile the differences between your text based program and your LabVIEW program.
Since you already have the functionality coded up in Matlab, you might consider using a script node to bring the functionality into LabVIEW. I hope this helps!