add unit test and improve histogram segmentation

From OpenCV 2.3.1 to OpenCV 2.4 there have been some changes in the BGR2HSV transform that affected the histogram segmentation result too much. After normalizing the histogram in the interval [0, 255], the values of the bins are binarized using a threshold (128) so that all colours having enough importance are treated equally during the histogram back-projection. The result is that colour histogram segmentation has been relaxed and less image regions are filtered out.