Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Biology
BiologyBotanyMicrobiologyEntomologyEvolutionPaleontology
Chemistry
General ChemistryAnalytical ChemistryElectrochemistryOrganic Synthesis
Earth Science
GeologyMineralogyOceanographyMeteorologyEarthquakes
Physics
General PhysicsResearchRelativityParticle PhysicsElectromagnetismFusionOpticsAcousticsNew Theories

Natural Science Forum / Physics / Research / August 2008



Tip: Looking for answers? Try searching our database.

Math behind mixing two colors

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MM - 24 Aug 2008 21:07 GMT
Hi,

I am stuck at the math one needs to do to mix colors. Here is the
exact problem statement:
I am provided the intensities (a.u.) of all the wavelengths in the
visible range (400 to 670 nm). I know the RGB values (between 0-1) at
all the wavelengths. I need to mix all the wavelengths and find out
the color I would get. For example: If the intensity at 650nm is 1 and
rest are all 0 I would get a shade of red. If I have intensities of
0.5 at 530 nm (green) and 670 nm (red) then I should get yellow.

To simplify the above problem:
If I am given the intensity and the RGB value (between 0.0 and 1.0) at
all 3 channels, for two colors. How do I "mix" them so as to obtain a
new color. Remember the math should be able to satisfy all the basic
rules like:
1. 1 Red + 1 Red = 2 Red
2. Red + Blue + Green = White
3. The RGB value for the final color should stay between 0 and 1.
4. 0.5 Red + 0.5 Green = 1.0 Yellow BUT 0.99 Red + 0.01 Green NOT= 1.0
Yellow

Sorry for the long post. Someone please HELP!!

-mm
Ian Parker - 26 Aug 2008 14:43 GMT
> Hi,
>
[quoted text clipped - 21 lines]
>
> -mm

What you have to do is to sum up sensitivities at all your
wavelengths, and then you will get an apparent color. These cureves
are given here.

http://en.wikipedia.org/wiki/Color_model

The red curve is quite interesting. Blue is in fact a mixure of blue
and red as the red curve has 2 humps. It does not therefore work quite
as you are suggesting. You need to work out at each wavelength what
you need to get the color. You have to solve 3 simultaneous equations
in each case.

 - Ian Parker
MM - 29 Aug 2008 04:04 GMT
> > Hi,
>
[quoted text clipped - 35 lines]
>
>   - Ian Parker

Hi Ian,

Thanks for our reply. The wikipedia link that you referred me to
describes how one can express colors in numbers. There are different
ways (RGB, CIE, HSV etc) and I think one can convert from one format
to another as well. If I sum up all the intensities then I will have
the total intensity but of what color? For example: if if the
intensity of blue light if 1 (a.u.) and that of red is 0.05 then then
the total intensity is 1.05 but I dont have anything that tells me
that it should have a bluish shade. Is the weighted average of RGB
values the right way to go?

-mm
Tom Roberts - 29 Aug 2008 11:05 GMT
> The wikipedia link that you referred me to
> describes how one can express colors in numbers. There are different
[quoted text clipped - 5 lines]
> that it should have a bluish shade. Is the weighted average of RGB
> values the right way to go?

It's considerably more complicated than that, as people's retina
pigments vary (e.g. color blindness). For instance, IIRC most people's
"red" pigment has a secondary peak in the blue. The brain is HEAVILY
involved, and not all 3 colors are required for you to see a color image
-- the brain's image processing will infer colors that are not actually
present.

    I remember a striking demonstration at a colloquium by Dr.
    Land. He projected a red-and-white and a black-and-white
    image of the same scene next to each other. He then carefully
    merged them by aiming the projectors, and when the alignment
    was correct the image suddenly "jumped" into full color.

The best way to get a basic understanding is to play with a color wheel
-- on most computers selecting colors has an option to use such a wheel.
Certainly my Mac does. Or you can use RGB sliders and see the resulting
color, or CMYK sliders. But, of course, this will all be dependent on
the responses of YOUR eyes, and the pigments of YOUR monitor, and the
color processing of YOUR computer; other peoples' perceptions and
equipment will vary.

I believe forums about digital photography discuss this in detail.

Tom Roberts
Chalky - 29 Aug 2008 04:04 GMT
> > Hi,
>
[quoted text clipped - 27 lines]
>
> http://en.wikipedia.org/wiki/Color_model

Since the OP is given the RGB values for each wavelength, I don't
think he needs to worry too much about sensitivities, as these are
implied in the RGB values. Furthermore, since there are more colours
than names for them, it seems to me that he would be better employed
by displaying the resultant colours on a computer screen. This can be
done very easily in HTML using COLOR=(hash) xxyyzz where xx,yy and zz
are the RGB intensities translated into hexadecimal.

Bear in mind though that different screens display colour slightly
differently, as do different printers, unless carefully calibrated
using specialised equipment.
arivero@unizar.es - 29 Aug 2008 04:04 GMT
Hmm while this thread is interesting, it is not physics. The OP could
get best help in some biology forums, or even in art forums. It is
about the perception of retinal cells.

> > Hi,
>
[quoted text clipped - 35 lines]
>
>   - Ian Parker
Gerard Westendorp - 28 Aug 2008 04:26 GMT
> Hi,
>
[quoted text clipped - 4 lines]
> all the wavelengths. I need to mix all the wavelengths and find out
> the color I would get.

This is the same problem a color camera has to solve.
I think they use 3 filters, one for each of {RGB}. So you just integrate
the spectrum weighted by a filter function for each component.

Gerard
Thomas Smid - 28 Aug 2008 04:26 GMT
Just add the corresponding R,G,B values together for all the colours
you want to mix, then divide everything by the highest resulting
value. So in mathematical terms for n colours

R=R1+R2 +...Rn
G=G1+G2 +...Gn
B=B1 +B2+...Bn

r=R/max(R,G,B)
g=G/max(R,G,B)
b=B/max(R,G,B)

Thomas
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.