title: How to get access to vector mat object in OpenCV
body: <p>I would like to load some pictures from files to Mat-objects (OpenCV) and want to store them in a vector. Further OpenCV calls/objects need vectors (like: AlignMTB) as arguments. But after filling the vector with Mat-objects I'm only able to get access to the last element I added to the vector. </p>
  
  <p>In the example I first load the images to an intermediary Mat-object and convert it to CV_32FC3. Then I print out the BGR-values of one sample-pixel. The print out is:</p>
  
  <pre><code>File 0: 13 13 157
  File 1: 17 20 159
  File 2: 8 8 152
  </code></pre>
  
  <p>Then I add this intermediary Mat to the Mat-vector images.</p>
  
  <p>Afterwards I'm trying to print out the sample-pixel values of the first and second image but always I get the values of the third image:</p>
  
  <pre><code>File 0: 8 8 152
  File 1: 8 8 152
  </code></pre>
  
  <p>What I'm making wrong during accessing the vector data?</p>
  
  <p>I was trying it with this routine:</p>
  
  <pre><code>vector&lt;Mat&gt; images;
  images.reserve(3);
  
  Mat img;
  for (int i = 0; i &lt; 3; i++)
  {
      imread("F:/Test/file" + to_string(i) + ".jpg").convertTo(img, CV_32FC3);
  
      cout &lt;&lt; "File " &lt;&lt; i &lt;&lt; ": " &lt;&lt; img.at&lt;Vec3f&gt;(800, 800)[0] &lt;&lt; " " &lt;&lt; img.at&lt;Vec3f&gt;(800, 800)[1] &lt;&lt; " " &lt;&lt; img.at&lt;Vec3f&gt;(800, 800)[2] &lt;&lt; endl;
  
      images.push_back(img);
  }
  cout &lt;&lt; endl;
  
  cout &lt;&lt; "File " &lt;&lt; 0 &lt;&lt; ": " &lt;&lt; images[0].at&lt;Vec3f&gt;(800, 800)[0] &lt;&lt; " " &lt;&lt; images[0].at&lt;Vec3f&gt;(800, 800)[1] &lt;&lt; " " &lt;&lt; images[0].at&lt;Vec3f&gt;(800, 800)[2] &lt;&lt; endl;
  cout &lt;&lt; "File " &lt;&lt; 1 &lt;&lt; ": " &lt;&lt; images[1].at&lt;Vec3f&gt;(800, 800)[0] &lt;&lt; " " &lt;&lt; images[1].at&lt;Vec3f&gt;(800, 800)[1] &lt;&lt; " " &lt;&lt; images[1].at&lt;Vec3f&gt;(800, 800)[2] &lt;&lt; endl;
  </code></pre>