how PCA can be applied to an image to reduce its dimensionality with example?
Mostrar comentarios más antiguos
Dimensionality reduction
3 comentarios
Ameerah Omar
el 9 de Nov. de 2015
i run your code but it is not work with me this error in the picture in the file plz see it and tell me what is the wrong
SHEETAL AGRAWAL
el 14 de Sept. de 2021
Can I use PCA for grey scale images
Image Analyst
el 14 de Sept. de 2021
@SHEETAL AGRAWAL, perhaps. You obviously need at least two features. What would be your two features? Maybe gray level is one, but what is the other? Or do you just have two different features, like blob area and blob texture or brightness?
Respuesta aceptada
Más respuestas (7)
Devan Marçal
el 13 de Ag. de 2015
0 votos
Hi,
in your example you used PCA in just one image. I have an image bank a total of ~ 800 images. If I make a loop (if, while, etc ..) using the PCA function for each image individually, will be using this command wrong or inefficiently?
Thanks a lot.
Devan
8 comentarios
Image Analyst
el 14 de Ag. de 2015
No, it should work fine.
Newman
el 27 de Sept. de 2015
what if the image is binary??IN that case what changes will be on the code?
Image Analyst
el 27 de Sept. de 2015
I don't understand why you'd want to use PCA on a binary image or a single gray level image. Why do you? What are you trying to do? What are the two features? With gray scale and binary images there's only one feature - the gray level - unless you add more images or color channels, so I don't see how PCA can be applied.
Anim Hossain
el 6 de Abr. de 2018
hello. I'm new to the concept of PCA. I'm trying to develop something that can recognize color features from different images. Is it possible to do it with the help of PCA?
Image Analyst
el 6 de Abr. de 2018
Yes it is. See attached demo.
Etworld
el 3 de Abr. de 2019
Hello, it is weird but, in line 114 it gives inner dimension error.
transformedImagePixelList = listOfRGBValues * coeff;
For 'coloredChips' image example, size(listOfRGBValues)=202538x3
size(coeff)=202538x2
Why do you think is happening ?
Darshan Jain
el 25 de Jul. de 2019
Hey @ImageAnalyst,
I checked out your script, I had a small question, How could I plot the colored image back in three plots (showing approximation by pca1, then pca1 and pca2 and then followed by pca1, pca2 and pca3).
I tried doing using the imfuse comand "imfuse(pca1,pca2)", the clarity improved well, but i'm not able to reproduce the same colors. (see the attached image)
I think this is because I need to normalize the data, and then un-normalize it back before plotting. (I'm not sure though)
Image Analyst
el 25 de Jul. de 2019
Etworld, I just ran the colored chips image and it ran fine. Did you change my code at all?

Darshan: where did your colors come from? I don't understand what your "approximations" are supposed to be. But anyway, you can stitch images side by side if they are all RGB images to begin with:
wideImage = [rgbImage1, rgbImage2, rgbImage3];
Shaveta Arora
el 30 de En. de 2016
0 votos
Can I have the pca code used in this color image example
6 comentarios
Image Analyst
el 30 de En. de 2016
See my attached m-file.
Shaveta Arora
el 31 de En. de 2016
thanks
Shaveta Arora
el 31 de En. de 2016
Dear Analyst In the attachment pca_image.m, pls share the function pca(X); as I ma having error : Undefined function or method 'pca' for input arguments of type 'double'.
Image Analyst
el 31 de En. de 2016
You must not have the Statistics and Machine Learning Toolbox.
Shaveta Arora
el 31 de En. de 2016
Might possible. Pls share this pca function to save in my folder.
Image Analyst
el 31 de En. de 2016
I can't. It would not be legal. You either have to buy the toolbox from the Mathworks, or implement it yourself from low level code.
Anitha Anbazhagan
el 17 de Sept. de 2016
0 votos
I have 200 ROIs from each of the 50 images. For each ROI, I have 96 feature vectors for four different frequency bands. It seems very high dimensional. How to apply PCA for this? PCA should be applied to data matrix. Do I have to apply for each image or each ROI?
1 comentario
Image Analyst
el 17 de Sept. de 2016
It depends on if you want PCA components on each image individually, or the PCA components of the group as a whole.
Mina Kh
el 11 de Dic. de 2016
0 votos
Hi. I have multispectral( multi channel) data and I want to apply PCA to reduce the number of channel. Can u give me some hint?Which code i have to use?
Arathy Das
el 20 de Dic. de 2016
0 votos
How can i extract three texture features among the 22 using PCA?
1 comentario
Image Analyst
el 20 de Dic. de 2016
I think you should start your own discussion with your own data or images. If you have 22 PCA columns, then just extract the 3 you want as usual.
pca3 = pca22(:, 1:3); % or whatever.
joynjo
el 24 de Mzo. de 2018
0 votos
How to visualize the result of PCA image in pseudocolor?
1 comentario
Image Analyst
el 24 de Mzo. de 2018
imshow(PC1); % Display the first principal component image.
colormap(jet(256));
F M Anim Hossain
el 6 de Abr. de 2018
0 votos
I'm new to the concept of PCA. I'm trying to develop something that can recognize color features from different images. Is it possible to do it with the help of PCA?
Categorías
Más información sobre Dimensionality Reduction and Feature Extraction en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
