#include "stdafx.h"
#include "opencv2/opencv.hpp"
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
using namespace std;
using namespace cv;
class ASDCVFrameSequencer
{
protected: //parent Variable
CvCapture *capture;
public:
void getFrameCaption(char *caption);
virtual IplImage *getNextImage();
virtual void close();
virtual bool isOpen();
};
//open camera
class ASDFrameSequencerWebCam : public ASDCVFrameSequencer
{
public:
virtual bool open(int cameraIndex);
};
//open video file
class ASDFrameSequencerVideoFile : public ASDCVFrameSequencer
{
public:
virtual bool open(const char *fileName);
};
//read sequencer image
class ASDFrameSequencerImageFile : public ASDCVFrameSequencer
{
private:
char sFileNameMask[2048];
int nCurrentIndex, nStartIndex, nEndIndex;
public:
virtual void open(const char *fileNameMask, int startIndex, int endIndex);
virtual void getFrameCaption(char *caption);
virtual IplImage *getNextImage();
virtual void close();
virtual bool isOpen();
};
//-------------------- ASDCVFrameSequencer -----------------------//
//camera video all same methods
bool ASDCVFrameSequencer::isOpen() //did camera open
{
return (capture != NULL);
};
IplImage* ASDCVFrameSequencer::getNextImage()
{
IplImage *image;
image = cvQueryFrame(capture);
if (image != NULL)
{
return cvCloneImage(image);
}
else
{
return NULL;
}
};
void ASDCVFrameSequencer::close() //close camera
{
if (capture != NULL)
#include "opencv2/opencv.hpp"
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
using namespace std;
using namespace cv;
class ASDCVFrameSequencer
{
protected: //parent Variable
CvCapture *capture;
public:
void getFrameCaption(char *caption);
virtual IplImage *getNextImage();
virtual void close();
virtual bool isOpen();
};
//open camera
class ASDFrameSequencerWebCam : public ASDCVFrameSequencer
{
public:
virtual bool open(int cameraIndex);
};
//open video file
class ASDFrameSequencerVideoFile : public ASDCVFrameSequencer
{
public:
virtual bool open(const char *fileName);
};
//read sequencer image
class ASDFrameSequencerImageFile : public ASDCVFrameSequencer
{
private:
char sFileNameMask[2048];
int nCurrentIndex, nStartIndex, nEndIndex;
public:
virtual void open(const char *fileNameMask, int startIndex, int endIndex);
virtual void getFrameCaption(char *caption);
virtual IplImage *getNextImage();
virtual void close();
virtual bool isOpen();
};
//-------------------- ASDCVFrameSequencer -----------------------//
//camera video all same methods
bool ASDCVFrameSequencer::isOpen() //did camera open
{
return (capture != NULL);
};
IplImage* ASDCVFrameSequencer::getNextImage()
{
IplImage *image;
image = cvQueryFrame(capture);
if (image != NULL)
{
return cvCloneImage(image);
}
else
{
return NULL;
}
};
void ASDCVFrameSequencer::close() //close camera
{
if (capture != NULL)