vpdt_gaussian_detector.h
Go to the documentation of this file.
1 // This is core/vpdl/vpdt/vpdt_gaussian_detector.h
2 #ifndef vpdt_gaussian_detector_h_
3 #define vpdt_gaussian_detector_h_
4 //:
5 // \file
6 // \brief Detectors applying to Gaussians
7 // \author Matt Leotta (mleotta@lems.brown.edu)
8 // \date March 11, 2009
9 //
10 // \verbatim
11 // Modifications
12 // <None yet>
13 // \endverbatim
14 
16 
17 //: A simple Mahalanobis distance detector for a Gaussian
18 // Detects samples that lie within some Mahalanobis distance
19 template <class gaussian_type>
21 {
22  public:
23  //: the functor return type
24  typedef bool return_type;
25  //: the functor return type
26  static const unsigned int return_dim = 1;
27  //: the distribution operated on by the detector
28  typedef gaussian_type distribution_type;
29 
30  //: the data type to represent a point in the field
31  typedef typename gaussian_type::field_type F;
32  //: define the scalar type (normally specified by template parameter T)
34 
35  //: Constructor
36  vpdt_gaussian_mthresh_detector(const T& thresh=T(2.5))
37  : sqr_threshold(thresh*thresh) {}
38 
39  //: The main function
40  // \retval true if the Mahalanobis distance is less than the threshold
41  bool operator() (const gaussian_type& g, const F& sample, bool& result) const
42  {
43  result = g.sqr_mahal_dist(sample) < sqr_threshold;
44  return true;
45  }
46 
47  //: the threshold on Mahalanobis distance
49 };
50 
51 
52 #endif // vpdt_gaussian_detector_h_
bool operator()(const gaussian_type &g, const F &sample, bool &result) const
The main function.
A simple Mahalanobis distance detector for a Gaussian.
vpdt_gaussian_mthresh_detector(const T &thresh=T(2.5))
Constructor.
static const unsigned int return_dim
the functor return type.
vpdt_field_traits< F >::scalar_type T
define the scalar type (normally specified by template parameter T).
gaussian_type::field_type F
the data type to represent a point in the field.
bool return_type
the functor return type.
specialized template trait classes for properties of a field type
The field traits class (scalar).
gaussian_type distribution_type
the distribution operated on by the detector.
T sqr_threshold
the threshold on Mahalanobis distance.