title: PCA for image processing
body: <p>I want to get the first principal component for an image using the built-in function <code>pca</code>. How can I do that? </p>
  
  <p>I have tried the following code:</p>
  
  <pre><code>[COEFF, SCORE] = pca(image);
  SCORE(1:size(SCORE,1),:)=0;
  reconstructed_image = SCORE / COEFF + repmat(mean(image,1),size(image,1), 1);
  I=reshape(reconstructed_image,[256,256]);
  figure
  imshow(I,[0 255])
  </code></pre>
  
  <p>I only get the fist row of the image. Any idea how can I do that correctly?</p>