Calculate histograms by using BOWImgDescriptorExtractor. Add functions for saving mat.