title: How to convert Image<Gray, Byte> into 1D Matrix<float>?
body: <p>I have an <code>Image&lt;Gray, Byte&gt;</code> trainImage with the size NxN, and i want to change it into 1D <code>Matrix&lt;float&gt;</code> trainMatrix with the size <code>(N^2)x1</code>.</p>
  
  <p>What I am trying to do is to call <code>CvInvoke.cvCalvCovarmatrix()</code>. For the first parameter I'm using <code>Matrix&lt;Single&gt;[]</code> that i convert into <code>IntPtr[]</code>.</p>
  
  <pre><code>Matrix&lt;Single&gt; avg = new Matrix&lt;float&gt;(7, 1);
  Matrix&lt;Single&gt; cov = new Matrix&lt;float&gt;(7, 7);
  Matrix&lt;Single&gt;[] input = new Matrix&lt;float&gt;[3];
  for (int i = 0; i &lt; 3; i++)
      input[i] = new Matrix&lt;float&gt;(7, 1);
  
  IntPtr[] inObjs = Array.ConvertAll&lt;Matrix&lt;Single&gt;, IntPtr&gt;(input, delegate(Matrix&lt;Single&gt; mat) { return mat.Ptr; });
  
  CvInvoke.cvCalcCovarMatrix(inObjs, 3, cov, avg, COVAR_METHOD.CV_COVAR_NORMAL);
  </code></pre>
  
  <p>But now i have input that is <code>Image&lt;Gray, Byte&gt;[]</code> with each image size (let's assume) 7x7. I think i will need to convert each image into <code>Matrix&lt;float&gt;</code> with size 49x1 first before changing it into <code>IntPtr[]</code>. How to do it?</p>