00001
00024 #ifndef _VIDEO_H
00025 #define _VIDEO_H
00026
00027 #include "../../util/Thread.h"
00028 #include "../Numerical.h"
00029
00030 class FEATURE_EXPORT_CLASS VideoMotionFeature : public NumericalContinuousFeature
00031 {
00032 friend class VideoFeatureProvider;
00033
00034 protected:
00035 VideoMotionFeature(double* minval, double* maxval) : NumericalContinuousFeature(minval, maxval) {}
00036 VideoMotionFeature(double* minval, double* maxval, double val) : NumericalContinuousFeature(minval, maxval, val) {}
00037
00038 public:
00039 virtual const string getName() const { return "Video.Motion"; }
00040
00041 #if _DEBUG_FEATURES
00042 virtual string toString() const;
00043 #endif
00044 };
00045
00046
00050 class FEATURE_EXPORT_CLASS VideoFeatureProvider : public FeatureProvider, public Thread
00051 {
00052 private:
00056 struct SampleData {
00057 double average;
00058 unsigned long average_counter;
00059
00063 SampleData() {
00064 average_counter = 0;
00065 average = 0.0;
00066 }
00067 };
00068
00070 stringvector features;
00071
00073
00074 string deviceName;
00075 int height, width, frequency;
00076
00077 double videoMotionFeature_minval;
00078 double videoMotionFeature_maxval;
00079
00080 double curMotion;
00081 mutable Lock lockCurMotion;
00082
00083
00084 char* v4l_start();
00085
00086 public:
00087 VideoFeatureProvider(providerparams ¶ms);
00088 virtual ~VideoFeatureProvider();
00089
00090 virtual Feature* getFeature(string name) const;
00091 virtual Feature* getSample(string name) const;
00092 virtual void nextSample(clock_t checkpoint);
00093
00094 virtual void run();
00095 };
00096
00097 #endif // _VIDEO_H