MATLAB: I found this code demo for pca and I think that it shows that pca is literally just making the dimensions really small. The line of code X is the one doing all fancy modes of the image not pca. Is the understnading correct or am I missing something

image analysisimage processingpca

I = double(imread('peppers.png'));
X = reshape(I,size(I,1)*size(I,2),3);
coeff = pca(X);
Itransformed = X*coeff;
Ipc1 = reshape(Itransformed(:,1),size(I,1),size(I,2));
Ipc2 = reshape(Itransformed(:,2),size(I,1),size(I,2));
Ipc3 = reshape(Itransformed(:,3),size(I,1),size(I,2));
figure, imshow(Ipc1,[]);
figure, imshow(Ipc2,[]);
figure, imshow(Ipc3,[]);

Best Answer

To determine whether your assessment is accurate, replace the line
coeff = pca(X);
with
coeff = eye(3);
which is the 3 x 3 identity matrix. If the reshape() is doing the work and the pca() is not contributing anything then the output you get back will look the same as you get in the pca() case. If the output you get back is significantly different than what you get in the pca() case then the pca() has done something useful.
Note: what that code demo is doing is essentially determining the correlation that the three color planes (Red, Green, Blue) have with each other.