Color histogram of the hue-values by using skimage

I want to get color histograms of RGB images. It should be a global histogram of the hue values in HSV color space, resulting in 256 features per image.
My code is as follows, but I’m not sure if this code is correct:

img_resize = transform.resize(image, (20,20))
rgb_to_hsv = color.rgb2hsv(img_resize)
histogram, edges = np.histogram(rgb_to_hsv, bins=260)

I am very unsure whether this is the right way to create color histograms of the hue values with skimage.

I would like to combine the color histograms with hog features, which were also extracted by using skimage with the following code:

image_gray = color.rgb2gray(image)
image_trans = transform.resize(image_gray, (20,20))
feat = feature.hog(image_trans, orientations=10, pixels_per_cell=(4,4), cells_per_block=(2,2), transform_sqrt = True, visualize=False)

I am a beginner working with skimage and would be very grateful for any help if my code is correct.

I haven’t used skimage functions for that but as far as I can read, the code looks fine.
I’m just wondering what happens when you ask for the histogram of a color image (RGB or HSV).
You could look at each color histogram separately or at the “additive” histogram

Is there a reason why you resize the image to 20x20 though ?

And currently the histogram will have 260 bins so 260 features, you mention you want 256 so you could change that eventually, especially if it is a 8-bit image.
Maybe you could show an example of an image and its resulting histogram

1 Like