diff 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
line wrap: on
line diff
--- a/c/InputVideoFileModule.cpp	Mon Jul 29 17:12:45 2013 -0400
+++ b/c/InputVideoFileModule.cpp	Mon Jul 29 18:06:55 2013 -0400
@@ -1,32 +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)
-{
-
-}
-
-
-
-
-bool InputVideoFileModule::getNextFrame(cv::Mat& outputPicture)
-{
-	bool success = false;
-	if(mInit)
-	{		
-		mVideoCapture >> outputPicture;				
-		success = !outputPicture.empty();
-	}
-	return success;
-}
-
+#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 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;
+}
+