Effacer les filtres
Effacer les filtres

hyperpca applied to a set of several hyperspectral images

5 vues (au cours des 30 derniers jours)
Daniel
Daniel le 30 Mai 2024
Modifié(e) : John D'Errico le 30 Mai 2024
I am trying to perform the PCA of several hyperspectral images.
I want to make one PCA with the entire set of images, not one PCA per image. To do this I run into several problems.
  • The first problem is that the data takes up a large amount of memory and the hyperpca function does not accept using tall arrays. Matlab's PCA function does allow me to work with tall arrays but I don't know how to perform a PCA for a three-dimensional array.
  • The second is that if I have to carry out the PCA of each of the images individually, how can I combine the PCAs?
If anyone can give me a hand I would appreciate it.

Réponses (1)

John D'Errico
John D'Errico le 30 Mai 2024
Modifié(e) : John D'Errico le 30 Mai 2024
You cannot combine multiple PCA analyses. Since each one requires the computation of the eigenvalues and eigenvectors of a matrix, that is a highly nonlinear operation. There would be no simple magic to combine the multiple solutions into one, done after the fact.
Instead, you would need to concatenate the images into one tall array, since PCA can handle tall arrays. And that is eminently doable.
Ta = tall(rand(100,3));
Tb = tall(rand(100,3));
Tab = [Ta;Tb];
whos Tab
Name Size Bytes Class Attributes Tab 200x3 45 tall
So tall arrays can be vertically concatenated. And that means I can perform a PCA on Tab.
pca(Tab)
Evaluating tall expression using the Local MATLAB Session: - Pass 1 of 1: 0% complete - Pass 1 of 1: Completed in 0.27 sec Evaluation completed in 0.44 sec
ans = 3x3
0.6026 -0.2579 0.7552 0.7078 -0.2643 -0.6551 0.3686 0.9293 0.0233
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by