Extracted some classes from HaarViewer