VideoCapture: copy the captured frame, to avoid dangling Mats
authorRoman Donchenko <roman.donchenko@itseez.com>
Tue, 29 Oct 2013 14:14:41 +0000 (18:14 +0400)
committerRoman Donchenko <roman.donchenko@itseez.com>
Tue, 29 Oct 2013 14:47:08 +0000 (18:47 +0400)
commitd6a7a6d5030a62c6b34b2dad8c89d3de1cc74baa
tree4d6b2ed864a827899bc636c41720643972b08cec
parentc5e8a9a29bfebd36eff0eea509eb0dce0aa87d56
VideoCapture: copy the captured frame, to avoid dangling Mats

Previously, VideoCapture::retrieve would return a Mat that referenced
the internal IplImage. Since the latter is rewritten every time a
frame is captured, it means that if the user captures two frames in a row,
the first frame would reference nothing. Similar if a user captures a frame,
then destroys the VideoCapture instance.

Note that the other branch of the if isn't affected, since flip allocates
a new Mat.
modules/highgui/src/cap.cpp