62 m_nElementsFilled = 0;
83 printf(
"error: nKernelSize must be greater 0 for CMeanFilter::SetKernelSize\n");
87 m_nKernelSize = nKernelSize;
92 m_pValues =
new float[nKernelSize];
99 for (
int i = 0; i < m_nKernelSize; i++)
103 m_nElementsFilled = 0;
108 if (m_nKernelSize <= 0)
110 printf(
"error: CMeanFilter::Filter called, but m_nKernelSize is invalid (%i)\n", m_nKernelSize);
114 m_pValues[m_nPosition++ % m_nKernelSize] = x;
115 if (m_nElementsFilled < m_nKernelSize)
119 for (
int i = 0; i < m_nElementsFilled; i++)
122 return sum / m_nElementsFilled;
CMeanFilter(int nKernelSize)
void SetKernelSize(int nKernelSize)