Warning, always convert your colors to from sRGB to Linear RGB before doing any math on them, then convert them back to sRGB afterwards for displaying them.<p>sRGB is the familiar color space you all know and love, it's what your display uses, and it's what has those RGB numbers between 0 and 255. But it's not a linear color space.<p>First think of values as being between 0 and 1 instead of 0 and 255. To change sRGB to Linear, do X^2.2 (close to squaring the value). To change Linear back to sRGB, do X^(1/2.2) (close to a square root).<p>In Linear RGB, a value of 0.5 is halfway between black and white. You can put a stripe or checkerboard pattern next to the color value, and it will appear to be the same brightness. But in sRGB, a value of 0.5 is much darker. Linear RGB of 0.5 is roughly equivalent to sRGB of 0.73.<p>The actual method of conversion involves a complicated curve that isn't continuous, using X^2.2 is still an approximation.
>First, the average pixel is not what I would expect it to be at all<p>It looks like the averaging was done in default sRGB color space, with:<p>magick "$f" -resize 1x1 txt:-<p>Downscaling should instead be done in a linear colorspace. Human vision is non-linear, but the filtering required for downscaling is equivalent to blurring, which is linear because it's done optically not within the retina or brain. Using ImageMagick:<p>magick "$f" -colorspace RGB -resize 1x1 -colorspace sRGB txt:-<p>Additionally, JPEG supports chroma subsampling, which is usually enabled by default. I don't know what sips does, but with these small files you might as well use PNG and avoid the risk of losing color information this way.<p>This should produce results closer to human perception.
>The average pixel was not what I expected.<p>The average pixel doesn't look correct because human vision does not interepret shadowed colors as different colors. We first guess at the shadows, and then do some kind of inverse mapping from the shaded color space to the illuminated one before we "perceive a color". This is why the black,blue/white,gold dress illusion exists.
I'm of the belief that fruit and vegetable packaging is often designed to hide defects, and to make it harder to visually discern how fresh the produce is (on top of not letting you touch it).<p>Some examples.<p>Red netting on oranges makes it hard to see imperfections on the skin. Green netting does the same for avocados. Costco sells corn in trays that are cling wrapped with a wrap that is unmistakably designed to hide the ends of the corn (the easiest way to discern if corn has gone bad). Other fruits, and veggies like melons, onions, and potatoes have similar netting with colors that seem to be carefully chosen to maximize visual clutter.<p>Why aren't all the nets the same color?<p>Costco sometimes sells pears in plastic trays with multiple creases that cause reflections that make it very difficult to see what the pears inside look like.
It makes sense that adding red adds red (in addition to the avocado sacks you mention, I think of lemons’ yellow bags, limes’ green bags, and the red packaging/shelf lining and pink-tinged light in the butcher’s case)—but those images really do look strangely exposed to me.<p>Did you do exercise any specific control over the phone’s camera?<p>I wonder if the ring light might use the sort of general-market LEDs that underperform specifically at illuminating saturated reds and oranges in this range… see for example<p><a href="https://www.canada.ca/en/conservation-institute/services/conservation-preservation-publications/technical-bulletins/led-lighting-museums.html#a7c" rel="nofollow">https://www.canada.ca/en/conservation-institute/services/con...</a><p>and<p><a href="https://indiecinemaacademy.com/are-leds-ruining-your-projects-video/" rel="nofollow">https://indiecinemaacademy.com/are-leds-ruining-your-project...</a>
This is one of those things I knew on some subconscious level but never really thought about until now. Of course the red mesh makes them look more orange - it's basically grocery store color grading. Honestly kinda love how simple the trick is. No fancy tech, no marketing wizardry - just "put red stuff over orange stuff, profit." Makes me wonder what other dumb little visual hacks are happening around me that I'm not noticing at all.
I think the lighting/camera work doesn't help here. The first photo of the orange...doesn't look orange. It's really dark. In the photo from the shop they look orange.
Am i mossing something or is this really a blog post saying that if you put something red in a picture and compare it to the same thing without red, then the picture with more red, looks, well, more red?
In response to the observation the average pixel color is surprisingly brown, I'll take today's opportunity to induct some of my fellow HNers into today's lucky 10,000 by linking Technology Connections's "Color is weird" video (<a href="https://www.youtube.com/watch?v=wh4aWZRtTwU" rel="nofollow">https://www.youtube.com/watch?v=wh4aWZRtTwU</a>).
Something is off with those first two pics. The orange already looks red, not orange — with or without the bag.<p>If you look at the pic below where it shows the oranges in the store, they’re much oranger.<p>For a post about color accuracy, it seems odd the comparison pics seem to have some color imbalance to them.
The best oranges [0] I've had were half green. Fresh from the tree, but still plenty ripe.<p>It's my understanding that oranges for transport to colder countries are picked unripe and ripened in the holds of cargo ships. This ripening process is great at making the skin more orange, and OK at improving the flavour, but nowhere near as good for that as ripening on the tree.<p>So if I saw green patches on my supermarket oranges, far from the tropics, I'd be conditioned to expect them to be really good. They wouldn't be, of course.<p>[0] Satsumas? Clementines? I don't want to get into a debate about what taxonomically is an orange, but these were citrus fruit that turn orange in colour when ripe.
> Maybe the secret is to never buy bagged fruit, since it’s harder to evaluate the quality of each orange.<p>There's already so much food waste due to safe but blemished produce though!
I think the author is on the right track just needs to refine the assumptions a bit. Not sure if the method actually tests whether we perceive the oranges as more orange with red bags. Things like too small of a sample size, lack of any statistical analysis, uncontrolled lighting conditions, not controlling for phone camera, and simplistic color analysis (human eye is much more complex). Also lack of applicability to color science principles
The oranges he used were very ripe. Lately small oranges like tangerines have been very ripe for me. Sometimes when they are out of season they are borderline green, or actually have visible green on them, or are basically yellow. When they are so unripe, the red/orange bag makes a HUGE difference in how they look, it's night and day.
Funny experiment however you can change outcome of it just by changing white balance on the camera. I'm not sure if the creator is aware of that the camera in his phone is always choosing the white balance, and that he should setup manual mode and have constant light source for this to compare.
The blue labels in the bags probably make the oranges pop more being a complementary color.<p><a href="https://en.wikipedia.org/wiki/Complementary_colors" rel="nofollow">https://en.wikipedia.org/wiki/Complementary_colors</a>
I don't think averaging the color over the whole image is the right way to do this. When you buy bagged oranges you pick up a bag and look at it close, not squint at it from a distance.
OT Q: What are the mesh bags made of? They always leave a detritus of orange (citrus) or green (avocados) on the counter; we're definitely ingesting this stuff.
I mostly remember which stores sold me stuff that turned out to be better when I ate it. These days, that's often produce that looks not-so-great.
This is interesting because it shows us how a programmer thinks of a problem vs. how a psychologist or neuroscientist would think of this problem and highlights the lack of "human-ness" in programmer thinking.<p>I'm no fan of schools forcing STEM students to study boring electives but this is a prime example of why that might be useful.<p>The entire premise of the post is wrong - average pixel value has nothing to do with how orange the oranges look - it's all about perception.<p>Here's an example where the same exact color (pixel value) can be perceived as either light or dark depending on the context: <a href="http://brainden.com/images/identical-colors-big.jpg" rel="nofollow">http://brainden.com/images/identical-colors-big.jpg</a><p>That's what the bag adds - context - but the author hasn't made this connection.