turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- NI Discussion Forums
- :
- Most Active Hardware Boards
- :
- Machine Vision
- :
- pca implemetation on an image

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

04-23-2013 03:05 PM

hi, i want to perform pca on an image to get luminance image. i have done the same thing in matlab and now want to implement it in labview. but i m so confused,,, i have used imaqcolorimagetoarray vi to convert image first to array and then apply pca on it... but the array of rgb image is a 2d matrix but in matlab it is a 3d matrix,, the result of pca here and princomp in matlab is also different ... plz tell me how can i get it,, thnx ,, here is the code for pca in matlab

it is a function that is called in the original program ....

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);

% the luminance is normalized to 1

V = eigenVec/(sum(eigenVec(:,1)));

% transformation from RGB to PCA representation

Bvec = Ivec*V

% from vector representation to matrix

luminance = reshape(Bvec(:,1),rS,cS)

plz help me as i m new in labview :-(

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

04-23-2013 09:57 PM

The easiest way to get the luminance plane is to call IMAQ ExtractColorPlanes or IMAQ ExtractSingleColorPlane.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

04-24-2013 10:06 AM

yup i kow thai is easiest way, but problem is that i have to get luminance image by applying PCA

is there any method to apply PCA on an image directly

i have first change the image in array form but that is a 2d array but in matlab that is 3d array for an image how can i get a 3d array of an image direct.. where the 3rd dimension shows the RGB values

plz plz help me

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

04-29-2013 02:16 PM

why nobody replied me ??????//

plzzzzzzzzzzzzzzzz tell me

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

04-29-2013 03:22 PM

You can use a combination of IMAQ ExtractColorPlanes, IMAQ ImagetoArray, IMAQ ColorImagetoArray and NI_AALPro.lvlib:Eigenvalues and Vectors (located in the Mathematics>>Linear Algebra palette) to implement the algorithm you described.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

04-30-2013 08:32 AM

thnx

but what is the ni-aalprovi?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

04-30-2013 09:25 AM

NI_AALPro.lvlib refers to the Advanced Analysis LabVIEW Library that the VI belongs to. You can find it in the Mathematics>>Linear Algebra palette.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

04-30-2013 01:29 PM

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 usee it and correct it for me?

thnx in advance..