Fixed VideoCapture::open() does not release previous capture sources (Bug #3150).

VideoCapture didn't call release method and just ignored the new capture sources.
OpenCV documentation:
  bool VideoCapture::open(const string& filename);
  bool VideoCapture::open(int device);

The methods first call VideoCapture::release() to close the already opened file or camera.
This commit is contained in:
Nikita Manovich 2013-07-10 17:43:47 +04:00
parent d1fe1a62c3
commit 05aeb70831

View File

@ -489,14 +489,14 @@ VideoCapture::~VideoCapture()
bool VideoCapture::open(const string& filename)
{
if (!isOpened())
if (isOpened()) release();
cap = cvCreateFileCapture(filename.c_str());
return isOpened();
}
bool VideoCapture::open(int device)
{
if (!isOpened())
if (isOpened()) release();
cap = cvCreateCameraCapture(device);
return isOpened();
}