# How is a 256 bin HSV histogram quantised?

I am doing some research on the ScalableColor descriptor in MPEG-7 and I came across this passage:

The descriptor extractions starts with the computation of the colour historgam with 25 bins in the HSV colour space with the Hue (H) component quantised to 16 bins, and Saturation (S) and Value (V) quantised to 4 bins each.

My statistics is a little rusty so could someone please explain (hopefully with an example) how the bins are quantised?

-

Quantisation is simply a transformation from a large range of possible values into a smaller range of possible values.

In the HSV colour space, H‌ue takes values from 0 to 360 degrees, while S‌aturation and V‌alue take values from 0 to 1. I believe (though I'm not positive) that for this process in Mpeg7 the quantisation is uniform, which would mean:

To get our Hue from a range of 0-360 into 16 bins, we would simply divide by `360/16`, or `22.5`, and then round down. So:

``````Hue    Quantised
0      0
22     0
23     1
44     1
45     2
...
337    14
338    15
359    15
``````

(One minor quibble: We need to map a hue of 360 to 0 before starting)

For Saturation and Value, we need to get from a range of reals in 0-1 into 4 bins, so we divide by `1/4`, or `0.25`, and round down:

``````Value   Quanitised
0       0
0.24    0
0.25    1
0.49    1
0.5     2
0.74    2
0.75    3
1.0     3
``````

(Here we have to make a call on rounding the quarter points)

In general, to quantise uniformly from a range of x-y into n bins, each bin gets a slice of width `(y-x) / n` in the original range.

You'd need to check the mpeg7 spec for whether this quantisation is to be carried out uniformly, though.

-