Direct Graphical Models  v.1.7.0
PDFHistogram.h
1 // Histogram-based Probability Density function class
2 // Written by Sergey Kosov in 2015 for Project X
3 #pragma once
4 
5 #include "IPDF.h"
6 
7 namespace DirectGraphicalModels
8 {
9  // ================================ Histogram PDF Class ==============================
16  class CPDFHistogram : public IPDF
17  {
18  public:
19  DllExport CPDFHistogram(void);
20  DllExport virtual ~CPDFHistogram(void);
21 
22  DllExport virtual void reset(void);
23 
24  DllExport virtual void addPoint(Scalar point);
25  DllExport virtual double getDensity(Scalar point);
26  DllExport virtual Scalar min(void) const { return Scalar(0); }
27  DllExport virtual Scalar max(void) const { return Scalar(255); }
28 
34  DllExport void smooth(int nIt = 1);
35 
36 
37  protected:
38  DllExport virtual void saveFile(FILE *pFile) const;
39  DllExport virtual void loadFile(FILE *pFile);
40 
41 
42  private:
43  long m_data[256];
44  };
45 
46 }
virtual void addPoint(Scalar point)
Adds a sample point for PDF estimation.
virtual Scalar min(void) const
Returns the lower argument boundary of the PDF.
Definition: PDFHistogram.h:26
void smooth(int nIt=1)
Performs the gaussian smoothing on the histogram.
virtual void loadFile(FILE *pFile)
Loads the random model from the file.
virtual void saveFile(FILE *pFile) const
Saves the random model into the file.
Histogram-based PDF class (1D)
Definition: PDFHistogram.h:16
Interface class for Probability Density Function (PDF)
Definition: IPDF.h:16
virtual double getDensity(Scalar point)
Returns the probability density value for the argument point.
virtual void reset(void)
Resets class variables.
virtual Scalar max(void) const
Returns the upper argument boundary of the PDF.
Definition: PDFHistogram.h:27