# Human perception in color mixing

Look at this image:

50% of its pixels are blue (0, 0, 255), 50% of its pixels are yellow (255, 255, 0).

When I look at my computer display from a distance where I cannot distinguish the individual pixels anymore, the whole image appears in some shade of green.

However when I use computer to mix these colors (e.g. apply gaussian blur on the image), the resulting color is dark grey (128, 128, 128).

This seems very wrong to me. The color mixing that we use in our computers is completely different to how our eyes mix the colors.

My question is:

Is there a color model, which would give me results more similar to how our eyes mix the colors?

• On my screen, the image simply looks like 50% gray until I zoom in so much that I can clearly see the individual blue and yellow pixels. But 50% gray is not the same thing as (128,128,128) in sRGB; please keep in mind en.wikipedia.org/wiki/Gamma_correction Commented May 25, 2014 at 11:23
• And for reasonable colour mixing on computer, first convert sRGB to some linear colour space, mix there, and then convert back to sRGB. Roughly speaking, in a linear colour space, if you double the RGB values, you will double the amount of light that your monitor is emitting. The colour space that we usually use in computer images is sRGB and it does not have this convenient property, mainly for historical reasons (non-linear response of old CRT screens). Commented May 25, 2014 at 11:29
• @JukkaSuomela: Interesting observation. Since both the yellow and blue have only maxed out primaries, the gamma correction of those will not make any change. For other colors the gamma correction would make difference of course. If I make the resulting grey (128, 128, 128) non-linear (for sRGB), I get (188, 188, 188) by applying sRGB gamma companding function. Is this the 50% grey you meant? What linear color space would you use? Commented May 25, 2014 at 12:28
• Zooming in and out in discrete steps changed the appearance completely at different zoom ratios. My brain or the video card were experiencing major illusions. || Related: If you take a CIE1931 colour chart you can VERY APPROXIMATELY draw a line between two colour on the chart and establish a position along the line based on the inverses of their amplitudes and arrive at a something like the colour you would see. So you can do eg Yellow phosphor + Blue LED summing and get some idea of the colour and of how it would change as the components change. ... Commented May 25, 2014 at 15:01
• @tomp: 188 is close. On my monitor, a solid rectangle of colour (186,186,186) looks very close to what I see in your example (if I put them next to each other, it is not easy to see any seam between them). And if I use a gamma-aware scaling in a photo editing software to downscale your example by 50%, I get a solid rectangle of colour (186,186,186). — I also tried your example on a low quality laptop screen, and I get some strange greenish shade of gray. A good sign that the laptop screen is not properly calibrated. Commented May 25, 2014 at 20:50

## 1 Answer

What you see on your screen is a bit different than what I see on my screen. If I sit back far enough from my screen (Apple CinemaDisplay 30", calibrated to sRGB, Gamma 2.2), then the first swatch looks to be an even toned gray. It's a lighter gray than the second swatch, which is definitely perceived as being darker, but it is still gray, not green. The lighter gray is more around 192,192,192 than 128,128,128.

First point, it is probable that your screen's color calibration is off if you see green rather than gray when sitting back a distance. The human eye should ultimately blur and otherwise average the blue and yellow pixels to gray because it's actually red, green, and blue subpixels emitting the light, and in the ratio they are emitting that light, all three subpixel components should be emitting roughly the same amount.

The reason we perceive the two differently boils down to sampling rate and the nature of the human eye. The Blue/Yellow checkered swatch is sparsely populated with the necessary color subcomponents...the spacing allows the more powerful and brighter yellow pixels to overpower the less powerful blue pixels (total value 510 vs. 255). There is something else that plays a role here as well, though. The human eye operates by sensing color on two axes...a blue/yellow axis and a green/magenta axis:

If each of your pixels in the checkerboard image were emitting all three colors (R, G, and B), then we would effectively get a dense luminance result, and we would see the proper 128,128,128 gray. That's actually exactly what your second color swatch is doing. However because of the sparse subpixel spacing, we end up with something more along the lines of R+G-B, and just B (or more accurately as far as eye response goes, -B). Were missing the R+B-G stage from the above image.

There is another side effect of our axial opponent-process vision stage that gives rise to the notion of "impossible colors", the inability to sense the same distinct colors at the same physical location at the same time. We can either see blue or yellow, but not both, at the same time at the same location. Here is a little test:

Allow your eyes to cross enough that the blue and yellow swatches overlay each other exactly, and focus in the cross in the center. You'll notice that you don't see green...your eyes will ultimately oscillate between blue and yellow, sometimes faster, sometimes slower, as your eyes respond to input stimuli they cannot actually handle. This is due to the actual response curve of our eyes:

Our eyes cannot actually produce green from spatially overlapping but otherwise distinct swatches of yellow and blue (its a biological impossibility). Blue and yellow can create green by being mixed, and our eyes can see that green, however it's because were actually sensing light in the greener part of the visible light spectrum...yellow and blue paint mixed together result in a different color of light being reflected, it isn't the same as what's occurring with the "impossible colors" test above. Spatially our eyes will average the sparse color into some form of luminance response. However because the actual light reaching our eyes falls entirely into the R+G-B opponent-process stage (you either have R+G or -B, but not both), were actually still sensing the SPARSE color information, distinct yellow and distinct blue, instead of the same density of color information as exists in your second swatch. This allows the color fighting problem that occurs with the color test above...we cannot actually mix the blue and yellow (which when we move far enough from the screen, are effectively spatially at the same locations) into green or gray. Hence the reason we see the lighter 192,192,192 gray rather than the darker 128,128,128 gray.

Now that the nature of color response in the human eye is out of the way, onto the question about color models.

There are a multitude of color models. There are color models that model color for a wide variety of purposes that suit a wide variety of color use. There are your additive models (i.e. RGB), subtractive models (i.e. CMY), your radial/mathematical models (i.e. HSV, HSB, HSL), and your perceptual models (i.e. Lab*).

We have a multitude of color models because each one allows us to WORK WITH color in ways that suit different tasks. When were building computer screens of camera sensors, it's easier to work with an RGB model. When were analyzing color in a purely mathematical way, mathematical, radial, or 3D models tend to be easier to work with. When it comes to modeling color in a way that mimics human perception, perceptual models work best. Some of these models are linear, some are (or can be) non-linear. Non-linear models are useful as they allow us to match the math to the response curve of whatever hardware or conceptual process were working with (i.e. computer screens have a Gamma curve.)

For modeling color in a perceptually accurate way, you will ultimately want to convert your color into Lab* space (Lab for short). Lab space is based on CIE's color model work that was done in the 30's and 60's. CIE LAB is a model that describes the visible color gamut, and is modeled in such a way that color transforms and comparisons are perceptually accurate (within certain reasonable limits...and, there are multiple CIE color models that each work a bit differently. Usually, CIE1931 is the most commonly used model.)

It is possible to transform color from RGB into Lab. There are a number of various approaches, and I won't go into them here. However, even though CIELab models the gamut of human vision, it is not necessarily going to result in the same thing as human vision if you perform something akin to a gaussian blur or basic median averaging process in Lab space. Lab DOES operate on a dual-axis model (blue/yellow and green/magenta), however the opponent process is something you would likely need to actually build into any averaging algorithm to get the same result as the human eye.

• Very nice answer, thank you. The averaging algorithm for scaling when using LAB color space is not enough, as you said. The resulting colour from sRGB yellow and blue is a bit blueish grey. My question is: Was there some research in this area or is it still unexplored area? Commented May 26, 2014 at 5:33
• There is research in this area, from the standpoint of the human perception of color. That's all of CIE's work. There are decades of studies and mathematical modeling and refinement of models in CIE's body of work that covers human visual perception in quite a bit of detail. There is also some fairly extensive study of human color perception by other bodies as well, from medical institutions to universities. In terms of matching human visual perception to computer color models, some work has been done (i.e. RGB->XYZ->Lab transforms), but I myself kind of threaded the pieces together here. Commented May 26, 2014 at 6:50
• I mean more the research in the area of models for mixing colors in CIE color spaces, not just their individual representation in color spaces. I know about the work of CIE in the field of color spaces, conversions, chromatic adaptation, color difference formulas etc. Commented May 26, 2014 at 10:43
• @tomp: I'm sure some research has been done. I know that tools like Photoshop, as well as more specialized tools like PixInsight (astrophotography editing tool) allow a considerable amount of their algorithms to be executed within Lab space. Someone must have researched the hows and whys to be able to make that possible. Commented May 26, 2014 at 16:21
• Aye, you can perform gamma-adjusted blending, however I am not sure that really takes into account the differences in the way human vision "averages" or "interpolates" information. Gamma-adjusted algorithms simply aim to work within the specs of the device, but they are still the same fundamental algorithms. Commented May 26, 2014 at 20:19