If I have two colors defined by their RGB values, can I average the Red, Green and Blue values and then combine to define a third color that looks like a visual average of the two?
ie NewColor = (R1+R2)/2,(G1+G2)/2,(B1+B2)/2
EDIT1: Thanks for all the responses. For my current needs, I am only dealing with color pairs that are shades of the same color so I think that averaging them will work. However, I will try converting to Lab Space to make sure that assumption is true and the technique will be useful in the future.
EDIT2: Here are my results FWIW. Color1 and Color2 are my two colors and the two middle columns are the results of averaging in Lab space and averaging RGB respectively. In this case there is not a lot of difference between the two color and so the differences in the output from the averaging techniques is subtle.
This is hard. First, a set of RGB values doesn't define a color. They need to be interpreted in light of the color primaries to which they refer (the color space), such as sRGB, Rec.709, Rec.2020, Adobe RGB (1998), etc.
Further, RGB values as we normally encounter them are not proportional to linear light: they are "encoded" using a non-linear function (gamma). And sometimes (in video applications mostly) the value of "black" is not zero, but is offset from zero, usually 16 for 8-bit values. And "white" is not 255 but 235. sRGB and Rec.709 share RGB primaries, but their gamma functions are different.
The color space conversion starts with removing any black offset so that black is zero. If the gamma function has a breakpoint in it (like sRGB and Rec.709 do), you will need to carefully scale the RGB values so that "white" is 1.0.
Then, "decode" the gamma by doing the inverse of the original gamma function. (One answer suggested squaring the values, which is an approximation of gamma decoding.) Now you have linear-light RGB values in some color space. At this point you can convert from that color space to Lab space. Most conversions from RGB to Lab go through an intermediate color space called XYZ.
The steps as nested function calls:
Lab = XYZ2Lab( RGB2XYZ( gamma_decode( offset_and_scale( RGB ), gammaFunction ), RGB color space ) )
(Lab space was developed in the 1976 as an attempt to create a perceptually-uniform warping of the standard CIE XYZ space. (Luv was another attempt.) The idea is that the Euclidean (straight-line) distance between two colors that were just-noticeably different (1 "JND") would be the same distance for any two colors. The distance between two colors in Lab is known as 'delta-E'. The simple delta Euclidean distance formula is now called dE76. See https://en.wikipedia.org/wiki/Color_difference)
In your case, you could average the two Lab colors to get a new Lab color, then reverse all the conversions to get back to RGB in your chosen color space.
This will get you close, but is not guaranteed, simply because "color" is a human perception, not a physical quantity, and has been notoriously difficult to characterize reliably. Lab didn't actually work so well at being perceptually uniform. So rather than fix Lab, they proposed a new, more-complex delta-E function with another warp built-in: DE94. That was better, but not perfect, so another proposal emerged in 2000: DE2000. Also better but not perfect. See that Wiki page above for more info.
If DE2000 is not good enough (or too complex!) you might have a look at an alternative to Lab called ICtCp that is claimed to be more perceptually uniform than Lab.
Yes. You can average two colors together like that. It's the approach used by OpenGL to blend colors together (e.g., in creating mip maps for rendering distant objects, or rendering a 50% transparent texture). It is fast, simple, and "good enough" for many situations. It isn't completely realistic, however, and probably wouldn't be used on photograph-quality images.