Merge pull request #1104 from nikman-ru:cap_reuse

This commit is contained in:
Andrey Pavlenko 2013-07-11 11:52:22 +04:00 committed by OpenCV Buildbot
commit 75b86c9706

View File

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