00001 00002 00003 #ifndef __OPENCVVIDEOSOURCE_H 00004 #define __OPENCVVIDEOSOURCE_H 00005 00006 #include "videosource.h" 00007 00008 #ifndef MACOS 00009 #include <highgui.h> 00010 #endif 00011 00015 class OpenCVVideoSource : public VideoSource { 00016 public: 00017 00018 OpenCVVideoSource(char *source, int w, int h); 00019 virtual bool initialize(); 00020 virtual bool getFrame(IplImage *dst); 00021 void getSize(int &width, int &height); 00022 virtual ~OpenCVVideoSource(); 00023 virtual void start(); 00024 virtual void stop(); 00025 virtual bool isPlaying() { return playing; }; 00026 virtual const char *getStreamName() const { return source; } 00027 virtual const char *getStreamType() const { return "OpenCVVideoSource"; } 00028 virtual int getId(); 00029 00030 private: 00031 00032 CvCapture *capture; 00033 char *source; 00034 int frameCnt; 00035 bool playing; 00036 IplImage *frame; 00037 int width,height; 00038 bool movie; 00039 }; 00040 00041 class OpenCVFactory : public ParticularVSFactory { 00042 public: 00043 OpenCVFactory() { name="OpenCV"; source=0; }; 00044 virtual void registerParameters(ParamSection *sec); 00045 virtual VideoSource *construct(); 00046 private: 00047 char *source; 00048 bool use; 00049 int width,height; 00050 }; 00051 #endif 00052