POV-Ray : Newsgroups : povray.general : converting rgb to spectra Server Time
9 Aug 2024 11:30:14 EDT (-0400)
  converting rgb to spectra (Message 10 to 19 of 19)  
<<< Previous 9 Messages Goto Initial 10 Messages
From: Chris Huff
Subject: Re: converting rgb to spectra
Date: 21 Aug 2000 23:05:08
Message: <chrishuff-87615D.22063021082000@news.povray.org>
In article <39a1d84c@news.povray.org>, "Halbert" <hha### [at] capitalnet> 
wrote:

> Psuedocode plagerized from Computer Graphics and Principals 2nd Edition:
...snip...
> This should be easily converted into a macro (assumming I haven't 
> made too many typing errors.)

Whee, Pascal...the last time I read Pascal I was trying to convert a 
demo program written in it to C. It was surprisingly easy, actually...
Here is an untested attempt at a straight conversion to POV:

#macro RGB2HSV(RGB)
    #local Max = max(RGB.r, max(RGB.g, RGB.b));
    #local Min = min(RGB.r, min(RGB.g, RGB.b));

    #local V = Max;

    #if(Max != 0)
        #local S = (Max - Min)/Max;
    #else
        #local S = 0;
    #end

    #if(S = 0)
        #local H = 0;
    #else
        #local Delta = Max - Min;
        #if(RGB.r = Max)
            #local H = (RGB.g - RGB.b)/Delta;
        #else
            #if(RGB.g = Max)
                #local H = 2 + (RGB.b - RGB.r)/Delta;
            #else
                #if(RGB.b = Max)
                    #local H = 4 + (RGB.r - RGB.g)/Delta;
                #end
            #end
        #end

        #local H = H*60;
        #if(H < 0)
            #local H = H + 360;
        #end
    #end
    (< H, S, V>)
#end

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: David Fontaine
Subject: Re: converting rgb to spectra
Date: 21 Aug 2000 23:36:05
Message: <39A1F30B.4FA04AB6@faricy.net>
Chris Huff wrote:

> In article <39A1A7FA.53ED54C8@faricy.net>, David Fontaine
> <dav### [at] faricynet> wrote:
>
> > I wrote a macro to do RGB<->HLS...
>
> And I have it on my system. :-)
> I just haven't reverse engineered it and written a POV conversion
> function yet. And it only takes care of one color space.

I know... The only others I know of are CMYK and spectra, what is HSV?

--
David Fontaine   <dav### [at] faricynet>   ICQ 55354965
Please visit my website:  http://davidf.faricy.net/


Post a reply to this message

From: Ken
Subject: Re: converting rgb to spectra
Date: 21 Aug 2000 23:41:45
Message: <39A1F5F5.571B77B8@pacbell.net>
David Fontaine wrote:

> I know... The only others I know of are CMYK and spectra, what is HSV?

http://www.inforamp.net/~poynton/Poynton-colour.html

-- 
Ken Tyler - 1400+ POV-Ray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Vahur Krouverk
Subject: Re: converting rgb to spectra
Date: 22 Aug 2000 02:47:00
Message: <39A2221F.B8F2E0D2@aetec.ee>
Chris Huff wrote:
> 
> In article <39A1A7FA.53ED54C8@faricy.net>, David Fontaine
> <dav### [at] faricynet> wrote:
> 
> > I wrote a macro to do RGB<->HLS...
> 
> And I have it on my system. :-)
> I just haven't reverse engineered it and written a POV conversion
> function yet. And it only takes care of one color space.
> 
> --
> Christopher James Huff

I've written conversion between RGB and HSV, HSL XYZ, xyY, YIQ color
spaces as C function in colour.c. (I've not tested it very much, hope I
haven't made too much mistakes in entering marrix constants). If someone
wants to add coversion support for POV-Ray language, then I can send
source code.


Post a reply to this message

From: David Fontaine
Subject: Re: converting rgb to spectra
Date: 22 Aug 2000 17:11:21
Message: <39A2EA59.F81B8ADC@faricy.net>
Ken wrote:

> David Fontaine wrote:
>
> > I know... The only others I know of are CMYK and spectra, what is HSV?
>
> http://www.inforamp.net/~poynton/Poynton-colour.html
>
> --
> Ken Tyler - 1400+ POV-Ray, Graphics, 3D Rendering, and Raytracing Links:
> http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/

Man, a person could spend their entire life studying color! I looked in my
encyclopedia too and found several pages on the Purkinje shift and
Bezold-Brucke effect, simultaneous and successive chromatic adaption,
tristimulus, etc, even the human brain's adjustments in percieved color and
color psychology...

--
David Fontaine   <dav### [at] faricynet>   ICQ 55354965
Please visit my website:  http://davidf.faricy.net/


Post a reply to this message

From: Chris Huff
Subject: Re: converting rgb to spectra
Date: 22 Aug 2000 17:54:47
Message: <chrishuff-8AC48D.16561022082000@news.povray.org>
In article <39A2221F.B8F2E0D2@aetec.ee>, Vahur Krouverk 
<vah### [at] aetecee> wrote:

> I've written conversion between RGB and HSV, HSL XYZ, xyY, YIQ color
> spaces as C function in colour.c. (I've not tested it very much, hope I
> haven't made too much mistakes in entering marrix constants). If someone
> wants to add coversion support for POV-Ray language, then I can send
> source code.

Sounds interesting...could you post the conversion functions to 
povray.programming or povray.binaries.programming?

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Chuck Roberts
Subject: Re: converting rgb to spectra
Date: 24 Aug 2000 08:52:27
Message: <39A51B52.30D1A6E0@accn.org>
Go to my raytracing page at:
http://www.crosswinds.net/~robertsc/raytrac2.htm . I have a link
for converting from RGB to spectra there.

Remco Poelstra wrote:
> 
> Hi,
> 
> I saw in a message from Peter Popov in reply to Feature request for
> pov3.5 (08/09/00 16:55), that rgb can be converted to spectra. That's
> what I need., since I want to convert the rgb value to a corresponding
> audio frequentie, and audio is spectra. Where can I find more
> information on doing so? (I'm a newbie on complex math, so it should be
> a little bit easy explained.)
> 
> Remco Poelstra

-- 
See my Free stuff page. It compares free website providers, and
lists free internet access providers.
http://www.crosswinds.net/~robertsc/free.htm

Win98 help file loaded with hints and tips, including securing a
Win 95/98 PC in a classroom setting. VB4 help file with lots of
code and hints. 
At http://www.crosswinds.net/~robertsc/


Post a reply to this message

From: Vahur Krouverk
Subject: Re: converting rgb to spectra
Date: 25 Aug 2000 03:32:01
Message: <39A62132.B898A45A@aetec.ee>
Chris Huff wrote:
> 
> In article <39A2221F.B8F2E0D2@aetec.ee>, Vahur Krouverk
> <vah### [at] aetecee> wrote:
> 
> > I've written conversion between RGB and HSV, HSL XYZ, xyY, YIQ color
> > spaces as C function in colour.c. (I've not tested it very much, hope I
> > haven't made too much mistakes in entering marrix constants). If someone
> > wants to add coversion support for POV-Ray language, then I can send
> > source code.
> 
> Sounds interesting...could you post the conversion functions to
> povray.programming or povray.binaries.programming?
> 
Ok, I'll do it after I complete this message.
povray.binaries.programming will be the group. I've made tests for
ensuring their correctness and I believe, that HSV, HSL and YIQ
conversions are correct (at least BMRT gave same output). Hopefully XYZ
and xyY are correct too, as they involve only matrix multiplication.


Post a reply to this message

From: Chris Huff
Subject: Re: converting rgb to spectra
Date: 30 Aug 2000 17:17:30
Message: <chrishuff-AB461B.16190530082000@news.povray.org>
In article <39A62132.B898A45A@aetec.ee>, Vahur Krouverk 
<vah### [at] aetecee> wrote:

> Ok, I'll do it after I complete this message.
> povray.binaries.programming will be the group. I've made tests for
> ensuring their correctness and I believe, that HSV, HSL and YIQ
> conversions are correct (at least BMRT gave same output). Hopefully XYZ
> and xyY are correct too, as they involve only matrix multiplication.

I downloaded it and will take a look at these. It would also help if you 
had a link to pages explaining what they *are*, but I can probably find 
that somewhere myself...do the XYZ and xyZ ones use a color matrix 
similar to my post_process filter?

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Markus Becker
Subject: Re: converting rgb to spectra
Date: 12 Sep 2000 09:47:23
Message: <39BE3588.F36F3A9A@student.uni-siegen.de>
Remco Poelstra wrote:
> 
> All right, I'll, but what is hue exactly? I thought it's the 'rotation'
> of the colorcircle.

You're right. And as the rotation (or angle) in the colorcircle it
corresponds directly to frequency.

Markus


Post a reply to this message

<<< Previous 9 Messages Goto Initial 10 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.