1 #include "PDFHistogram.h" 8 memset(
m_data, 0, 256 *
sizeof(
long));
17 memset(
m_data, 0, 256 *
sizeof(
long));
23 byte i =
static_cast<byte
>(MIN(255, MAX(0, point[0])));
30 byte i =
static_cast<byte
>(MIN(255, MAX(0, point[0])));
37 for (
int iter = 0; iter < nIt; iter++) {
38 memcpy(tmp,
m_data, 256 *
sizeof(
long));
39 for (
int i = 1; i < 255; i++) m_data[i] = static_cast<long>(0.25 * (tmp[i-1] + 2*tmp[i] + tmp[i+1]));
45 fwrite(&
m_data,
sizeof(
long), 256, pFile);
46 fwrite(&
m_nPoints,
sizeof(
long), 1, pFile);
51 fread(&
m_data,
sizeof(
long), 256, pFile);
52 fread(&
m_nPoints,
sizeof(
long), 1, pFile);
virtual void addPoint(Scalar point)
Adds a sample point for PDF estimation.
long m_nPoints
The number of samples, added with the addPoint() function.
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.
Interface class for Probability Density Function (PDF)
virtual ~CPDFHistogram(void)
virtual double getDensity(Scalar point)
Returns the probability density value for the argument point.
virtual void reset(void)
Resets class variables.