Tuesday, October 11, 2016

A backwards optical illusion

I think this is just downright weird. An optical illusion with a twist.

An illusion

I expect many of you may have seen the clever illusion that I show below. The gray rectangle on the left (the one surrounded by white) looks darker than the one on the right.

This illusion is the topic of the day!

Well, it looks that way, but it's not, really. All we need to do is join the two with a bar of the same color and the illusion goes away. Or, if you suspect that I am doing a little creative image editing, then cut two holes in a piece of paper, one for each square.

The illusion de-mystified

A (failed) attempt to explain the illusion

Why does this happen? To shed some light on the illusion (pun intended), I wanted to see if my camera saw the same thing. So, being the clever and resourceful guy that I am, I displayed this image on my computer screen. and took a picture of it with my Canon G10. The picture can be seen below.

What my camera sees when it looks at this illusion

The square on the left (white surround) has average gray values of (42.8, 45.6, 60.5). The one on the right (black surround) has average gray values of 34.4, 37.1, 10.9). The little square on the left has an average difference in brightness of 8.4 in the red channel, 8.4 in the green, and 10.9 in the blue. Aha!! Just as I thought!! The camera is seeing the same thing I am seeing!

(For those of you who noticed a mistake in my reasoning in that last sentence, just sit tight on your hands for a little while. Please don't spoil the surprise for the rest when I reveal the intriguing error.)

Why does the camera not see the two squares the same? In any optical system, be it a camera or an eyeball, there is scattered light - light that doesn't focus just the way we want it to. As a result, light from bright areas in the scene will scatter into dark areas in the scene. We call this, veiling glare.

The picture below is an extreme case of veiling glare. The photos above and below were taken of the same mastiff figurine and with the same camera and lens. In the one below, I fogged up the lens by breathing on it. Never do that, by the way. It will make your mastiff foggy. (I had a mastiff once... Bubba. I miss him.)

When a good dog gets veiling glared

Note that the black background didn't just turn gray. It took on some of the color of the dog. The fawn colored light coming from the fawn colored coat of Bubba should all have been focused on the image of Bubba at the sensor of the camera. But some of it wound up going somewhere else because of the temporary foggy imperfection in the lens.

This is extreme, as I said, but all lenses do this to an extent. A small portion of the average intensity of the image is added to all the pixels. That's veiling glare. But there is also a more localized effect. Going back to the image that my camera took of my computer screen, the gray square that is surrounded by white is made just a tad bit brighter because it is standing near all those other bright pixels. Just like when I stand next to Albert Einstein, Isaac Newton, and John Von Neumann, their brilliance scatters over me and I look so much brighter.

(Just in case you didn't know, John Von Neumann was one of the fathers of the computer, being credited with the idea of a stored program computer. And, an applied mathematician.)

My high school chess club
(from left to right) Newton, Einstein, me, and Von Neumann

So (prepare for the oops), I have just demonstrated that this effect - the effect of the illusion I started with - can be readily seen in images taken with a camera. And the effect is from the scatter that happens in the lens, be it the one in the eye or the one in the camera.

Say what?

Wait a sec. I think that's exactly backwards of what we perceive when we look at the illusion. The gray patch that is surrounded by white actually shines just a bit brighter on the retina, but it looks darker! How can this be?????!!?!

I gave a bit of a clue, when I mentioned my good friends Albert, Isaac, and John. If you happened to overhear me having a conversation with these gents, would you really think of me as being of their caliber? Or rather, would I  appear more dumber, since I would be compared to them?

Take a look again at my chess club picture. Have a close look at me, in the Gold's Gym shirt. I really don't think I have all that bad of a physique. In isolation, one might actually think I am rather buff. But standing next to those other mesomorphs, I am afraid I have to admit that I look like the anti-hero from a Woody Allen movie - a real nebbish.

The thing is, somewhere between the retina and the cognitive part of the brain, it all becomes about comparisons. The gray square on the left is compared to the white that it is next to. Because of that proximity, it is perceived as being darker than it really is. Similarly, the square on the right is perceived as being lighter due to its proximity to the black area.

Judging by the fact that we really can't "turn this effect off" just by thinking about it, the comparison must have been done prior to the signal reaching the cognitive brain. Maybe it's in the rods and cones? Maybe in the neurons? Or maybe in the lower limbic system?  This sounds like a topic for a another blog. Maybe I will reference another blogpost of mine about the famous "what color is the dress" fiasco.

But it is interesting to note that that the cognitive part of the brain does this same trick. The guy in the chess club pic looks like a wimp. I look dumb when you hear me converse with really bright people. The kid at the prep school who grew up in a middle class family feels like he/she had a life of squalor.

Summarizing...

I have described two effects here. First, there is light scattered in the remarkable optical system. This changes the amount of actual light that is registered in the retina. Areas adjacent to bright stuff have the largest effect.

Someplace in the early parts of  the human visual system, there is a larger counter-effect caused by a constant comparison of objects against what is nearby.

And so, we have a simple illusion that has more to it than one would expect.