Dose anyone can help with PCA technique

How can PCA code reduce the dimension of image, if I have image with 128*128, after used PCA to compress image?

3 commentaires

M
M le 22 Nov 2017
PCA mainly relies on a singular value decomposition of your data, what is it exactly you want to achieve ?
Noor Abbas
Noor Abbas le 24 Nov 2017
Thanks for your answer M and KSSV

Connectez-vous pour commenter.

Réponses (1)

Image Analyst
Image Analyst le 22 Nov 2017

0 votes

Attached is a demo where I use it.

10 commentaires

Noor Abbas
Noor Abbas le 24 Nov 2017
many thanks Image Analst for your consideration, my question is if I have image with dimension 128*128, how PCA code reduction the dimension???
Image Analyst
Image Analyst le 24 Nov 2017
Get the PCs - 128 of them - and throw away the ones you don't want. Keep just 3 or 4 of them.
Noor Abbas
Noor Abbas le 26 Nov 2017
thanks Image Analyst for your reply, could you please explain more, don't understand
Image Analyst
Image Analyst le 26 Nov 2017
Let's say you had an array where you had one row for each person, and each column was a measurement. The measurements were height (in col1), weight (in col 2), cholesterol, A1C, blood pressure, age (in days), social security number, street address, credit card number, and number of followers on Facebook. Now you do PCA on those and get 10 PCs. Now, might find good correlation between the first 6, but the last 4 don't show any trend or correlation at all - essentially they're random with respect to the first 6 biometric measurements. So you could just use the first 6 PCs and ignore the last 4, thus achieving data reduction.
Noor Abbas
Noor Abbas le 27 Nov 2017
Many thanks for your consideration Image Analyst. I understand this example. what about image? for example if I have image with 256*256,and used the PCA. is the PCA will reduction the dimension of image? and what will happened with 256*256?
Image Analyst
Image Analyst le 27 Nov 2017
You have to have more than 1 feature. Like for the color image demo I gave you the features were the rad value, green value, and blue value at each pixel. For your image, is it grayscale? Or color? What are the features?
Noor Abbas
Noor Abbas le 27 Nov 2017
its a grayscale image
Image Analyst
Image Analyst le 27 Nov 2017
OK . . . but what about the last, and most important, question that I asked. What are your features?
Noor Abbas
Noor Abbas le 27 Nov 2017
what do you mean about features?
Image Analyst
Image Analyst le 27 Nov 2017
Like what are your distinguishing attributes? You can't have just one - the gray level - you need more than 1. Like when I did it in the demo for a color image we had 3 - the red value,the green value, and the blue value. You can't just take one measurement and do PCA. Like if you had the heights of your classmates, you can't just say "I want to do PCA on the list of heights" - it doesn't make sense. Just like you can't say "I want to do PCA on the gray levels". If you don't even know what your features are, then why do you think that PCA is the approach you want to use??? Are you just wanting to write a compressed image, like in JPG or PNG format or something?

Connectez-vous pour commenter.

Catégories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by