PCA on an image

조회 수: 3 (최근 30일)
Laura Bachiler Matallana
Laura Bachiler Matallana 2019년 6월 17일
답변: Image Analyst 2024년 12월 23일
Hi there,
I'm trying to apply PCA on an single image and i'am using the same porgram that i used to apply PCA to a grupo of images that are part of the data basis of a neuronal network that i am creating. The thing is that i need to apply PCA to a single image to be that image the input to the neuronal network that i created but it doesnt work.
Anyone has any idea of how can I apply PCA to an image of 50x50 saved as vector of 2500 to have an image of 90?
Thanks a lot.

답변 (2개)

Shantanu Dixit
Shantanu Dixit 2024년 12월 23일
Hi Laura,
If PCA has already been computed on a group of images, the principal components (eigenvectors) can be reused. The single image can be projected onto these precomputed components to get the reduced representation.
% Assume `coeff` are the eigenvectors precomputed on training images
% Single image (reshape from 50x50 to 1x2500)
image = rand(50, 50); % Example image
image_vector = reshape(image, 1, []);
% Project onto first 90 principal components
reduced_image = image_centered * coeff(:, 1:90);
% Process further to the neural network as required
Hope this helps!

Image Analyst
Image Analyst 2024년 12월 23일
See my attached demo where I compute the principal components of an image.

카테고리

Help CenterFile Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by