00001 #ifndef PLAYBACK_CAMERA_H 00002 #define PLAYBACK_CAMERA_H 00003 00004 #include <WURDECam.H> 00005 #include <opencv/cv.h> 00006 #include <vector> 00007 #include <string> 00008 #include <list> 00009 #include <Time.H> 00010 #include <DirectoryLoader.H> 00011 00012 namespace WURDEVision { 00013 00014 class WURDEPlaybackCamera : public WURDECamera { 00015 public: 00016 WURDEPlaybackCamera(std::string name, std::map<std::string,std::string> options); 00017 00018 bool init(); 00019 bool startCapture(); 00020 void stopCapture(); 00021 00022 WURDE::WURDEImage captureRGB(); 00023 void resetFrame(); 00024 00025 void setDirectory(const std::string &path){m_path=path; m_frameLoader.setPath(path);} 00026 void addPattern(const std::string &pat){m_frameLoader.addPattern(pat);} 00027 00028 void captureThread(); 00029 protected: 00030 00031 private: 00032 WURDE::DirectoryScanner m_frameLoader; 00033 std::vector<WURDE::FileEntry> m_frameList; 00034 std::string m_path; 00035 WURDE::RunState thread_state; 00036 bool m_capturing; 00037 pthread_t m_captureThread; 00038 00039 WURDE::WURDEImage m_imageRGB; 00040 bool m_haveRGB; 00041 00042 IplImage *buffers[3]; 00043 WURDE::Time timestamps[3]; 00044 pthread_mutex_t buffMutex[3]; 00045 IplImage *currentFrame; 00046 int currentBuffer; 00047 int nextFrame; 00048 00049 WURDE::PlaybackTimer m_timer; 00050 float m_freq; 00051 float m_multiplier; 00052 }; 00053 00054 } 00055 00056 extern "C" { 00057 void *runPlaybackCameraCaptureThread(void *ptr); 00058 } 00059 00060 00061 #endif