Viewing a single comment thread. View all comments

7eggert t1_iylnt73 wrote

We have three kinds RGB receptor (except there are two variants of R, and some people have both, but that's beside the point). Also we have an intensity receptor for night vision. We disregard that too.

let's assume we know how bright a given wavelength appears in R, G or B. So we create an array of these curves, $brightness[R][$frequency] would result in how bright that particular frequency is perceived by that receptor.

Let's assume a spectrum of a given color by $given_color[$frequency] being the brightness of that frequency. (This can only be approximated because the slices would need to be about 1/∞ wide).

This program will give you an RGB approximation:

let $myRGB = { R = 0; G = 0; B = 0 }
for $f = $low_frequency to $high_frequency step $small_value
do
  for $c in (R, G, B)
  do
    $myRGB[$c] += $brightness[$c][$f] * $given_color[$f] * $small_value
  done
done
print $myRGB
1

xz-5 t1_iyltjei wrote

An important additional point is that the "RGB" your eye uses is not the same RGB that your computer screen uses. But it's easy to convert between the two once you have the three numbers.

1