<p>PCA could be a right choice here (but not the only one). Although, you should be aware of the fact, that PCA does not reduce the number of your input data features automatically. I recommend you reading this tutorial: <a href="http://arxiv.org/pdf/1404.1100v1.pdf" rel="nofollow">http://arxiv.org/pdf/1404.1100v1.pdf</a> - it is the one I used to understand PCA and its really good for beginners.</p>

<p>Getting back to your question. An image is an vector in a 324-dimensional space. In this space the first base vector is one having a white pixel in top left corner, next one is having next pixel white, all the other black - and so on. It probably is not the best base vector set to represent this image data. PCA computes new base vectors (the COEFF matrix - the new vectors expressed as values in old vector space) and new image vector values (the SCORE matrix). At that point you have not lost ANY data at all (no feature number reduction). But, you could stop using some of the new base vectors, because they are probably connected with noice, not the data itself. It is all described in details in the tutorial.</p>

<pre><code>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
</code></pre>
How can I use the princomp function of Matlab in the following case?
<p>I have 10 images(18x18). I save these images inside an array named <code>images[324][10]</code> where the number 324 represents the amount of pixels for an image and the number 10 the total amount of images that I have.</p>

<p>I would like to use these images for a neuron network however 324 is a big number to give as an input and thus I would like to decrease this number but retain as much information as possible.</p>

<p>I heard that you can do this with the <code>princomp</code> function which implements PCA.</p>

<p>The problem is that I haven't found any example on how to use this function, and especially for my case.</p>

<p>If I run</p>

<pre><code>[COEFF, SCORE, latent] = princomp(images);
</code></pre>

<p>it runs fine but how can I then get the array <code>newimages[number_of_desired_features][10]</code>?</p>