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