Listing 4: Class definition for HoughAccumulator base class and LineHoughAccumulator class.
class HoughAccum { protected: int m_dx, m_dy; vector<int> m_accum; int m_rowLength; int m_numAccumulated; virtual bool DoAddPoint(int x, int y)=0; public: HoughAccum(); virtual ~HoughAccum(); virtual void Init(int dx, int dy)=0; virtual void Clear(); bool AddPoint(int x, int y); int GetCell(int row, int col) { return m_accum[row*m_rowLength + col]; } void SetCell(int row, int col, int value) { m_accum[row*m_rowLength + col] = value; } void GetAccumSize(int *numRows, int *numCols) { *numRows = m_accum.size()/m_rowLength; *numCols = m_rowLength; } int NumAccumulated() { return m_numAccumulated; } }; class LineHoughAccum : public HoughAccum { protected: vector<int> m_cosTable; vector<int> m_sinTable; virtual bool DoAddPoint(int x, int y); public: LineHoughAccum(int numAngleCells); virtual ~LineHoughAccum(); virtual void Init(int dx, int dy); };