3 ms·
The averaging is happening in RGB space, not an HSV-esque space. There's no obvious reason to expect the hue to end up averaged. For example, the RGB average o
by Strilanc 12y ago
The averaging is happening in RGB space, not an HSV-esque space. There's no obvious reason to expect the hue to end up averaged.
For example, the RGB average of red and blue is not orange; it's pink or purple.
- sp332 12y agoBut the world isn't in RGB space. If you take a bunch of samples in the whole color spectrum, then approximate them each into sRGB, the average probably won't move that much.
- Strilanc 12y agoActually, it could move a lot. For example, consider what happens when averaging (0,1) and (0,-1) in cartesian coordinates vs polar coordinates. In cartesian coordinates you get the midpoint at (0,0), but in polar coordinates both have the same length... so you just get a point a (1+1)/2 distance along (0°+180°)/2. That's either (1,0) or (-1,0) depending on the handedness of the coordinate system, off to the side instead of in between! The same effect happens in RGB vs HSV.
- Tloewald 12y agoActually the article is confused on this very point. I think it's actually implied that it's sampled in HSV and not weighted for saturation or value. Edit: his blog entry implies RGB, and it looks like the average color is actually brownish grey, which would be highly unsurprising to anyone who has mixed paint.
- sp332 12y agoI just tried my own suggestion. For a random sampling of wavelengths from 390 to 700, I converted each to RGB using this function http://stackoverflow.com/a/3407960 http://stackoverflow.com/a/3407960 Then I averaged the R, G, and B values. The result is 144, 122, 90 or #907A5A which is... a dim brown color, with a "hue" of 36 which is very orange. Edit: undid sRGB conversion since I think i did it wrong.
- Tloewald 12y agoGood thought, and I think that the warm bias in digital cameras (and human tastes) probably contributes as well.