title: Image Fusion by Principal Component Analysis(PCA)
body: <p>I tried to implement PCA based image fusion with C++ and OpenCV,  but I can't understand,  that exactly I have to do. As I read in some of tutorials on PCA based image fusion, when there are two pictures I1 and I2 of the same scene of sizes NxM in greyscale, algorithm is:</p>
  
  <ol>
  <li>Create a matrix of size NMx2, where column 1 is a pixel  values of I1, and column 2 is a pixel  values of I2 .</li>
  <li>In some of tutorials that I found this is necessary to find average value of 1 column and extract it from 1 column, and average value of 2 column and extract it from second column. Is it necessary?</li>
  <li>Find  a covariance matrix of this matrix MNx2.</li>
  <li>Find eigenvalues and eigenvectors of this covariance matrix.
  In one of tutorials, I read that it necessary to choose an eigenvector, which is corresponding to larger eigenvalue and normalize this eigenvector.
  In OpenCV, when use cv::eigen() function, it returns eigenvectors, which yet are normalized. And in one of tutorials, I read that sum of obtained components should be P1+P2=1. </li>
  </ol>
  
  <p>So, if I get eigenvector, correcponding to larger eigenvalue, for example like this <code>eigen = (0,705353; 0,71453) = (u, v)</code>, that is a formula for fused image <code>I_fus</code>?
  <code>I_fus = u*I1+v*I2</code>? Or 
  <code>I_fus =   u/(u+v)*I1+v/(u+v)*I2</code>?
  Or I wrong and there is another formula for fused image?</p>