title: How does the return value "res" is updated? (ConcativeMat Con NN)
body: <p>I have a questions about a for loop and its return value. This is C++ code, and I'm using openCV 2.4V. </p>
  
  <p>Input to this function is max value of 600 images with pooling. 
  600 images &lt;&lt; pooling &lt;&lt; max value points. 
  The size of "res" matrix is 600x128 and vec.size() = 600. </p>
  
  <p>For me, within the for loop, the res never get updated, however return value is not zeros.</p>
  
  <p>I suspected </p>
  
  <p>"ptmat.copyTo(subView)"</p>
  
  <p>because, I thought that is not necessary line. However when I took that out, res did not get updated(being zero like initial Mat). Can anybody explain how does the res value get updated?</p>
  
  <p>Also why does this function is called concatenate..? </p>
  
  <pre><code> Mat
   concatenateMat(vector&lt;vector&lt;Mat&gt; &gt; &amp;vec) {
  
      int subFeatures = vec[0][0].rows * vec[0][0].cols;
      int height = vec[0].size() * subFeatures;
      int width = vec.size();
      Mat res = Mat::zeros(height, width, CV_64FC1);
  
      for (int i = 0; i&lt;vec.size(); i++) {
          for (int j = 0; j&lt;vec[i].size(); j++) {
              Rect roi = Rect(i, j * subFeatures, 1, subFeatures);
              Mat subView = res(roi);
              Mat ptmat = vec[i][j].reshape(0, subFeatures);
              ptmat.copyTo(subView);
          }
      }
      return res;
  }
  </code></pre>