Skip to content

Commit

Permalink
Fixed VideoCapture::open() does not release previous capture sources …
Browse files Browse the repository at this point in the history
…(Bug opencv#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.
  • Loading branch information
nmanovic committed Jul 10, 2013
1 parent 68a992b commit 2121130
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/highgui/src/cap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,14 +490,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();
}
Expand Down

0 comments on commit 2121130

Please sign in to comment.