Mercurial > hg > nsaunier > traffic-intelligence
comparison c/InputVideoFileModule.cpp @ 400:7ef1071e3cc3
clean up of input classes for list of images and video files
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Mon, 29 Jul 2013 18:06:55 -0400 |
| parents | c389fae9689a |
| children | b829ebdc18e6 |
comparison
equal
deleted
inserted
replaced
| 399:c389fae9689a | 400:7ef1071e3cc3 |
|---|---|
| 1 #include "InputVideoFileModule.h" | 1 #include "InputVideoFileModule.h" |
| 2 | 2 |
| 3 InputVideoFileModule::InputVideoFileModule(const std::string& videoPath) | 3 InputVideoFileModule::InputVideoFileModule(const std::string& videoPath) |
| 4 : mInit(false) | 4 : mInit(false) |
| 5 , mNumberOfFrame(0) | 5 , mNumberOfFrame(0) |
| 6 { | 6 { |
| 7 mInit = mVideoCapture.open(videoPath.c_str()); | 7 mInit = mVideoCapture.open(videoPath.c_str()); |
| 8 double frameCount; | 8 double frameCount; |
| 9 frameCount = mVideoCapture.get(CV_CAP_PROP_FRAME_COUNT); | 9 frameCount = mVideoCapture.get(CV_CAP_PROP_FRAME_COUNT); |
| 10 mSize = cv::Size(mVideoCapture.get(CV_CAP_PROP_FRAME_WIDTH), mVideoCapture.get(CV_CAP_PROP_FRAME_HEIGHT)); | 10 mSize = cv::Size(mVideoCapture.get(CV_CAP_PROP_FRAME_WIDTH), mVideoCapture.get(CV_CAP_PROP_FRAME_HEIGHT)); |
| 11 mNumberOfFrame = (unsigned int)frameCount; | 11 mNumberOfFrame = (unsigned int)frameCount; |
| 12 } | 12 } |
| 13 | 13 |
| 14 InputVideoFileModule::~InputVideoFileModule(void) | 14 InputVideoFileModule::~InputVideoFileModule(void) { } |
| 15 { | |
| 16 | |
| 17 } | |
| 18 | 15 |
| 19 | 16 |
| 20 | 17 void InputVideoFileModule::setFrameNumber(const int& frameNumber) { |
| 18 mVideoCapture.set(CV_CAP_PROP_POS_FRAMES, frameNumber); | |
| 19 } | |
| 21 | 20 |
| 22 bool InputVideoFileModule::getNextFrame(cv::Mat& outputPicture) | 21 bool InputVideoFileModule::getNextFrame(cv::Mat& outputPicture) |
| 23 { | 22 { |
| 24 bool success = false; | 23 bool success = false; |
| 25 if(mInit) | 24 if(mInit) |
| 26 { | 25 { |
| 27 mVideoCapture >> outputPicture; | 26 mVideoCapture >> outputPicture; |
| 28 success = !outputPicture.empty(); | 27 success = !outputPicture.empty(); |
| 29 } | 28 } |
| 30 return success; | 29 return success; |
| 31 } | 30 } |
| 32 | 31 |
