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.”

[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."

Sunday, May 8, 2016

What does Rx mean?

I was out to dinner the other night with my friend Bill. We were celebrating his retirement as a pharmacist. Just to be clear - I am not talking about my friend, Bill the Pharmacist who retired a year ago. Or my friend Linda the Pharmacist who also retired a year ago. Nor am I talking about my friend David, who hasn't said anything about retirement. Yet.

You can draw your own conclusions about why I have so many friends who are pharmacists. I will explain it as mere coincidence.

I don't know how the topic came up, but someone asked where the symbol "Rx" came from. Bill said it was an abbreviation for the Latin word for "recipe". The "x" on the tail of the "R" designates an abbreviation.

Inserting the Rx symbol in Word

For those who like simple answers to life's important questions, please feel free to accept that as your version of the truth. But for people like me, there always has to be a more contorted answer to simple questions. Here's what I told Bill.

It goes back to Hippocrates

Most everyone remembers Hippocrates. I'm not talking about that one character from some sitcom or other. I am talking about the Father of Medicine, the guy who is famous for the Hippocratic Oath.

Hippocrates taught that each part of the body is ruled over by one of the signs of the zodiac, as we see in the illustration below. Aries governs the head, Taurus governs the throat, as so on. Naturally, to understand how to care for the sick, a physician must understand astrology. Hippocrates had this to say about astrology: "A physician without a knowledge of Astrology has no right to call himself a physician." No kidding. He really said that.

The signs of the Zodiac calling dibs on this unfortunate fellow

This advice made it into the early Renaissance. 

Paracelsus (1493 - 1541) was a physician and philosopher who broke with Aristotle's view that we could discover truth by just thinking about things and making stuff up. Paracelsus taught that observation was more important than the dogma of the ancient Greeks. But he was stilled chained to the past in terms of astrology: 

“[Paracelsus] taught the doctrine of the microcosm and the macrocosm that forced the physician to become astrologer.”
(The Scientific Revolution 1500 – 1800, A. R. Hall, p. 133)

One historian tells us that Hippocrates' edict was alive and well in the early Renaissance.

“Between astrology and medicine, however, strong ties existed. The heavenly bodies were universally believed to influence human as well as other sublunary bodies: the good physician was supposed to always take astral influences … into account.”
(Medieval and Early Renaissance Medicine, Nancy Siraisi, p. 67)

Another historian is even more strident.

“Astrology also became closely associated with the practice of medicine: no reputable physician of the later Middle Ages would have imagined that medicine could be successfully practiced without it.” 
(The Beginnings of Western Science, David Lindberg, p. 279)

Here is yet another historian who tells us of how medicine was practice in medieval times:

“The progress of the planets, especially the Moon, was charted over succeeding days, with little or no observation of the patient himself, indeed the staunchest astrologer-physicians would claim that they did not even need to see the patient.”
(Astrology, A History, Peter Whitfield, p. 174)

Doing the patient's astrological chart was even more important than seeing the patient? Imagine that. I would hope that most of the readers of this blog find this at least a little bit absurd. 

I have written about the signs of mathematicians, and the signs of politically active rock stars. In both of these incredibly astute blog posts, I showed no correlation whatsoever between someone's sign of the zodiac and their proclivities. If you have read these blogs, you will likely have guessed that I don't rush to open my paper every day to read my horoscope. If you guessed that, you would be correct. I don't get the paper.

Belief in astrology reached a peak in the early 1600's, when techniques for predicting the positions of the planets were rediscovered. Thus we see many early scientists earning money through casting horoscopes.

“Like Kepler, Tycho stood with one foot in the past and was devoted to both alchemy and astrology. Like Kepler, he became a court astrologer and had to waste much of his time with the casting of horoscopes for patrons and friends; like Kepler, he did it with his tongue in his cheek, despised all other astrologers and quacks, and yet was profoundly convinced that the stars influenced man’s character and destiny though nobody quite knew how.”
(The Sleepwalkers, A History of Man's Changing Vision of the Universe, Arthur Koestler, p. 291)

I actual did an old-school search for the quotes above!

Mystic pseudo-science eventually gave way to true science as medical science began to provide demonstrable physical explanations for why we get sick. 

So what about the Rx symbol?!?!

Planets generally travel in one direction with respect to the stars. When a planets is on the other side of the Sun from us, the relative motion reverses and the planet appears to "flow upstream". When this happens, we say that the planet is in retrograde.  

In astrology, this is generally not considered a good thing. In particular, the astrological websites seem pretty unanimous about this being a particularly inauspicious time for surgery:

As an aside, this is a theory that could be quite readily tested, it would seem. Funny... despite the fact that the retrograde surgery problem is (apparently) well established in the astrological community, I am unable to find any direct tests of this. This is proof that the medical community is nefariously putting our health at risk strictly to make lots of money. Or maybe the lack of published research shows that the whole idea is preposterous nonsense.

Below we see a horoscope. I have circled two places where the symbol for retrograde have been used. The upper red circle shows the Rx symbol next to the symbol for Jupiter. The lower red circle shows the symbol for Venus with this symbol. This means that both Jupiter and Venus were in retrograde at this time. Rx is an abbreviation for "retrograde".

 Somebody's horoscope 
Thus, the Rx symbol is frequently found as part of the normal work that was performed by doctors around 1600. I haven't quite come up with an explanation for why astrologer/doctor/pharmacists picked this particular symbol to be the symbol for pharmacy. I will work on fabricating some sort of nonsense to explain that. In the mean time, if you are planning on surgery, avoid it when Mars or Venus is in retrograde.