00001 // This is mul/vpdfl/vpdfl_gaussian_kernel_pdf.h 00002 #ifndef vpdfl_gaussian_kernel_pdf_h 00003 #define vpdfl_gaussian_kernel_pdf_h 00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00005 #pragma interface 00006 #endif 00007 //: 00008 // \file 00009 // \brief Multi-variate spherical gaussian kernel PDF. 00010 // \author Tim Cootes 00011 00012 #include <vpdfl/vpdfl_kernel_pdf.h> 00013 #include <vcl_iosfwd.h> 00014 00015 //: Multi-variate spherical gaussian kernel PDF. 00016 class vpdfl_gaussian_kernel_pdf : public vpdfl_kernel_pdf 00017 { 00018 public: 00019 //: Dflt ctor 00020 vpdfl_gaussian_kernel_pdf(); 00021 00022 //: Destructor 00023 virtual ~vpdfl_gaussian_kernel_pdf(); 00024 00025 //: Create a sampler object on the heap 00026 // Caller is responsible for deletion. 00027 virtual vpdfl_sampler_base* new_sampler() const; 00028 00029 //: Probability density at x 00030 virtual double operator()(const vnl_vector<double>& x) const; 00031 00032 //: Log of probability density at x 00033 // This value is also the Normalised Mahalanobis distance 00034 // from the centroid to the given vector. 00035 virtual double log_p(const vnl_vector<double>& x) const; 00036 00037 //: Gradient of PDF at x 00038 virtual void gradient(vnl_vector<double>& g, 00039 const vnl_vector<double>& x, 00040 double& p) const; 00041 00042 //: Compute nearest point to x which has a density above a threshold 00043 // If log_p(x)>log_p_min then x unchanged. Otherwise x is moved 00044 // (typically up the gradient) until log_p(x)>=log_p_min. 00045 // \param x This may be modified to the nearest plausible position. 00046 // \param log_p_min lower threshold for log_p(x) 00047 virtual void nearest_plausible(vnl_vector<double>& x, double log_p_min) const; 00048 00049 //: Version number for I/O 00050 short version_no() const; 00051 00052 //: Name of the class 00053 virtual vcl_string is_a() const; 00054 00055 //: Does the name of the class match the argument? 00056 virtual bool is_class(vcl_string const& s) const; 00057 00058 //: Create a copy on the heap and return base class pointer 00059 virtual vpdfl_pdf_base* clone() const; 00060 00061 //: Print class to os 00062 virtual void print_summary(vcl_ostream& os) const; 00063 00064 //: Save class to binary file stream 00065 virtual void b_write(vsl_b_ostream& bfs) const; 00066 00067 //: Load class from binary file stream 00068 virtual void b_read(vsl_b_istream& bfs); 00069 }; 00070 00071 #endif // vpdfl_gaussian_kernel_pdf_h