Mercurial > hg > nsaunier > traffic-intelligence
comparison c/InputVideoFileModule.cpp @ 614:5e09583275a4
Merged Nicolas/trafficintelligence into default
| author | Mohamed Gomaa <eng.m.gom3a@gmail.com> |
|---|---|
| date | Fri, 05 Dec 2014 12:13:53 -0500 |
| parents | 2be846d36dec |
| children |
comparison
equal
deleted
inserted
replaced
| 598:11f96bd08552 | 614:5e09583275a4 |
|---|---|
| 1 #include "InputVideoFileModule.h" | |
| 2 | |
| 3 InputVideoFileModule::InputVideoFileModule(const std::string& videoPath) | |
| 4 : mInit(false) | |
| 5 , mNumberOfFrame(0) | |
| 6 { | |
| 7 mInit = mVideoCapture.open(videoPath.c_str()); | |
| 8 double frameCount; | |
| 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)); | |
| 11 mNumberOfFrame = (unsigned int)frameCount; | |
| 12 } | |
| 13 | |
| 14 InputVideoFileModule::~InputVideoFileModule(void) { } | |
| 15 | |
| 16 | |
| 17 void InputVideoFileModule::setFrameNumber(const unsigned int& frameNumber) { | |
| 18 mVideoCapture.set(CV_CAP_PROP_POS_FRAMES, frameNumber); | |
| 19 } | |
| 20 | |
| 21 bool InputVideoFileModule::getNextFrame(cv::Mat& outputPicture) | |
| 22 { | |
| 23 bool success = false; | |
| 24 if(mInit) | |
| 25 { | |
| 26 mVideoCapture >> outputPicture; | |
| 27 success = !outputPicture.empty(); | |
| 28 } | |
| 29 return success; | |
| 30 } | |
| 31 |
