Monday, 6 March 2017

What’s a Red Pixel? Explaining Why Those ‘Red’ Strawberries Aren’t Red

It’s all over Internet by now: the baffling picture of ‘red’ Strawberries, and the claim it does not contain any ‘red’ pixel.

There are a few versions going around the Internet, but for this post I downloaded the image that was originally posted by Akiyoshi Kitaoka‏ on twitter (with gamma: 1.0). Below you can see other images at different gamma levels. Clearly one can perceive the strawberries to be red in color; however, it is claimed that there are no ‘red’ pixels in the image. What does that statement mean?

A lot of people are claiming that this image has a lot of pixels with ‘R’ > 0 (meaning the red channel of the RGB image). Some others take a more strict definition of red and find many pixels with ‘R’ > 127. Still others are giving a counter argument that for pixels to be red, ‘R’ should be greater than both the ‘G’ and ‘B’ channel, i.e. ‘R’ > ‘G’ and ‘R’ > ‘B’.

Well I have a question for all these RGB thinkers: what color is the pixel with RGB values of [255, 254, 254]? It satisfies both ‘R’ > 127 and ‘R’ > ‘G’, ‘B’.

Its ‘white’… if you are still wondering.

So, how do we define ‘red’ pixels. One way is, instead of looking at the RGB values of pixels, to think in the language of ‘hue’, ‘saturation’, and ‘value’ or HSV. In the language of HSV, we need to find pixel with a ‘hue’ of ‘red’. Wikipedia gives a rather complicated definition of ‘hue’ as “the degree to which a stimulus can be described as similar to or different from stimuli that are described as red, green, blue, and yellow”.

Mathematically hue is defined as:

where hue (‘h’) then ranges from [0, 360] with both 0 and 360 implying ‘red’, 120 being ‘green’ and 240 being ‘blue.’

In simple language, hue captures the color of the pixel. Below you can see both the ‘R’ values and the ‘hue’ values (color coded to show the exact hue color) for the colorpicker image on the left (with hues mapped to 0-180 instead of 0-360). We can see that hue captures the colors accurately even if it is faded out, except when saturation is very low (look at the bottom of the image, which is almost white) where the hue estimates are a little off.

Now, given the understanding of hues, let us see what are the hues present in the strawberry image by Akiyoshi (gamma:1.0), again showing the true hue colors for each pixel (with hues mapped to 0-180 instead of 0-360).

Now, given the understanding of hues, let’s see what hues are present in the strawberry image by Akiyoshi (gamma:1.0), again showing the true hue colors for each pixel (with hues mapped to 0-180 instead of 0-360).

Clearly, with the exception of a few pixels here or there all the pixels have a hue between ‘green’ and ‘blue.’ Those few pixels with red hue (hue < 20, or hue > 160 in the above image) are due to the poor estimation of hue when saturation/value is very low, mostly white like pixels in this particular case as highlighted in the figure below.

In other words, they are not influencing our perception in any significant way.

Finally, below we can see the same for all the four different gamma levels along with the ‘R’ value of all pixels. Although in some cases ‘R’ is close to 200, nevertheless the hue only ranges between 60 and 120, which is mostly green-blue range.

And finally, to really drive home the point, do you see any red tone in this image:

I bet not, unless you’re so determined to see a red pixel you’re imagining them. Well, this image consists of the same pixels as the strawberry image, just rearranged as per a magic function.

I hope this really drives the point home that its the positioning of the pixels that gives a ‘red’ perception—the pixels themselves are not ‘red’. In fact, I checked, and there are no pixels where ‘R’ is greater than both ‘G’ and ‘B’. I hope this clears any doubts that there are ‘red’ pixels in the images. There are no ‘red’ pixels. The image is indeed a masterpiece, making us perceive ‘red’ without any pixel being ‘red.’


About the author: Nikhil Rasiwasia is the Principal Research Scientist at Snapdeal. He has previously worked for Microsoft, UC San Diego, and Yahoo. This post was also published here.



from PetaPixel https://petapixel.com/2017/03/06/whats-red-pixel-explaining-red-strawberries-arent-red/

No comments:

Post a Comment