00001 00002 00003 #ifndef __DC1394VS_H 00004 #define __DC1394VS_H 00005 00006 #include <cv.h> 00007 #include "iniparser.h" 00008 #include "videosource.h" 00009 #include <dc1394/dc1394.h> 00010 00012 class DC1394 : public VideoSource { 00013 public: 00014 00015 struct Params { 00016 bool debug; 00017 bool gray; 00018 int width; 00019 int height; 00020 int framerate; 00021 int bus_speed; 00022 }; 00023 00024 virtual bool initialize(); 00025 virtual bool getFrame(IplImage *dst); 00026 virtual void getSize(int &width, int &height); 00027 DC1394(Params &p); 00028 virtual ~DC1394(); 00029 virtual void start(); 00030 virtual void stop(); 00031 virtual bool isPlaying() { return playing; }; 00032 virtual int getChannels(); 00033 virtual const char *getStreamName() const { return "DC1394 live stream"; } 00034 virtual const char *getStreamType() const { return "DC1394"; } 00035 virtual void *getInternalPointer() { return camera; } 00036 private: 00037 bool setupCapture(); 00038 bool init_video_mode(); 00039 00040 bool playing; 00041 IplImage *image; 00042 Params params; 00043 00044 dc1394_t *d; 00045 dc1394camera_t *camera; 00046 dc1394video_frame_t *frame; 00047 unsigned int width, height; 00048 00049 }; 00050 00051 class DC1394Factory : public ParticularVSFactory { 00052 public: 00053 DC1394Factory() { name="DC1394"; }; 00054 virtual void registerParameters(ParamSection *sec); 00055 virtual VideoSource *construct(); 00056 private: 00057 bool use; 00058 DC1394::Params params; 00059 }; 00060 00061 #endif 00062