Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef CAPTURE_H
00025 #define CAPTURE_H
00026
00033 #include "Alvar.h"
00034 #include "CaptureDevice.h"
00035 #include "Util.h"
00036
00037 namespace alvar {
00038
00046 class ALVAR_EXPORT Capture
00047 {
00048 public:
00054 Capture(const CaptureDevice captureDevice)
00055 : mCaptureDevice(captureDevice)
00056 , mXResolution(0)
00057 , mYResolution(0)
00058 , mIsCapturing(false)
00059 {
00060 }
00061
00065 virtual ~Capture() {}
00066
00070 CaptureDevice captureDevice() {return mCaptureDevice;}
00071
00075 unsigned long xResolution() {return mXResolution;}
00076
00080 unsigned long yResolution() {return mYResolution;}
00081
00085 bool isCapturing() {return mIsCapturing;}
00086
00093 virtual void setResolution(const unsigned long xResolution, const unsigned long yResolution)
00094 {
00095 }
00096
00102 virtual bool start() = 0;
00103
00107 virtual void stop() = 0;
00108
00116 virtual IplImage *captureImage() = 0;
00117
00124 virtual bool saveSettings(std::string filename) {
00125 if (!isCapturing()) {
00126 return false;
00127 }
00128
00129 Serialization serialization(filename);
00130 try {
00131 serialization << (*this);
00132 }
00133 catch (...) {
00134 return false;
00135 }
00136 return true;
00137 }
00138
00145 virtual bool loadSettings(std::string filename) {
00146 if (!isCapturing()) {
00147 return false;
00148 }
00149
00150 Serialization serialization(filename);
00151 try {
00152 serialization >> (*this);
00153 }
00154 catch (...) {
00155 return false;
00156 }
00157 return true;
00158 }
00159
00164 virtual bool showSettingsDialog() = 0;
00165
00169 virtual std::string SerializeId() = 0;
00170
00177 virtual bool Serialize(Serialization *serialization) = 0;
00178
00179 protected:
00180 CaptureDevice mCaptureDevice;
00181 unsigned long mXResolution;
00182 unsigned long mYResolution;
00183 bool mIsCapturing;
00184 };
00185
00186 }
00187
00188 #endif