00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __TLBACKGROUND_H__
00018 #define __TLBACKGROUND_H__
00019
00020
00021 #include "tlVision.h"
00022
00023
00024 class tlBackground
00025 {
00026 private:
00027 float *mean;
00028 float *variance;
00029
00030
00031
00032 int learn;
00033 int adapt;
00034 float Vmin, Vmax;
00035 float alpha;
00036 float K;
00037 float Koffset;
00038
00039 public:
00040
00041 int width, height;
00042 int pixelWidth;
00043 tl_format format;
00044
00045 tlBackground ();
00046 tlBackground (float Vmin, float Vmax, float alpha, float K, float Koffset);
00047 virtual ~tlBackground ();
00048
00049
00050 int setParam (float Vmin, float Vmax, float alpha, float K, float Koffset);
00051 int setLearn (int val) { return learn = val; };
00052 int setAdapt (int val) { return adapt = val; };
00053
00054
00055 int init (tlImage *image, int adapt = 0, int learn = 0);
00056 int update (tlImage *image);
00057 int update (tlImage *image, tlRect *rect);
00058
00059
00060 int get (tlImage *dest);
00061 int getVariance (tlImage *dest);
00062
00063
00064 int filter (tlImage *image);
00065 int filter (tlImage *image, tlRect *rect);
00066 };
00067
00068
00069 #endif