DytexKalmanFilter.hpp

00001 /**************************************************
00002 
00003   Dytex Kalman Filter class
00004 
00005   Antoni Chan,
00006   City University of Hong Kong, Copyright 2014
00007   libdt - OpenCV library for Dynamic Textures - version 1.0
00008 
00009 ***************************************************/
00010 
00011 #ifndef DYTEXKALMANFILTER_HPP
00012 #define DYTEXKALMANFILTER_HPP
00013 
00014 using namespace cv;
00015 using namespace std;
00016 
00026 class DytexKalmanFilter
00027 {
00028 public:
00029 
00030   // cache for instantiated Kalman filter
00031   Mat           cache_Kt;     
00032   Mat           cache_detMt;  
00033   Mat           cache_invMt;  
00034   Dytex         *cache_dt;    
00036 public:
00037 
00043   DytexKalmanFilter(Dytex &dt, int tau);
00044   ~DytexKalmanFilter();
00045 
00051   void loglike(const vector<Mat> &videos, Mat &lik, bool mahal=false);
00052 
00058   double loglike(const Mat &video, bool mahal=false);
00059 
00067   static void loglike(const Dytex &dt, const vector<Mat> &videos, Mat &lik, bool mahal=false);
00068 
00076   static double loglike(const Dytex &dt, const Mat &video, bool mahal=false);
00077 
00078   // old version w/o using internal function
00081   static void loglike_old(const Dytex &dt, const vector<Mat> &videos, Mat &lik, bool mahal=false);
00082 
00083 
00084 private:
00086   enum kf_mode {KF_CACHE,       
00087                 KF_COMPUTE_WITH_CACHE,      
00088                 KF_COMPUTE_WITHOUT_CACHE    
00089                 };  
00090 
00091   
00111   static void loglike_internal(const Dytex &dt, const vector<Mat> *videos, Mat *lik, 
00112                                int cache_tau, Mat *cache_Kt, Mat *cache_detMt, Mat *cache_invMt, 
00113                                bool mahal, kf_mode kfmode);
00114 
00115 public: 
00116   //conditional state inference using Kalman smoothing filter
00117   static void dytex_kalman(Mat Y, Dytex dt, string di3opt,std::vector<Mat> &xt,Mat &Vt,Mat &Vt1,Mat &L);
00118   
00119 
00120 
00121 };
00122 
00123 #endif

Generated on 18 Dec 2014 for libdt-OpenCV by  doxygen 1.6.1