![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
What are you trying to do?
The average of the components of a vector doesn't sound like anything
rational. The length of a vector sound much more useful.
--
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
It's for the eval_pigment stuff I've been using. I needed to convert a color
vector into a float value so I could use it for elevation. The best way I
could think of doing this would be averaging the components of the color
vector. I'm now using a macro instead of vlength, and it works great.
Warp wrote:
> What are you trying to do?
> The average of the components of a vector doesn't sound like anything
> rational. The length of a vector sound much more useful.
>
> --
> 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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Mon, 12 Jun 2000 15:40:32 -0700, SamuelT wrote:
>It's for the eval_pigment stuff I've been using. I needed to convert a color
>vector into a float value so I could use it for elevation. The best way I
>could think of doing this would be averaging the components of the color
>vector. I'm now using a macro instead of vlength, and it works great.
Use the NTSC conversion for rgb to luminance. You should see some examples
of it in the POV source. Two of them might even match. :)
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
What pov source? The actual code which makes POV-Ray?
Ron Parker wrote:
> On Mon, 12 Jun 2000 15:40:32 -0700, SamuelT wrote:
> >It's for the eval_pigment stuff I've been using. I needed to convert a color
> >vector into a float value so I could use it for elevation. The best way I
> >could think of doing this would be averaging the components of the color
> >vector. I'm now using a macro instead of vlength, and it works great.
>
> Use the NTSC conversion for rgb to luminance. You should see some examples
> of it in the POV source. Two of them might even match. :)
>
> --
> Ron Parker http://www2.fwi.com/~parkerr/traces.html
> My opinions. Mine. Not anyone else's.
--
Samuel Benge
E-Mail: STB### [at] aol com
Visit my isosurface tutorial at http://members.aol.com/stbenge
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
SamuelT <STB### [at] aol com> wrote:
: It's for the eval_pigment stuff I've been using. I needed to convert a color
: vector into a float value so I could use it for elevation.
So in practice what you are trying to do is to convert a color to b/w
(ie. a brightness value).
There's an exact formula on how each color component affects the brightness,
and I don't remember exactly the values, but this might be a good
approximation:
brightness = red*0.25 + green*0.6 + blue*0.15
--
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Mon, 12 Jun 2000 20:04:37 -0700, SamuelT wrote:
>What pov source? The actual code which makes POV-Ray?
Yes. For example, in png_pov.c you'll see:
color = (png_byte)floor((line_data[col][RED]*0.30 +
line_data[col][GREEN]*0.59 +
line_data[col][BLUE]*0.11) * 255.0);
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Ron posted this from the POV source at 6:30:
color = (png_byte)floor((line_data[col][RED]*0.30 +
line_data[col][GREEN]*0.59 +
line_data[col][BLUE]*0.11) * 255.0);
Perhaps I can use your idea+his values to make it work?
Warp wrote:
> SamuelT <STB### [at] aol com> wrote:
> : It's for the eval_pigment stuff I've been using. I needed to convert a color
> : vector into a float value so I could use it for elevation.
>
> So in practice what you are trying to do is to convert a color to b/w
> (ie. a brightness value).
> There's an exact formula on how each color component affects the brightness,
> and I don't remember exactly the values, but this might be a good
> approximation:
>
> brightness = red*0.25 + green*0.6 + blue*0.15
>
> --
> 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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Well, this simple macro seems to be working. It is a combination of your idea and
Ron's pasted code.
#macro Lum( Color )
Color.x*.3
+Color.y*.59
+Color.z*.11
#end
Funny thing, Photoshop's desaturation seems to be goofy. It gives unexpected
results, although the desaturation tool itself seems to be fine.
Warp wrote:
> SamuelT <STB### [at] aol com> wrote:
> : It's for the eval_pigment stuff I've been using. I needed to convert a color
> : vector into a float value so I could use it for elevation.
>
> So in practice what you are trying to do is to convert a color to b/w
> (ie. a brightness value).
> There's an exact formula on how each color component affects the brightness,
> and I don't remember exactly the values, but this might be a good
> approximation:
>
> brightness = red*0.25 + green*0.6 + blue*0.15
>
> --
> 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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
SamuelT <STB### [at] aol com> wrote:
: color = (png_byte)floor((line_data[col][RED]*0.30 +
: line_data[col][GREEN]*0.59 +
: line_data[col][BLUE]*0.11) * 255.0);
: Perhaps I can use your idea+his values to make it work?
It's not my idea. It's a commonly known equation.
Using those values it would be:
brightness = red*0.3 + green*0.59 + blue*0.11
--
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
SamuelT wrote:
>
> It's for the eval_pigment stuff I've been using. I needed to convert a color
> vector into a float value so I could use it for elevation. The best way I
> could think of doing this would be averaging the components of the color
> vector. I'm now using a macro instead of vlength, and it works great.
I see that Ron Parker and Warp already have suggested some conversion
formulas for your problem.
Here are links to some more info about such formulas:
http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
(Look at the end of item 5.2 - HSL, HSV)
(Rewritten html version of above page ?)
http://members.xoom.fr/scorpion/docs/txt/color_faq.html
(9.2 - Color look-up table to a gray scales)
http://www.inforamp.net/~poynton/notes/colour_and_gamma/ColorFAQ.html#RTFToC9
Tor Olav
--
mailto:tor### [at] hotmail com
http://www.crosswinds.net/~tok/tokrays.html
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |