Re: 16 bits grayscale images
- From: "eman2 agavesys com" <eman2 agavesys com>
- To: jcupitt gmail com
- Cc: gtk-app-devel-list gnome org
- Subject: Re: 16 bits grayscale images
- Date: Sat, 29 Sep 2007 07:28:39 -0700
Another popular choice is to walk the edges of an RGB cube in a loop.
So you have a red -> magenta gradient, then magenta -> blue, then blue
-> yellow etc. This makes for strong colour differences, but it's not
obvious from looking at the image which parts are hot or cold. So I
prefer heatmaps.
Yes I believe using the hue component of the HSV is equivalent to
walking the edge of the color cube.
I use the following snipped to convert transform values from 0.0-180.0
to the the RGB equivalent (obviously you can scale appropriately to
convert 8bpp images or as I do you can use this to translate to 24bit
true color on the fly. -eh
--------- <snippet> ---------
/* hue ranges from 0.0 to 180.0 degrees */
void hsv2rgb( float hue, int *rgb )
{
int p, sector;
static const int sector_data[][3]=
{{0,2,1}, {1,2,0}, {1,0,2}, {2,0,1}, {2,1,0}, {0,1,2}};
hue = max( 0.0f, hue );
hue = min( 180.0f, hue );
hue *= 0.033333333333333333333333333333333f;
sector = (cvFloor(hue))%6;
p = cvRound(255*(hue - sector));
p ^= sector & 1 ? 255 : 0;
rgb[sector_data[sector][0]] = 255;
rgb[sector_data[sector][1]] = 0;
rgb[sector_data[sector][2]] = p;
}
--------- </snippet> ---------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]