extract hsv histograms from a given number of images stored in a local database