PCA may be the right choice here (but not the only one). Although, you should be aware that the PCA does not automatically reduce the amount of your input. I recommend you read this tutorial: http://arxiv.org/pdf/1404.1100v1.pdf is the one I used to understand the PCA and its really good for beginners.
Returning to your question. An image is a vector in 324-dimensional space. In this space, the first base vector is one that has a white pixel in the upper left corner, the next is the next white pixel, all the other black ones, and so on. This is probably not the best set of basic vectors to represent this image data. The PCA computes new base vectors (COEFF matrix โ new vectors expressed as values โโin the old vector space) and new image vector values โโ(SCORE matrix). At this point, you have not lost ANY data at all (without reducing the number of numbers). But you can stop using some of the new base vectors because they are probably related to noise, not the data itself. All this is described in detail in the textbook.
images = rand(10,324); [COEFF, SCORE] = princomp(images); reconstructed_images = SCORE / COEFF + repmat(mean(images,1), 10, 1); images - reconstructed_images %as you see there are almost only zeros - the non-zero values are effects of small numerical errors %its possible because you are only switching between the sets of base vectors used to represent the data for i=100:324 SCORE(:,i) = zeros(10,1); end %we remove the features 100 to 324, leaving only first 99 %obviously, you could take only the non-zero part of the matrix and use it %somewhere else, like for your neural network reconstructed_images_with_reduced_features = SCORE / COEFF + repmat(mean(images,1), 10, 1); images - reconstructed_images_with_reduced_features %there are less features, but reconstruction is still pretty good
source share