title: How to keep frames provided by VideoCapture in OpenCV
body: <p>I want to write a function using opencv which reads a Video file grabs single frames and stores them lets say in std::vector>. Problem turns out at the end of function, I've got images in vector of vectors, but when a release VideoCapture all the data is gone.     </p>
  
  <pre><code>vector&lt;Mat&gt;load_single_video(string path)
  {   
      vector&lt;Mat&gt; one_video_vector;
      Mat video_img;
      VideoCapture Temp_video_capture(path);
      Temp_video_capture.read(video_img);
      while (!video_img.empty())
      {           
          one_video_vector.push_back(video_img);      
          Temp_video_capture.read(video_img);
      }
  
      Temp_video_capture.release();
  
      return one_video_vector;
  }
  </code></pre>