Computing the HSV histogram

From: Costantino Grana (prydechiocciolatinpuntoit_at_invalid.inv)
Date: 03/22/05


Date: Tue, 22 Mar 2005 17:05:52 +0100

In the MPEG-7 standard the HSV histogram is used to provide information on
the image colors. In particular, the HSV color space is quantized with 16 H
values and 4 S and 4 V values.

My question is if is there any way to quickly convert from RGB to a
quantized HSV color space, by means of a look up table. The direct way is
very slow, so I d'like to speed up the process a bit.

Thanks in advance,

-- 
/* Costantino Grana                                */
main(int c,char**o){char*s=c?"+L7?+;:7?+:OKIK+9?;9=;"
":+9?;:<:;+9?;;;:;+9<:;<::;+RLJ;K9+":1[o],t,a=!c,m;do
for (m=*s-'0',t=a?m/c:m%c;m>>7?c=1<<m+8,!a&&puts(&a)*
*&a:t--;printf("  \0/*"+a));while ((a^=3)||a[++s]);;}
/* Original code due to Chris Brown... impressive! */