 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
smartdude80 Guest
|
Posted: Wed Nov 16, 2005 8:51 pm Post subject: RGB algorithms |
|
|
Whats the algorithm used to get and set luminance, saturation, and hue for a
24-bit RGB color?
|
|
| Back to top |
|
 |
Bruce Salzman Guest
|
Posted: Wed Nov 16, 2005 9:00 pm Post subject: Re: RGB algorithms |
|
|
"smartdude80" <smartdude81 (AT) comcast (DOT) net> wrote
see section 5.3
--
Bruce
|
|
| Back to top |
|
 |
smartdude80 Guest
|
Posted: Wed Nov 16, 2005 11:27 pm Post subject: Re: RGB algorithms |
|
|
I looked here and found what i was looking for but the hue formula looks
real complicated to me:
Hue = cos^(-1) [(0.5*(R-G)+(R-B)) / ( ((R-G)^2 + (R-B)(G-B))^(0.5) )]
Can anyone translate this into a C expression? R, G, and B are of course
red, blue, and green. Im guessing the ^ symbol means exponent but i dont
know why they have cos^(-1).
|
|
| Back to top |
|
 |
Bruce Salzman Guest
|
Posted: Thu Nov 17, 2005 12:15 am Post subject: Re: RGB algorithms |
|
|
"smartdude80" <smartdude81 (AT) comcast (DOT) net> wrote
| Quote: | http://www.dcs.ed.ac.uk/home/mxr/gfx/faqs/colorconv.faq
see section 5.3
--
Bruce
I looked here and found what i was looking for but the hue formula
looks
real complicated to me:
Hue = cos^(-1) [(0.5*(R-G)+(R-B)) / ( ((R-G)^2 +
(R-B)(G-B))^(0.5) )]
Can anyone translate this into a C expression? R, G, and B are of
course
red, blue, and green. Im guessing the ^ symbol means exponent but i
dont
know why they have cos^(-1).
cos^(-1) is inverse cosine (or arccosine). |
double hue = acos((0.5 * (R-G)+(R-B))/sqrt((R-G)*(R-G) +
(R-B)*(G-B)));
--
Bruce
|
|
| Back to top |
|
 |
Steve Aletto Guest
|
|
| Back to top |
|
 |
smartdude80 Guest
|
Posted: Mon Nov 21, 2005 7:52 pm Post subject: Re: RGB algorithms |
|
|
| Quote: | cos^(-1) is inverse cosine (or arccosine).
double hue = acos((0.5 * (R-G)+(R-B))/sqrt((R-G)*(R-G) +
(R-B)*(G-B)));
--
Bruce
|
I wound up finding source code (that actually works) for doing this type of
conversion on the internet. Thanks anyways.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|