Skip to main content.
June 30th, 2005

Quantization in HSV color-space

The past two nights I’ve been toying around with Matlab, making experiments with color spaces. Specifically, I worked on the idea of completely separating luminance from chrominance.
I did a few experiments, but the one that I want to report about is with HSV. HSV color model separates hue, saturation and value (or luminance/intensity). There are actually three similar but different models: HSV, HSL and HSI, but for my purpose, that doesn’t make much difference.
The experiment is about removing information on any of the three channels, to see which one is the most important, and how I can reduce the information while minimizing the visible artifacts.
I proceeded to created three different images, each leaving 2 channels intact, and one strongly quantized. For the intact channels, I kept the original 256 levels. While the quantized one was reduced to 8 levels.

Here is the original image:

Here a are the resulting images:

On the first row, there is the hue component, hue component with only 8 levels and then the image built using the quantized hue.
The second row expresses the same process, only this time quantizing the saturation.
On the third row the value (gray levels) is being quantized.

As expected, messing with the hue can be pretty messy. The color sensibly shifts and what’s green becomes brow !
The gray-level image is also visibly affected by quantization. It’s probably the worst of the three, but that doesn’t worry me, because it’s supposed to be compressed the JPEG way (quantization on DCT transformed data, in frequency domain).
Quantization on saturation is really not that much of a big deal, and that’s also what I was expecting.

So, now the real issue is with hue. The quantization clearly has some drastic effects. Using DCT would lead to some serious artifacts, as the ringing artifacts would bring, for example, cyan and yellow pixels around an original green one. Or perhaps I’m worrying too much. However, there would still need to be some special preprocessing, because hue values have a discontinuity on red. 255 and 0 are both very close to red. The lossy DCT would make a mess between 0 and 255 because it’s a drastic change.

Also it has to be noted that the quantization performed here was rather dumb, because I’m not selecting the most 8 used values, but I’m blindly rounding original values to 8 fixed ones (on a 256 scale that’s 256/8 = 32, selected values are 0, 32-1, 64-1, .., 256-1).
Using an actual palette of used values would ensure that no brown comes up where green should be. The green value would come into the palette as the most used one, instead of being snapped to a fixed value.

Next, I should probably try to properly quantize the hue, building a palette of used values. Possibly building separate palettes for separate areas of the image.

mumble

Posted by Davide Pasca in Image-processing

This entry was posted on Thursday, June 30th, 2005 at 1:43 am and is filed under Image-processing. You can follow any responses to this entry through the comments RSS 2.0 feed. You can leave a response, or trackback from your own site.

3 Responses to “Quantization in HSV color-space”

  1. rince says:

    leave the hue alone, mf!

  2. Davide Pasca says:

    hehehe battery.wav

  3. I BLOG YOU ! » Blog Archive » Printers, errands and coding says:

    […] Currently I’m applying transforming RGB to a luminance + chrominance system, that I simply call YC. It’s simpler than YCrCb, definitely similar to HSL which I’ve been playing with in the past. One problem with working with RGB with modern displays, is that things such as CoolType and ClearType, juggle around with R, G and B a lot, making it hard to compress them individually. […]

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>