|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Looking through the source for a formula to convert RGB values to grey
values, I've discovered a number of slightly different formulas, none of
which will convert RGB <1,1,1> to a grey value of 1. Perhaps there is some
good reason for this, perhaps not, but either way, does someone have a
formula that will convert in this manner?
Thought: Perhaps a standard conversion function could be implimented in a
future version of POV and replace all those ugly and different formulas in
the code.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Edward C." wrote:
> Looking through the source for a formula to convert RGB values to grey
> values, I've discovered a number of slightly different formulas, none of
> which will convert RGB <1,1,1> to a grey value of 1. Perhaps there is some
> good reason for this, perhaps not, but either way, does someone have a
> formula that will convert in this manner?
>
> Thought: Perhaps a standard conversion function could be implimented in a
> future version of POV and replace all those ugly and different formulas in
> the code.
Have you checked Poynton's color FAQ?
http://www.inforamp.net/~poynton/ColorFAQ.html
--
"My new computer's got the clocks, it rocks
But it was obsolete before I opened the box" - W.A.Y.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Edward C. <edw### [at] hotmailcom> wrote:
: Looking through the source for a formula to convert RGB values to grey
: values, I've discovered a number of slightly different formulas, none of
: which will convert RGB <1,1,1> to a grey value of 1.
Are you sure? The weights for the color components are calculated with:
0.2125*R + 0.7154*G + 0.0721*B
If we substitute R, G and B with 1's, we get exactly 1.
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Edward C." wrote:
>
> Looking through the source for a formula to convert RGB values to grey
> values, I've discovered a number of slightly different formulas, none of
> which will convert RGB <1,1,1> to a grey value of 1. Perhaps there is some
> good reason for this, perhaps not, but either way, does someone have a
> formula that will convert in this manner?
There are two that I have seen in POV:
0.2125*R + 0.7154*G + 0.0721*B (as mentioned by Nieminen)
and
(R+G+B)/3.0
I agree that it should be standardized (with a macro or inline function)
in the future.
-Nathan
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Nieminen Juha wrote in message <37c4f1f9@news.povray.org>...
> Are you sure? The weights for the color components are calculated with:
>
>0.2125*R + 0.7154*G + 0.0721*B
>
> If we substitute R, G and B with 1's, we get exactly 1.
I haven't seen that particular formula. I have seen in the code:
0.287R+0.589G+0.144B which gives 0.990 with 1,1,1
0.229R+0.589G+0.144B -> 0.930
And one which does work:
0.30R+0.59G+0.11B -> 1.00
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Edward C." wrote:
>
> Nieminen Juha wrote in message <37c4f1f9@news.povray.org>...
> > Are you sure? The weights for the color components are calculated with:
> >
> >0.2125*R + 0.7154*G + 0.0721*B
> >
> > If we substitute R, G and B with 1's, we get exactly 1.
>
> I haven't seen that particular formula. I have seen in the code:
> 0.287R+0.589G+0.144B which gives 0.990 with 1,1,1
> 0.229R+0.589G+0.144B -> 0.930
> And one which does work:
> 0.30R+0.59G+0.11B -> 1.00
Interesting. I never really looked that closely at them and so I thought
they were all the same and were correct. Strange.
-Nathan
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|