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.

Tuesday, October 4, 2016

Blues in the night

Fall is upon us. Everyone in Wisconsin is either eagerly anticipating the lovely fall colors, or are dreading the onset of Seasonal Affective Disorder (SAD). I have already blogged about the color science of the autumn leaves, so, it's probably time for me to blog about the eye, color, and it's tawdry relationship with SAD. Along the way, I will talk about zeitgebers and circadian rhythm entrainment, the spectral response of retinal ganglia, and of course, the supra-chiasmatic nucleus! Hot Damn!

Public service announcement: If this is a medical emergency, please hang up and dial 911. If you are looking for some practical advice on dealing with something that is a little more than the winter blues, I would suggest having a look at the blog post from BetterHelp called Seasonal Depression Is More Than Just The Winter Blues. But if you want to understand what happens in your body that makes SAD happen, then please read on!

Are you getting sleepy yet?

Today's sleep-inducing lecture begins with melatonin. I think most everyone has heard of it, and everyone has used it, whether they are aware of it or not. Melatonin is the hormone that sends a wake up call to all the team leaders in our body that it's time to start wrapping up the day's activity. Melatonin makes us sleepy.


You can buy melatonin from your favorite drug store, supermarket, or neighborhood dope peddler. It is inexpensive, you can get it without a prescription, and it helps you get to sleep.

Alternately, you can get it from your local pineal gland. If you are a vertebrate, then it is quite likely that you own one of these hot little jobbies. The pineal gland is located kinda in the middle of your brain. It's just a tiny thing, but it'll put you to sleep faster than reading a blog post about seasonal affective disorder. The pineal gland is where the melatonin comes from. But only when the pineal gland is good and ready to give you that mellowing stuff.


But, how does the pineal gland decide when it's time to play Mr. Sandman?


I don't know these women, but I wish I would have done this video!

Getting in the rhythm 

What we need is a clock for Mr. Pineal. No. Check that. Mr. Pineal needs an alarm clock. No. Check that again. Mr. Pineal would do real well to have what my electrical engineering friends would call a phase locked loop. Essentially, this is an oscillator with the added feature of having an active mechanism to keep the oscillator in sync. In this case, the phase locked loop would keep in sync with the rotation of the Earth. By the way, the name of the phase locked loop for the pineal gland is the "supra-chiasmatic nucleus". (Not to be confused with the super-charismatic nucleus, AKA John the Math Guy.)

The job of the supra-chiasmatic nucleus

How does the SCN get synchronized? What is the signal that serves as a zeitgeber?

Aside: I throw in words like "zeitgeber" to make it sound like I know what I am talking about. I have learned through the years that every profession has a relatively small collection of words that act as passwords to get you in the door. Use them correctly in a sentence, and you get to join the club.

Zeitgeber is, of course, a German word. "Zeit" means "time", and "geber" means "giver". This is the official name of "that thing that keeps you in sync with the diurnal cycle".

There have been a lot of suggestions about what the zeitgeber (or zeitgebers) might be. Some obvious guesses are coffee, activity, loud noises, your spouse snoring, a cold or hot shower, a good breakfast, and social interaction. All of these will help us to wake up.

But, sadly, these are not the most effective way to actually reset our alarm clock. In other words, let's say I were to get a real job, one where I had to actually get up before noon every day. If I stop at Starbucks tomorrow at 6:00 AM and have a mocha with three shot of espresso, it will not make it easier for me to get up the following morning. That suprachiasmatic nucleus just keeps chugging along, thinking that 2:00 AM is a decent time to crawl between the sheets.

It took a lot of research, but eventually Science came to the conclusion that light is the primary zeitgeber.

Do you think it unromantic of me to see this sunrise and say "What a glorious zeitgeber"?

SAD and the clandestine pathway

Scientists found many animals that could easily be entrained to the day with light. Originally, it was thought that humans just didn't work this way. It wasn't until the late 1980s that it was found that 2,500 to 3,500 lux was required to activate the SCN. (A typical indoor setting is only a few hundred lux.)

SAD (so the theory goes) is merely what happens when the body is saying "it's time to sleep" when annoyingly happy people are awake being annoyingly happy. SAD is a failure to entrain the SCN during the winter when there is a dearth of sunlight.

Light therapy with full spectrum lights has been used to treat SAD. Historically, treatment of SAD has taken gobs and gobs of light, basically four fluorescent tubes at arm's length. Researchers found that it took a lot of light to entrain a human, and that the light from an incandescent bulb was not particularly effective. So-called "full spectrum" lights became the recommended therapy. Note that the difference between incandescent and full spectrum light is at the blue end. Full-spectrum light has a lot more blue.

It was only fairly recently (1991) that researchers found that the rods and cones in the eye were not the light receptors that kept the SCN in sync with the day. The actual pathway was through the network of nerves in the eye which is called the retinal ganglion. And guess what? The peak response of these puppies is in the blue region, somewhere between 460 nm and 480 nm. This is blue light, by the way.

Today, you can find light therapy boxes that use the much more efficient blue light to treat SAD. It is perhaps coincidental that there are blue LEDs with a dominant wavelength very close to the peak response of the ganglion.

See how annoyingly happy and productive she is?

Avoiding disentrainment

The Foundation for the Research and Investigation of Early Nighttime Diversions (FRIEND) recently published a study that showed that an alarming number of couples have recently forgone previous snuggling activity in preference to checking email and watching stupid cat videos on their cell phones and tablets. [This study involved a random sampling of couples living in my house. The study was published in a blog post from John the Math Guy, entitled "Blues in the night".]



This is a problem. First off, cuz I like snuggling. But perhaps more importantly, cuz many cellphones emit light in that critical region between 460 nm and 480 nm. In other words, the devices stimulate this pathway that tells the SCN that it is still daytime. My closest friend, Jeff Yurek, published a blog post that says that certain devices are less prone to this problem. [Jeff became one of my closest friends when he posted a link to one of my blog posts. I really am that shallow.]

Jeff says that the blue light from quantum dot displays is a bit further into the violet end of the spectrum than the critical region where the ganglion are sensitive. His article calls out the Vizio RS65-B2 as one TV that has a quantum dot display. Who wouldn't want one of these 65" TVs on teh wall in their bedroom?!?

But if you are thinking of something a bit more portable, I just tested my KindleFire HD, and found that it is probably less prone to messing with circadian rhythms.

By the way, I would be more than happy to test anyone's tablet for how susceptible it is to upsetting your biological clock. Of course, I won't guarantee that I will return the device. If I like it, I might just keep it.

Tuesday, September 20, 2016

Lemme ask a couple thousand of my friends

I think that crowdsourcing is a really cool idea. Crowdsourcing is where you ask a couple thousand of your closest friends to help you with some project - maybe to answer an important question. Who will win the Superbowl? Should I wear a red tie to the interview? Will FitBit stock go up? Will my doggy iPad be a successful product? And, most important, should I order another strawberry margarita, or move right on to my main course of Maker's Mark on the rocks?

Jimi doing some crowdsourcing on whether is vest was the coolest part of the 60's

Naturally, I have blogged about crowdsourcing before. After all, all great men repeat themselves. I had a blog on recommendation engines, and talked a bit about how Netflix cogitates on all your ratings in order to make sure you have a superlative movie viewing experience. In this Valentine's Day blogpost, I did a bit of crowdsourcing in the name of romance.

Opinion polls are an early form of crowdsourcing. The Nielsen company once solicited my opinion on TV shows and radio stations. I showed them! I didn't watch any TV, and only listened to classical music on the radio through the entire period. That'll show 'em.

As we are in a political season (and when aren't we?), we are inundated with the latest pontifications from pollsters. But can we trust the pollsters? Are they biased? Who rates the raters? I have an answer for that! Nate Silver is a prominent statistician who applies his science to meta-analysis - analyzing the analysis. Have a look at his webpage that rates the survey companies on how well they follow an unbiased protocol and on their accuracy. And check out this page for the latest compilation of presidential polls.

I don't know how I feel about these poll results

Opinion polls have one deficiency. In order to get a statistically significant sample size, you need to ask the opinions of a lot of people, and many of these people don't know or don't care. This is not the most efficient or reliable way to make predictions.

Let's say you had some reason to want to predict the outcome of the NBA playoffs. I dunno... maybe you had some sort of financial stake? (I assume you are like an owner or something... cuz betting on games is naughty.) One way to get a good prediction is to talk to some people who follow the basketball teams closely. Like me, for example. I can tell you, right off the top of my head, how many RBIs Peyton Manning had when he went up against Tiger Woods in the 2015 Stanley Cup. You definitely would want to get my opinions on Michael Phelps before you put money on Yankees to win the Superbowl!

(By the way, I advise against putting money on the Yankees for the Superbowl.)

The problem is... opinion polls don't take into account the expertise of the people being polled. I would argue that the opinion of ten experts is more reliable than the a good random sampling of 1,000 random people who are randomly clueless on the random topic.

You don't want the opinion of this random actor!

But, coming up with a panel of real experts on a random topic is a lot of work. Might there be another way that is almost as good?

Here's an interesting take... how about letting people tell you whether they are an expert? Oh. That's a bad idea. Ok, how about this... ask people to put their money where their mouth is?

Racetracks do this every day. And here is the interesting part: The odds on a horse are not based on the expert opinion of some expert. The odds at the racetrack are based entirely on crowdsourcing. When a lot of money has been bet on a given horse, the odds change. Curiously, the odds change in such a way as to make sure that the track makes money. What are the odds of the track making money!?!


You don't like racetracks and all the shady undesirables lurking around? I have an example of crowdsourcing where people declare their expertise with their checkbook. The stock market. If a lot of people bet on a given stock, the price goes up. If no one likes the company, the stock goes down. Each individual decides how much they are willing to pay to buy a stock, or how much they are willing to sell a stock for. Just like the racetrack, only with a different sort of shady undesirables hanging around.


Now I have set the stage for a clever idea: Let's say that your company is considering whether a given idea for a new product will pay off. You could give one person that job and hope he/she gets it right. You could get a committee on it, and watch the committee form sub-committees, do focus groups, pay for market research, etc. And two years later, one person will finally have to fire the committee and make the decision. Committees are always the best way to get decisions made fast.

Or (get ready for the cool idea!) you could set up a virtual stock market for your employees to invest fake money in a bunch of potential product ideas. By introducing money - even though it's fake - you get people to invest where they feel they have some expertise. And those who actually have that expertise will tend to invest "correctly" and then have more money with which to sway future ideas.

Of course, the details get a bit involved. There is some fancy math under the hood that is needed to simulate how the price of a stock goes up when you put money into it and goes down when you sell or short a stock. This math is called a "Market Maker". It has nothing to do with Maker's Mark, unfortunately.

The domain of mathcanics

There is a company in Milwaukee called IdeaWake that has developed some software to do all this. I'm happy to say that I helped them out, just a little bit.

Tuesday, September 13, 2016

The color of leaves

My burning bush, in the fall of 2009

I have a burning bush. Not the biblical kind, mind you. Euonymus alatus. The kind of bush that looks like a normal green bush for most of the summer, but then turns into a wild thing in the fall. (Discretion tells me this would be a good time to not mention my wife.)

Fall is coming. And my euonymus is doing it's magical chromatic transmogrification.

My burning bush, just starting to warm up

What better time to get out my spectrophotometer? Here are the leaves I measured - several spots on each of the lovely leaves.

Selected leaves from the bush

First step, I show the color in CIELAB values. This is an a*b* plot.

Color values (a*b*) of spots on the leaves

I look at this marvelous plot and it just makes me wonder "why"? What changes in the leaf to make this marvelous color change? I start by look at the reflectance spectra. This makes a cute plot, but I'm not sure I can gather much from it, other than verifying that there was a distinct color change. How about I look at the spectra?

Corresponding reflectance spectra

The reflectance spectra plot is a bit more interesting. From this, I can see three things. First, at the blue end of the spectrum, something is doing a whole lot of absorbing. Why do I say that? Because the reflectance is so low. Someone is stealing most of the blue photons! This is true of all the measurements, so I am going to say this is one pigment.

Second, I see that in the green leaves, there is something that absorbs a lot of light at the red end. It doesn't absorb as much in the green region.  Maybe it absorbs in the blue as well, but I can't tell. I'm going to call this a second pigment, and tentatively give it the clever name "green".

Third, in the red leaves, there is something that absorbs a whole bunch of green, but not much red. I'm going to tentatively name this proposed pigment "red". Again, a clever name choice on my part.

Now... I am going to make a bold assertion here. I think that as the leaf changes from green to red, the pigment "green" leaves the leaf and the pigment that I affectionately named "red" jumps in to replace it. Why do I say that? Note that the reflectance of the red leaves is pretty gosh darn high at 700 nm, but the really green leaves absorb a great deal of the light at 700 nm.  Clearly there isn't much left of whatever absorbs the 700 nm light. 

Despite not being a chemist, I am going to take the analysis one or two steps beyond my skill level. The reflectance spectra show a view that is useful for someone interested in the color of the leaves, since it looks at what the eye sees. But the reflectance view is not so useful to someone analyzing what the leaves is doing. For that, one would want to look at the absorbance spectra, AKA density spectra.

Absorbance spectra of leaves

There is no real magic math here. All I did was ask Excel to take the negative of the logarithm of each reflectance value. And what it gives me is a plot that is a gauge of the absorbed light. So, note that the "red" and "green" have been inverted like an euglena haplessly swimming on a microscope slide, oblivious to the fact that it is being watched.

Another nice feature of the absorbance plot is that it is kinda sorta a little bit additive. In other words, when you cut the concentration of a pigment in half, you kinda sort divide the absorbance in half. And even cooler, when you add two pigments together, you kinda sorta add the two absorbance spectra together. Need a bit more information on that? Check out my post on Beer's law.

With that knowledge in mind, I took a wild stab at what the spectra of three pigments might be, and  went further out on a limb to guess what the actual pigments might be. 

Plausible absorbance spectra of pigments in the leaves

Lignin is the brown pigment that makes grocery bag brown. Lignin is the bane of paper making. Paper mills go to great lengths to ask lignin to leave the pulp, cuz people like their paper to be white.  Did I mention that lignin is brown? I am pretty sure that lignin is in most all leaves, and this would account for the fact that all the leaves reflected very little light at the blue end of the spectrum. The lignin purloined the cerulean photons.

Chlorophyll is a pigment that everyone has heard of. This is what makes leaves green (by absorbing red and blue light) and is the active ingredient in photosynthesis (by using the energy absorbed of the red and blue light). Everything that I remember from elementary school science would be a lie if I didn't find chlorophyll in the leaves. I have proposed that chlorophyll absorbs a bunch of light at the blue end, but not a great deal. But this is just my guess.

And then we come to the red pigment. I am going to take a wild guess and say that the pigment is anthocyananin, mostly cuz I like the sound of it. And it makes it sound like the red leaves of a burning bush might provide you with all the anti-oxidants that keep you from getting into oxidants on the highway. Again, just a guess on my part.

The assignment of colors in the absorbance plot above is likely a bit confusing. I found myself getting confused. This is not an unusual condition for me. So, let's go back to the color scientist view, and show the reflectance plots of the plausible spectra of the three pigments.

Plausible absorbance spectra of pigments in the leaves

So. There you have it. Another discourse where I take a thing of beauty, the burning bush, and turn it into a lousy science lesson.

Tuesday, August 23, 2016

Webinar - The latest in color management for spot colors

I recently gave a webinar for the FTA entitled "What does a 50% of a Pantone 281 look like?" Here is a link to the webinar.

Tuesday, August 16, 2016

How does the brain focus the eye?

My eye doctor tells me it's time for some new glasses. When one reaches "a certain age", this is to be expected. This age could be puberty, or it could be old-fart-hood. I will let the reader guess which age applies best to me. 

As a guy who likes pondering things, this got me pondering. Just how does the brain focus the eye? Note that I very carefully asked about the brain's role and not the role of the eye. I'll get to that in just a moment, but first, a little bit about the ...

Mechanics of focusing

I did some googling on the question of how the eye focuses. I found a lot of interesting websites that explained the mechanics behind the focus mechanism. Here is one such diagram from a pretty decent article on the topic.


In the upper picture, we see that the lens is thin, so it focuses far away. In the lower picture, the lens is more rounded, so it will focus light from a closer distance. Interesting tidbit: This article points out that my kindergarten buddy, Helmholtz, proposed in 1855 that the upper image (focusing far away) was accomplished by tightening the ciliary muscle. As recently as 1992, it was suggested that just the reverse is true. Tightening the ciliary muscle has the effect of making the lens thicker so that it focuses near.

This focusing mechanism is rather nifty, in my opinion. Pretty much every lens that our optical engineers put together is a system of one or more single element lenses where you change focus by changing distances between components. This goes for lenses in cameras, in telescopes, in binoculars, and in optical microscopes.

Note that I very cleverly italicized the word "optical". I used this as a foreshadowing technique which set the reader up to expect that there might just be some other type of microscope, and that this other type of microscope might use some other mechanism to focus.

This focus-by-moving-stuff-around mechanism is not found in every type of microscope, however. The scanning electron microscope that you have in your basement uses electromagnets to focus the electron beam. A change in focus is accomplished through changing the current through the electromagnets. No moving parts!

I'm sure there are other examples of uber-cool ways that inventors have found to change focus that don't involve changing the position of lenses. Someday, I will do a patent search on that. What better way to spend an afternoon some rainy day?

The auto-focus algorithm

You may find it odd that me, a world-renowned color scientist, would just happen to make the connection between the mechanism that focuses the eye and the mechanism that focuses the beam in an electron microscope. If you find that odd, you probably don't know that way back in the mid '80s, I had the thrilling opportunity, as an as-yet-not-world-renowned applied mathematician, to work on a team that developed the world's first digital scanning electron microscope. I had the pleasure of developing the auto-focus software for this instrument.

Can you guess which handsome scientist is me?

So it was imperative for me to try to understand not just the focus mechanism, but the algorithm that is used. I spent a lot of time trying to puzzle out this engineering dilemma, and I wondered at the time what sort of solution that another engineer came up with. Unfortunately, in 1985, I did not have internet access, so I couldn't just check Wikipedia.

Now that I have internet access, I can check out Wikipedia. This source of all human knowledge describes a variety of auto-focus methods that make use of some sort of distance gauging device. The mechanism in my Canon G10 is even described. When the G10 is in auto-focus mode, it turns on a green LED. There are two line sensors that view the green image through the camera's lens. One sensor is looking through the far right side of the lens, and the other through the far left side of the lens. When the two images line up, then the lens is in focus. 

My Canon G10, in auto-focus mode

How do I know that the G10 uses this technique? I printed out a pattern of straight black lines on white paper, and tried to focus the camera on these. I found that the camera did a splendid job of focusing if the lines were vertical. But if the lines were horizontal the G10 was completely incapable of automatic focusing since the rangefinder just can't handle horizontal lines.

Getting back to me, since I am the topic of this blog post, when I was cipherin' on how to teach my electron microscope to focus, using a range-finder not an option for me. I had no device for measuring distance independently. I had to do something based on the image.

In case you are wondering what method I used, look under the heading in the Wikipedia article called "Contrast detection". I discovered the fact that the standard deviation of the intensity values in the image is maximized when the image is in focus. My auto-focus algorithm simply turned the focus knob on the microscope to reach the highest standard deviation. Note that Wikipedia clearly shows that someone stole my idea.

Focus by contrast

The two images below show what happens when you blur a square wave by a lot and a whole lot (first image), and by a little (second image).

If you think of "contrast" as the difference between the darkest and the brightest pixels in the image, then it is clear from the first image that a lot of blur will reduce the contrast.



The second image shows that a small amount of blur will not reduce the peak-to-peak measure of contrast. But if we define "contrast" as some measure of the deviation from the average signal level, then it is clear that a small amount of blur will tend to drive some of the pixels toward the average. This will be the fate of pixels that are near edges. Thus, the standard deviation of the image (being a measure of the deviation from the average signal level) is a measure that correlates with the degree of focus.



So, how does the brain focus the eye?

Guess what?  Science has an answer to the question of what algorithm the brain uses to focus our eyes! Or actually, science has a few answers.

Focusing the eye is known as "accommodation". Apparently, the brain combines two different mechanisms for accommodation. One mechanism is a range finder, and the other maximizes contrast based on the image.

Suryakumar [6] describes the range finder with the simple phrase "binocular disparity driven vergence accommodation". I translate this to: "The distance to an object can be inferred from the degree that the right and left eye must point inward in order to fuse the two images". This is a clue that the brain can use to determine how to focus.


World renowned applied mathematician
investigating the effect of vergence on focus

I tested this using very sophisticated equipment, with my own very sophisticated eyes. Full disclosure -- my eyes are somewhat less than perfect. It is possibly not relevant that I need glasses for my far-farsightedness. But quite possibly very relevant, I am an amblyope. I had lazy eye as a kid. Thanks to surgery when I was young, my eyes now track appropriately. But my brain does not fuse images, so I can't see in stereo like most people. 3D movies are completely lost on me.

But, even with my admittedly faulty equipment, it almost seems like there is a change in focus as I cross my eyes. And I can see Jerry Garcia, which is way cool.

So, this is one mechanism that the brain uses to focus our eyes. But it can't be the only one, since people are perfectly capable of monocular accommodation. Not only that, but they can focus with one eye closed.

I found a lot of scienterrific papers that stated that the brain uses some measure of blur to focus the eye, and that this is the primary mechanism. See the list below, with a sprinkling of pertinent quotations. However, I did not find much that described exactly how the brain measures blur. This is not a surprise, actually. I don't know of anyone who has a copy of the source code for the human brain, and it's likely that, if it exists, the code is not well commented.

A 1975 paper from Georgeson and Sullivan [7] described a processing step in the visual cortex that balances out the different wavelength channels in an image. They called this "contrast constancy". If I properly understand a paper from Cuffin and Mallen [4], they say that the focusing mechanism in the brain takes note of the gain that needs to be applied to the higher frequency parts of the image in order to maintain contrast constancy. They claim that this gain, or rather the inverse of this gain, is the metric that is used to focus the eye.

This is similar to my simple approach. I would argue that, since a change in focus has little effect on the contrast of the low frequency components of an image, the two methods are essentially equivalent. Measurement of the high frequency components is perhaps more specific, but measuring the overall contrast is less computation.

And that, my friends, is how the eye focuses.


Summary of selected research papers

[1] Leonard M. Smithline, Accommodative response to blur, Journal of the Optical Society of America Vol. 64, Issue 11, pp. 1512-1516 (1974)
“Blur is not the sole stimulus; it is a necessary cue, but not a sufficient one.”

[2] Phillips S, Stark L. , Blur: a sufficient accommodative stimulus, Doc Ophthalmol. 1977 Apr 29;43(1):65-89.
“It is suggested that the contrast constancy theory may explain these changes in dynamic behavior.”

[3] Ove Franzén, Gunnar Lennerstrand, José Pardo, Hans Richter, Spatial contrast sensitivity and visual accommodation studied with VEP (Visual Evoked Potential), PET (Positron Emission Tomography) and psychophysical techniques, Accommodation and Vergence Mechanisms in the Visual System, pp 91-114, 2000
“The most important stimulus for accommodation seems to be a blurred image which triggers the accommodative system to adjust the curvature of the crystalline lens thereby changing its refractive power.”

[4] Cufflin MP, Mallen EA, Dynamic accommodation responses following adaptation to defocus, Optom Vis Sci. 2008 Oct;85(10):982-91
“Blur is a major contributing factor in the closed-loop dynamic accommodation response.”
“Georgeson and Sullivan proposed that a compensation process occurred to counteract the optical and neural attenuation of high spatial frequencies by the human eye and restore the clarity of the image. This was termed contrast constancy.”

[5] Philip B. Kruger, Steven Mathews, Milton Kat∗, Karan R. Aggarwala, Sujata Nowbotsing, Accommodation without feedback suggests directional signals specify ocular focus, Vision Research, Volume 37, Issue 18, September 1997, Pages 2511–2526
“The results suggest that accommodation responds to changes in the relative contrast of spectral components of the retinal image and perhaps to the vergence of light.”

[6] Suryakumar R, Meyers JP, Irving EL, Bobier WR, Vergence accommodation and monocular closed loop blur accommodation have similar dynamic characteristics, Vision Res. 2007 Feb;47(3):327-37. Epub 2006 Dec 21.
“Retinal blur and disparity are two different sensory signals known to cause a change in accommodative response.”

“The similar dynamic properties between VA [vergence accommodation] and blur accommodation strongly suggest either a long final common pathway controlling the two systems or that the plant dynamics of the crystalline lens and associated structures may be the rate limiting step masking two different neural inputs. It is clear however, that the dynamic properties of the accommodative response are similar whether they are driven by disparity or by blur.”
http://www.ncbi.nlm.nih.gov/pubmed/17187839

[7] Georgeson MA, Sullivan GD, Contrast constancy: deblurring in human vision by spatial frequency channels, J Physiol. 1975 Nov;252(3):627-56.

"It is argued that spatial frequency channels in the visual cortex are organized to compensate for earlier attenuation [due to optics and neural effects]. This achieves a dramatic 'deblurring' of the image, and optimizes the clarity of vision."