view c/InputVideoFileModule.cpp @ 414:040e71067ff4

Win32 property sheet version updated to opencv 2.4.6.1
author Jean-Philippe Jodoin <jpjodoin@gmail.com>
date Sun, 08 Sep 2013 23:38:37 -0400
parents 3c271a46b4d4
children 2be846d36dec
line wrap: on
line source

#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;
}