contrib/brl/bbas/bsta/bsta_detector_gaussian.h
Go to the documentation of this file.
00001 // This is brl/bbas/bsta/bsta_detector_gaussian.h
00002 #ifndef bsta_detector_gaussian_h_
00003 #define bsta_detector_gaussian_h_
00004 //:
00005 // \file
00006 // \brief Detectors applying to Gaussians
00007 // \author Matt Leotta (mleotta@lems.brown.edu)
00008 // \date February 09, 2006
00009 //
00010 // \verbatim
00011 //  Modifications
00012 //   (none yet)
00013 // \endverbatim
00014 
00015 //: A simple Mahalanobis distance detector for a Gaussian
00016 //  Detects samples that lie within some Mahalanobis distance
00017 template <class gaussian_>
00018 class bsta_g_mdist_detector
00019 {
00020   public:
00021     typedef bool return_T;
00022     enum { return_dim = 1 };
00023     typedef typename gaussian_::math_type T;
00024     typedef typename gaussian_::vector_type vector_;
00025 
00026     // for compatibility with vpdl/vdpt
00027     typedef return_T return_type;
00028     typedef gaussian_ distribution_type;
00029 
00030     //: Constructor
00031     bsta_g_mdist_detector(const T& thresh=T(2.5)) : sqr_threshold(thresh*thresh) {}
00032 
00033     //: The main function
00034     // \retval true if the Mahalanobis distance is less than the threshold
00035     bool operator() (const gaussian_& g, const vector_& sample, bool& result) const
00036     {
00037       result = g.sqr_mahalanobis_dist(sample) < sqr_threshold;
00038       return true;
00039     }
00040 
00041     //: the threshold on Mahalanobis distance
00042     T sqr_threshold;
00043 };
00044 
00045 
00046 #endif // bsta_detector_gaussian_h_