home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!utcsri!torn!news.ccs.queensu.ca!qucdn!polowinj
- Organization: Queen's University at Kingston
- Date: Wednesday, 12 Aug 1992 17:19:06 EDT
- From: Joel Polowin <POLOWINJ@QUCDN.QueensU.CA>
- Message-ID: <92225.171906POLOWINJ@QUCDN.QueensU.CA>
- Newsgroups: comp.graphics
- Subject: Re: Is there a mathematical relationship RGB -> wavelength?
- References: <1992Aug9.151055.25530@cis.ohio-state.edu>
- Lines: 27
-
- > For curiosity's sake, I was wondering if it is possible to take a set
- > of RGB color fractions and come up with an approximate wavelength of
- > the observed mixture. I suppose this could be done by just
- > interpolating between some known values in a table, but I would like
- > to know if there is a way to actually calculate the wavelength. Of
- > course, I'd also be interested in a formula to compute the RGB
- > fractions for a given wavelength.
-
- If you're interested, I've written a (relatively) short function in C
- which takes arguments of RGB values, computes a "brightness" value and
- the intensities of the two spectral colours (ROYGBV) present in the
- "colour" being described, and returns this information along with a
- description in words. For example, given RGB of 230, 208, 179, it
- determines that this has a "brightness" of 80%, a grey level of 70%,
- orange 15%, yellow 5%: "lt, sl yelsh org". (The routine needs some
- tweaking yet; on my monitor, this colour looks more like a yellowish
- orangey grey. But the spectral-colour separation isn't bad.) If
- you have wavelength info for some kind of arbitrary standard Orange
- and Yellow, you could probably then come up with a reasonable
- calculation of a wavelength for something which is 15% orange and 5%
- yellow. What exactly you'd do to get the wavelengths of colours which
- combine red and violet I don't know off-hand. The whole scheme is kind
- of arbitrary, but it seems to work fairly well.
-
- Joel
- polowin@silicon.chem.queensu.ca, polowin@chem.queensu.ca,
- polowinj@qucdn.queensu.ca
-