should now reset the camera after stopped on Linux,Windows.

This commit is contained in:
lostjared
2017-03-10 11:55:20 -08:00
parent 605ec0f4eb
commit 92e26ce2fd
2 changed files with 8 additions and 1 deletions

View File

@@ -40,7 +40,13 @@ bool Playback::setVideoCamera(int device, int res, cv::VideoWriter wr, bool reco
mode = MODE_CAMERA; mode = MODE_CAMERA;
mutex.lock(); mutex.lock();
if(capture.isOpened()) { if(capture.isOpened()) {
#if defined(__linux__) || defined(_WIN32)
capture.open(device);
if(!capture.isOpened()) {
mutex.unlock();
return false;
}
#endif
} else { } else {
capture.open(device); capture.open(device);
if(!capture.isOpened()) { if(!capture.isOpened()) {

View File

@@ -30,6 +30,7 @@ private:
std::vector<std::pair<int, int>> current; std::vector<std::pair<int, int>> current;
bool isPaused, isStep; bool isPaused, isStep;
VideoMode mode; VideoMode mode;
int device_num;
public: public:
Playback(QObject *parent = 0); Playback(QObject *parent = 0);
~Playback(); ~Playback();