title: how to use opencv Mat reserve? with push_back
body: <p>I want to use the opencv <code>cv::Mat</code> function <code>push_back</code> to add new rows to a matrix, but I want to precache the size of the matrix so that the data doesn't need to be constantly reallocated. The <code>cv::mat::reserve</code> function has a number of rows parameter, but that implies that you have to specify the number of columns (and data size first). So the code below I assume would give me one empty row at the beginning which I don't want. Is there a proper way to do this using <code>reserve</code> and <code>push_back</code>??</p>
  
  <pre><code>cv::Mat M(1, size_cols, CV_32FC1);
  M.reserve(size_rows);
  for (int i = 0; i &lt; size_rows; i++)
  {
    GetInputMatrix(A);
    M.push_back(A.row(i));
  }
  </code></pre>
  
  <p>Note: though the example code doesn't show it I'm not sure of the exact size of the final matrix, but I can get a max value size to reserve.</p>