UKF.H

Go to the documentation of this file.
00001 /*!@file BayesFilters/UKF.H Unscented Kalman Filter               */
00002 
00003 // //////////////////////////////////////////////////////////////////// //
00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the //
00005 // University of Southern California (USC) and the iLab at USC.         //
00006 // See http://iLab.usc.edu for information about this project.          //
00007 // //////////////////////////////////////////////////////////////////// //
00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00010 // in Visual Environments, and Applications'' by Christof Koch and      //
00011 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00012 // pending; application number 09/912,225 filed July 23, 2001; see      //
00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00014 // //////////////////////////////////////////////////////////////////// //
00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00016 //                                                                      //
00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00018 // redistribute it and/or modify it under the terms of the GNU General  //
00019 // Public License as published by the Free Software Foundation; either  //
00020 // version 2 of the License, or (at your option) any later version.     //
00021 //                                                                      //
00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00025 // PURPOSE.  See the GNU General Public License for more details.       //
00026 //                                                                      //
00027 // You should have received a copy of the GNU General Public License    //
00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00030 // Boston, MA 02111-1307 USA.                                           //
00031 // //////////////////////////////////////////////////////////////////// //
00032 //
00033 // Primary maintainer for this file: Lior Elazary
00034 // $HeadURL: $
00035 // $Id: $
00036 //
00037 
00038 #ifndef UKF_H_DEFINED
00039 #define UKF_H_DEFINED
00040 
00041 #include "Image/Image.H"
00042 #include "Image/MatrixOps.H"
00043 #include "Image/lapack.H"
00044 #include <stdio.h>
00045 #include <stdlib.h>
00046 
00047 
00048 class UKF
00049 {
00050   public:
00051     UKF(int numStates, int numObservations,
00052         double k = 0, //secondery scaling param
00053         double alpha = 1e-3,  //the spread of the sigma points around the mean
00054         double beta = 2 //Used to incorporate prior knowledge of the distribution
00055         );
00056 
00057     virtual ~UKF() {};
00058 
00059     //! The function to move from one state to another (need to be implemented)
00060     virtual Image<double> getNextState(const Image<double>& X, int k) = 0;
00061 
00062     //! The function to predict the observation from the current state
00063     virtual Image<double> getObservation(const Image<double>& X, int k) = 0;
00064 
00065     //! Predict the next state and covariance
00066     void predictState(const Image<double>& noise=Image<double>());
00067 
00068     //! Predict the observations
00069     void predictObservation(const Image<double>& noise=Image<double>());
00070 
00071     //! Update the state and covariance given the observation z
00072     void update(const Image<double>& z, const Image<double>& noise);
00073  
00074     //! Get the likelihood of a mesurment
00075     double getLikelihood(const Image<double>& z, const Image<double>& observationNoise);
00076 
00077   protected:
00078     int itsNumStates;
00079     int itsNumObservations;
00080 
00081     //Scaling factor which determine how far sigma points a spread from the mean
00082     double itsAlpha;
00083     double itsK;
00084 
00085     //used to incude high order information about the distribution
00086     double itsBeta;
00087 
00088     //The state mean and covariance
00089     Image<double> itsState;
00090     Image<double> itsSigma;
00091 
00092     //Noise models
00093     Image<double> itsR; //processes noise
00094     Image<double> itsQ; //Measurement noise
00095 
00096 
00097     Image<double> getSigmaLocations(const Image<double>& state,
00098         const Image<double>& sigma, double gamma);
00099 
00100     Image<double> itsSigmaLocations; //The locations we are going to sample from
00101     Image<double> itsNewStates; //The predicted next state from the sigma locations 
00102     Image<double> itsNewZ; //the predicted observations from the sigma locations 
00103     Image<double> itsPredictedZ; //the predicted observations
00104     Image<double> itsPredictedZSigma; //the predicted observations covariance
00105 
00106 
00107   private:
00108     double itsLambda;
00109     double itsGamma;
00110     Image<double> itsMuWeight;
00111     Image<double> itsSigmaWeight;
00112     double itsGaussNormalizer;
00113     bool itsUnstable; //is the covariance symmetric?
00114     
00115 
00116 };
00117 
00118 // ######################################################################
00119 /* So things look consistent in everyone's emacs... */
00120 /* Local Variables: */
00121 /* indent-tabs-mode: nil */
00122 /* End: */
00123 
00124 #endif 
Generated on Sun May 8 08:04:24 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3