diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/c/InputVideoFileModule.cpp	Fri Dec 05 12:13:53 2014 -0500
@@ -0,0 +1,31 @@
+#include "InputVideoFileModule.h"
+
+InputVideoFileModule::InputVideoFileModule(const std::string& videoPath) 
+  : mInit(false)
+  , mNumberOfFrame(0)
+{
+  mInit = mVideoCapture.open(videoPath.c_str());
+  double frameCount;
+  frameCount = mVideoCapture.get(CV_CAP_PROP_FRAME_COUNT);	
+  mSize = cv::Size(mVideoCapture.get(CV_CAP_PROP_FRAME_WIDTH), mVideoCapture.get(CV_CAP_PROP_FRAME_HEIGHT));
+  mNumberOfFrame = (unsigned int)frameCount;
+}
+
+InputVideoFileModule::~InputVideoFileModule(void) { }
+
+
+void InputVideoFileModule::setFrameNumber(const unsigned int& frameNumber) {
+  mVideoCapture.set(CV_CAP_PROP_POS_FRAMES, frameNumber);
+}
+
+bool InputVideoFileModule::getNextFrame(cv::Mat& outputPicture)
+{
+  bool success = false;
+  if(mInit)
+    {		
+      mVideoCapture >> outputPicture;
+      success = !outputPicture.empty();
+    }
+  return success;
+}
+