Wednesday, February 5, 2014

A revolutionary idea about revolutions

Nicolaus Copernicus, remember him?  He's the guy who challenged the idea that the Earth is the center of the universe, and that the Sun, the planets and all the stars rotate around it. His book, De revolutionibus orbium coelestium (On the Revolutions of the Heavenly Spheres), published in 1543, put the Sun at the center.

Way back in the 2nd century AD, Ptolemy had published a set of tables and formulas that would allow one to estimate the positions of the planets at any time in the past or future. His book, The Almagest, was indispensable for any astrologer. It's right up there with the Da Vinci Code on the New York Times list.

Copernicus saw the complicated system of circles on circles that Ptolemy had described and said "there's gotta be a better way". He hit on the idea that putting the Sun at the center would eliminate a lot of the complication. He saw this, not just as a computational artifice, but as reality. He developed the theory, he developed the tables, and published it.

One of Coperniucus' early attempts

In his preface to De revolutionibus, Copernicus expressed his fear at being “hissed off the stage” for proposing that the Earth moves. Based on the reaction that the book received, his fears were well founded. Protestant leaders quickly started hissing. The Catholic church took it’s time to respond, but joined the hissing.  There were philosophers on either side, and even the scientists of the day were generally not kind.

Copernicus versus the Bible

Copernicus' book was destined to run afoul of "the authorities", since the whole heliocentric thing ("the Sun in the center with the Earth going around") contradicted a whole lot of verses from the Bible. There are a number of verses that make it clear that the position of the Earth is fixed: 

The world is firmly established; it shall never be moved.
I Chronicles 16:30

[The Lord] has established the world; it shall never be moved.
Psalms 93:1

The world is firmly established; it shall never be moved.
Psalms 96:10

You set the earth on its foundations, so that it shall never be shaken.
Psalms 104:5

And the whole foundation thing -- that the Earth is on some sort of holder -- comes up a lot. We see it in Job 38:4, 2 Samuel 22:16, Psalms 18:15, Psalms 82:5, Proverbs 8:29, Isaiah 24:18, Isaiah 40:21, Isaiah 48:13, Isaiah 51:13 and 16, Ecclesiastes 10:16, Ecclesiastes 16:10, Jeremiah 31:37, Micah 6:2, Zechariah 12:1, Mathew 13:35, and Mathew 25:34. Now, being a math guy, I'm not so good at counting, but I think there are almost 20 places where the Bible tells me that there is something physically holding up the Earth.
Actual satellite image of the Earth on it's foundation

Other verses in the Bible state that the Sun is the one that is doing all the moving:

In the heavens he has set a tent for the sun, which comes out like a bridegroom from his wedding canopy, and like a strong man runs its course with joy. Its rising is from the end of the heavens, and its circuit to the end of them; and nothing is hidden from its heat.
Psalm 19:4 - 6

The sun rises and the sun goes down, and hurries to the place where it rises.
Ecclesiastes 1:5

On the day when the Lord gave the Amorites over to the Israelites, Joshua spoke to the Lord; and he said in the sight of Israel, ‘Sun, stand still at Gibeon, and Moon, in the valley of Aijalon.’  And the sun stood still, and the moon stopped, until the nation took vengeance on their enemies. Is this not written in the Book of Jashar? The sun stopped in mid-heaven, and did not hurry to set for about a whole day.
Joshua 10:12-13

So, I think it's pretty clear. If you take these verses literally, then heliocentricity is just dumb.

Reaction from the religious sector - Protestant

The Protestant religious leaders seem to unanimously regard Copernicus as sacrilegious. Andreas Osiander was the Lutheran minister who supervised the printing of De Revolutionibus. Osiander felt compelled to put his own spin on the book, just to make it clear that the Earth doesn't spin. He added a forward that made it clear that taking the Earth away from the center of the universe was just an artifice used to make calculations of the positions of the planets easier:
  
For these hypotheses need not be true nor even probable. On the contrary, if they provide a calculus consistent with the observations, that alone is enough.

Copernicus' Revolutionibus and Kesey's Revolution Bus

As another example, Martin Luther, who led the Protestant Reformation, had this to say about Copernicus (1539):

[Copernicus] wishes the turn the whole of astronomy upside down. But I believe in the Holy Scripture, since Joshua ordered the Sun, not the earth to stand still.

Melanchthon was a close friend of Luther’s, and his comrade in arms in the protestant revolution. He wrote the following in 1549:

The eyes are witnesses that the heavens revolve in the space of twenty-four hours. But certain men, either from the love of novelty, or to make a display of ingenuity, have concluded that the Earth moves; and they maintain that neither the eighth sphere nor the Sun revolves. … Now, it is a want of honesty and decency to assert such notions publicly, and the example is pernicious. It is the part of a good mind to accept the truth as revealed by God and to acquiesce in it.

John Calvin, another protestant reformer was equally disdainful in 1554. He was reported to have said

Who will venture to place the authority of Copernicus above that of the Holy Spirit?

That’s what Calvin was supposed to have said, anyway. He probably never said it. Just someone said that he said it.

Reaction from the religious sector - Catholic

Originally, the Catholic church was receptive to Copernicus' idea and urged him to complete the tables and get the book published. But this excitement waned after the book came out. The Catholic church felt threatened by the Protestants, but not nearly so much as they felt threatened by a heliocentric universe. Pope Paul V (1616) was pretty clear in his denouncement:

[The Copernican theory is] more scandalous, more detestable, and more pernicious to Christianity than any contained in the books of Calvin, Luther and of all other heretics put together.

Cardinal Bellarmine was quite succinct:

[The Copernican theory is] false and altogether opposed to Scripture.

Pope Paul V placed De Revolutionibus on the Index of Forbidden Books in 1616. A Catholic faced excommunication for reading this seditious work. The pope did make a revised version of the book available, however. The revised version of the Revolutionibus was careful to state that this was all just a hypothesis.
Books can be used for enlightenment

... and from the philosophers

Even the philosophers weren't all that tight with Copernicus's revolutionary idea about revolutions. In 1597, the philosopher Jean Bodin ridiculed Copernicus:

No one in his senses, or imbued with the slightest knowledge of physics, will ever think that the Earth, heavy and unwieldy from its own weight and mass, staggers up and down around its center and that of the Sun; for at the slightest jar of the Earth, we would see cities and fortresses, towns and mountains thrown down.

Pierre Gassendi, who we have to thank for the phrase "aurora borealis", was a bit more encouraging. He held that the Copernican system was an interesting hypothesis, but lamented that it was inconsistent with scripture.

The poet John Donne was also encouraging. In his satirical book Ignatius His Conclave (1611), he has Copernicus pounding at the gates of Hell, and yelling to Lucifer to be admitted. 

... and lastly, from the scientists

Copernicus was originally not well accepted among the astronomers, either. The most prominent astronomer of the time, Tycho Brahe, obstinately held on to his own model of the universe. The Tycho universe has the Sun, the Moon, and the stars all going round a fixed Earth, but the planets all make their way around the Sun.
Tycho Brahe doing something scientific on some sort of scientific thing

Thomas Blundeville, an English astronomer was one of the more positive of the astronomers:

Copernicus… affirmeth that the Earth turneth about and that the Sun standeth still in the midst of the heavens, by the help of which false supposition he hath made truer demonstrations of the motions and revolutions of the celestial spheres, than ever were made before.

Christopher Clavius, a contemporary of Galileo, was known in his day as one of the most revered astronomers. Today, he is known for two things: his steadfast refusal to accept the heliocentric model, and for the irony of having a crater on the Moon named after him. (Clavius did not believe Galileo's account of craters on the moon.)

You will recognize the name Marin Mersenne from the prime numbers that were named after him. This mathematician  published a paper in 1623 that pointed out the difficulties in the Copernican theory.

Descartes (from whom we get the phrase "I think, therefor I am", and "Cartesian coordinates") probably believed in the Copernican theory, but was carefully mute on the subject.

Even Copernicus’ pupils, Georg Joachim Rheticus and Erasmus Reinhold, both adherents to the heliocentric model, were forbid by Wittenberg University to teach Copernicanism.

Adherents to Copernicanism

It is stated by A. R. Hall (The Scientific Revolution 1500 - 1800) that there were only six people in the time between 1543 and 1560 who were adherents to Copernicanism. Among these were the disciple Rheticus, a bishop and a small group of mathematician / astronomers in England including John Dee, Thomas Digges, John Field and Thomas Recorde.

Giordano Bruno was a mystic philosopher who was a forceful advocate of heliocentricity. Bruno was burned at the stake in 1600. There are some accounts that say that he was executed for his Copernican views. While he did raise a ruckus in advocating the Copernican universe, there were more serious heresies that were his downfall.

Bruno preached that the universe is infinite, whereas, Copernicus had firmly held to the Aristotelian notion of a finite sphere of stars. But, the Copernican view falls out quite naturally from an infinite universe, since an infinite universe can have no center; and thus no special place for the Earth. Another consequence of an infinite universe is that there would be an infinite number of worlds just like the Earth, some of which may have people!

The displacement of the Earth from the center of the universe was difficult enough for the Church to accept, since it diminished the glory of Man. The idea that there are other children of God was just too much to take. 

Galileo was another early adherent to Copernicus' idea of placing the Sun at the center. His persecution by the Catholic Church is grist for another blog post.
"We shall sell no doctrines about heliocentricity before their time." [1]

A Preponderance of evidence

Speaking of Galileo, he built a telescope and pointed it into the skies. There he saw that Venus had phases, much like the phases we see of the moon. Whether this contradicts the Ptolemaic model is confusing, but it does show that Venus does not produce its own light. This in itself was heresy, just like Galileo's report of craters on the moon.

The next person to bring forth evidence against geocentricity was Kepler. He developed a set of three laws that pretty much require a heliocentric view of our dear solar system. The path of Mars, for example, is very neatly described as an ellipse instead of the complicated Spirograph curve of Ptolemy.

A Do-It-Yourself Ptolemaic Universe Kit

And then came Newton and his great colligation [2]. Newton brought together the laws of physics, the art of calculus, Kepler's laws and this new concept, the inverse square law of gravity, to describe the motions of the planets. A beautiful thing it was. Alexander Pope penned this epitaph for Newton:

"Nature and Nature’s laws lay hid in night;
God said Let Newton be! and all was light."

And yet... 

There are still some religious naysayers:

"This site is devoted to the historical relationship between the Bible and astronomy. It assumes that whenever the two are at variance, it is always astronomy—that is, our "reading" of the "Book of Nature," not our reading of the Holy Bible—that is wrong."
http://www.geocentricity.com/

"Observation and correct mathematics have proven geocentricity - that the earth is the center of the universe, with the sun revolving around the earth once each day."
http://www.genesis-creation-proof.com/geocentricity.html

"Many attempts were made to prove that heliocentricity was true and geocentricity was false, right up until the early 1900's. All such attempts were unsuccessful."
http://www.icr.org/article/geocentricity-creation/

"Dr Walter van der Kamp ... decided to examine the scientific evidence that the earth is not, indeed stationary at the centre of the universe. Perhaps to his surprise he found none. He found only flawed reasoning and experimental failure."
http://reformation.edu/scripture-science-stott/geo/index.htm


I have a simple message for you guys. You have a choice between giving up the notion that every single word in the Bible must be treated as literal fact, or giving up all the beautiful physics that has occurred since the time of Galileo.

------------------------
[1] For those who didn't catch this, the image at the left is Galileo. At the right is Orson Welles, who made a commercial for Paul Masson in which he said in a very Orson Wellesian voice "We will serve no wine before its time". Too bad it wasn't Gallo-leo wine.

[2] Colligation means "to subsume (isolated facts) under a general concept". Here are a few other definitions:

"Colligation, according to Whewell, is the mental operation of bringing together a number of empirical facts by “superinducing” upon them a conception which unites the facts and renders them capable of being expressed by a general law."
http://plato.stanford.edu/entries/whewell/

"The ancient Greek, Ptolemy developed a set of equations that could be used to predict the positions of the planets at any time. The equations were based on a lot of wrong assumptions like the Earth is in the center, and all the rest of the celestial bodies move in circles that revolved around circles. The model worked, at least to an extent.

"A millennium or so later, Copernicus decided that the Sun belonged at the center. (I hope everyone celebrated his birthday yesterday?) Then Kepler came along and decided that ellipses made the whole thing simpler, and then Newton provided the big colligation. The inverse square law of gravity was the grand unifying theory that explained the whole enchilada."
http://johnthemathguy.blogspot.com/2013/02/followup-to-spectrophotometric-romance.html






Wednesday, January 29, 2014

Gee whiz, it's cold!

A friend posted on Facebook something to the effect that the temperature outside had risen from 2 degrees all the way up to 4. Being a mathematician and a smart ass, my natural response was to say that it is twice as warm. You can only imagine the intense ripples of laughter as this comment echoed through the facebookiverse!

For all the silliness of my statement, there is something of a serious question buried in there. What does it mean to be twice as hot?

Let's review the original question, but in Celsius. 2 degrees F is -16.67 degrees C, and 4 degrees F is -15.56 degrees C. So... If I take the ratio in Celsius, I get 0.93. If I do the computation in Celsius, then 4 degrees F is 0.93 times as hot as 2 degrees F. That's just silly.

The problem is that both the Fahrenheit and Celsius scales are offset. Zero is not zero, so to speak. More precisely, zero thermal energy does not occur at 0 degrees F, or at 0 degrees C for that matter. Zero thermal energy occurs at absolute zero, which is -459.67 degrees F or -273.15 degrees C. At that point, there is no thermal energy.

So, let's repeat the computation. 2 degrees F is 461.67 degrees above absolute zero. 4 degrees F is 463.67 degrees above absolute zero. The ratio is now 1.004. Thus 4 degrees F is 0.4% hotter than 2 degrees F. It has 0.4% more thermal energy.

But then, I got thinking about it some more. The difference between 2 and 4 degrees F pretty minimal. I might not even notice it. Being from Wisconsin, I would wear a tee shirt, shorts and sandals at either temperature. While drinking a beer named after a cow.
A real Wisconsin drink for when it gets above 2 degrees F

But there is a big difference between 2 degrees and 32 degrees. At 32 degrees F, I would typically start sweating profusely. But according to the previous formula, I would divide 491.67 (32 degrees F) by 461.67, to get 1.065. 32 degrees F has only 6.5% more heat than 2 degrees F. Now that just doesn't seem right!

Then I remembered something that my buddy Jean-Baptiste Fourier told me. The rate of flow of heat is proportional to the difference in temperature. Like, if I set my thermostat to 20 degrees above the outdoor temperature, my gas bill will be twice as high than if I set it to 10 degrees above the outdoor temperature.
Winner of the 1819 Green Bay Flyfishing contest
and author of "Théorie analytique de la chaleur"
  
Let's say that my thermostat is set to a greedy 72 degrees F. When the outside temp is 2 degrees F, the temperature differential is 70 degrees. When it is a tropical 32 degrees F, the differential is only 40 degrees F. The house will loose heat 70 / 40 times as fast at the lower temperature. In other words, for a house at 72 degrees F, 2 degrees is 1.75 times as cold as 32 degrees F. That is more or less the difference I would expect to see in heating bills.

And if I compare 4 degrees F to 2 degrees F?  If I set the thermostat to 68 degrees F, then the ratio (68 - 2) / (68 - 4) is the answer. In terms of the utility bill, 4 degrees F is 3% warmer than 2 degrees F.

I have three answers so far:

1. If I just do dumb arithmetic, then 4 degrees F is twice as warm as 2 degrees F .
2. If we look at the total amount of heat energy, then 4 degrees F is 0.3% hotter than 2 degrees F.
3. My utility bill says that 4 degrees F is 3% warmer than 2 degrees F.

Of course, there is one other way to look at it. How cold does it feel?

I would be tempted to start with the temperature differential thing, but I am not sure what to use for the temperature of skin. My hands are pretty much always warmer than my wife's hands. Now think this through carefully... When we are outside making snowmen, the temperature differential between my skin and the cold air is thus bigger than her own temperature differential. So, it follows that it is colder out for me than it is for her.

I really don't know why she is always the one complaining that we need to move to California. 

Wednesday, December 18, 2013

76 shades of gray, part 1

The book got it wrong. E. L. James missed 26 of the shades of gray. And the CIE?  You know, the International Commission on Illumination, the good folks who brought you CIELAB? They got too many shades. In 1976, they said that there are 100 shades of gray. The truth lies somewhere in the middle, almost exactly in the middle. There are 76 shades of gray.

The book that everyone has read, but none will admit to reading
The plot

I am gonna do a little gedanken here. Gedanken is the German word for "thought", which is something Germans are pretty good at. When I use this word, I refer to a "thought experiment". Thought experiments are ones that occur just inside your head. Generally, gedankens are cheaper than super-colliders and NASA probes.

Suppose I were to start with a bucket of white paint and a bucket of black paint. Let's just pretend that the white paint is absolutely the purest, brightest white that is possible. Driven snow and all that. And let's just say that the black paint is panther-drinking-double-espresso-in-a-coal-mine-at-midnight black. Remember, this is a gedanken so I am allowed to use paints made of non-obtanium.

I start by painting one little tile with the white paint, and another with the black paint. Oh, did I mention? I also have an unlimited stock of little tiles along with my impossibly white and black paint.

Next I fill a cup with the black paint and add one tiny drop of white paint. I mix this up, and use it to paint another tile. Can I tell the difference between the black tile and the one-drop-of-white black tile? Probably not. But with the infinite patience that I am only capable of in a thought experiment, I do this exercise one drop of white paint at a time until I can just barely tell the difference between the black and the slightly contaminated black. I discard all the in between tiles, so that I now have three tiles: pure white, pure black, and almost pure black.

Now, with the infinity squared patience that I am only capable of imagining in a gedanken, I continuing adding white paint, one drop at a time, saving out those tiles that are just noticeably different from the ones I already have. When I reach the stage of a tile that is so white as to be indistiguishable from the pure-as-the-driven-snow white, I stretch my back and put away my paints. After all this, how many tiles do I have? In other words, how many shades of gray are there?

A few of the gray tiles from my collection

I did this, and came up with 76 shades, including pure white and pure black. Well, I didn't actually do the physical experiment. To be perfectly honest, I got bored before I even finished the gedanken. I asked my computer to do that for me. It didn't seem to mind. Of course, I did notice that my computer didn't get me a birthday present this year. Maybe I'm just reading too much into that. I'm sure that there will be a great big package under the Christmas tree with a tag signed "With love from John's Laptop".

Details please?

Let me put a little more meat on that turkey. The CIEDE2000 [1] color difference between L*a*b* = {0, 0, 0} and (1, 0, 0) is 0.575. That means if I add just enough white to my pure black to bring the L* up to 1, then the color difference is 57.5% of a "just noticeable difference". It would follow, then, that I need a bit larger jump to make it noticeable, like almost twice as big. As a second guess, I take 1 / 0.575, which is 1.739, and that comes out pretty close. A few more interations, and I get L* = 1.734. If I believe in CIEDE2000, then this L* value is just noticeably lighter than pure black.

I can repeat this process. L* = 3.442 is just noticeably lighter than L* of 1.734. The sequence goes: 0.000, 1.734, 3.442, 5.124, 6.782, 8.814, ...

Plot of the 76 just noticeably different gray values

The plot above is getting dangerously close to something that is dangerously interesting. If we look at it correctly, it is one dimension of a uniform color space (UCS). To explain what that means, let me start by giving an example of a not-so-uniform color space: CIELAB. As I explained in my post What difference does it make, the perceptible size of a unit step in CIELAB varies depending on where you are.

Here's what we have to do to make a UCS from the plot above. In the graph above, the y axis is the L* values, going from 0 to 100. The x axis is just the count, that is, the first L* value in the list, the second L* value, the third, and so on. Let's give the x axis a name: L00, meaning an L* like thingie that is based on CIEDE2000.

What do I mean when I say it is based on CIEDE2000?  By definition, the difference between L00 of 47 and L00 of 48 is 1.0 ΔE00. By extension, the difference between L00 of 43 and L00 of 53 is 10.0 ΔE00. Once you have created the magic look up table, the complicated formula for computing CIEDE2000 is gone.

I have zoomed in on the graph above to illustrate finding L00 and computing a color difference. We can determine the L00 value of 35, by tracing along the red line from the y xis at 35, over to the curve, and then down to the x axis to get an L00 of approximately 24. Similarly the blue line tells us that an L* of 41 is about an L00 value of 29.

If I want to compute the color difference between the two L* values 35 and 42, then you take the difference between their respective L00 values: 29 in 24 is 5 ΔE00.

Computing CIEDE2000 with a nomograph

This provides a way to compute CIEDE2000 without going to the ugly formula [2]. This in itself is perhaps convenient, but not really all that exciting. The thing that is a tiny bit exciting is that this method allows us to get around the warranty for calculation of CIEDE2000. We can compute the color difference when  ΔEab is greater than 5.0.

I know that you are excited, and are fixing to send me an email to ask for a spreadsheet with this lookup table, but hold off until the second part of this post, in which I unveil a simple formula to do the L* part of the CIEDE2000 calculation.

---------------------
[1] Wondering about CIEDE2000? Visit a previous post of mine.

[2] Caveat - this only takes the L* value into account. This simple method will not work when a* and b* are involved!

Wednesday, December 4, 2013

Visual accuity and color

As the only John the Math Guy around, you can imagine that I get a lot of questions.  I do. Thousands of questions a month. Normally they start out with "when are you gonna..." and end with "pick up your dirty socks?" or "get home from the bar?" or "fix the door knob?" But every so often, I get a question that isn't a thinly veiled command. Here is an example.

"How does visual perception of sharpness (acutance, resolution, and contrast all considered) vary with color?"

    - if fine marks need to be visually evaluated and black is not an option, what other color is the next best choice?
    - where has an MTF at one frequency vs wavelength plot been published?

    My usual references; Wyzecki and Stiles, Hunt, Zakia and Todd, etc.
    don't seem to address this particular issue. A new edition by
    Lambrecht and Woodhouse gets tantalizing close, but their emphasis is
    primarily black and white photography.

    Any suggestions?
Larry

Wow! An intelligent and interesting question! And I think I can provide a decent answer!

I am sure you have noticed that when you look at yellow halftones with the naked eye, you really can't see the dots, even when you can see the color. This fact leads to your question, since it implies that visual acuity somehow depends on wavelength.

The sensors in the eye are either rods or cones. The rods are largely active when old guys like me get up in the middle of the night to go to the bathroom. In normal daylight, these are pretty much saturated, so they don't have much effect on vision.

The cones are the sensors in the eye that are most important under daylight. If I were haughty, I would say something like "under photopic rather than scotopic conditions." And I would likely slip those words into casual conversation whenever possible. Much like ice cream cones, the cones in the eye come in several flavors. Not quite as many as Baskin Robbins, though. There are only three flavors of sensors in our eyes: cherry, mint, and blueberry.


Unretouched photomicrograph of Burt Baskins' retina

Some sadly mistaken people call the sensors in our eyes "red, green, and blue". Real color scientists who don't like ice cream call them L, M, and S for long, medium, and short wavelength. Red, green, and blue are not quite appropriate since the cones don't exactly line up with what we would think of as red, green, and blue. The L cone (the reddish one) overlaps quite a bit with the M cone (the greenish one).

The spectral response of the S, M, and L cones

Here comes the important part. There are more of certain types of cones per square millimeter than there are of others. In the fovea (that's the very central part of the retina in the center of our field of view), only about 5% of the cones are S cones. So... these cones are less tightly packed than others. So... our resolution (visual acuity) is less with the S cones. 

Look at the spectra of yellow ink. 

The reflectance of yellow ink is down at 5% to 10% in the 400 nm to 500 nm range, and close to the reflectance of paper above 500 nm. The S cones are the only cones that are sensitive in this range, so our ability to see yellow halftone dots is because of the sparsity of S cones in the fovea. And that, my friends, is why you can't see yellow halftone dots without a magnifier.

By the way... there is this company called Beta Industries that sells this really cool microscope that illuminates a sample with blue light so that you can look at yellow ink with just your S cones. You can illuminate with red light to see cyan, and green light to see magenta as well. But the really fun one is yellow ink and blue light.

Let's get back to the original question. Clearly yellow would be the worst possible choice for making dots on the paper that are just barely visible. Clearly, black is the best ink. Of the other two, which is preferred?

Generally speaking, there are twice as many M cones as there are L cones, but this varies from individual to individual. This means that, in general, the eye has better visual acuity in the green region of the spectrum, and somewhat less visual acuity in the red.

Let's say we are considering what is going on in the green region of the spectrum, from 500 nm to roughly 600 nm. Which ink shows the most contrast against white?  In other words, which ink has the lowest reflectance in this region? If we are limited to the four basic inks, both black and magenta have low reflectance in this region. So, if we want a single ink, then magenta would be the second choice if black is unavailable.

Cyan ink shows a bit of contrast against white in the green region (look at cyan ink under green illumination to see this), but has a fairly decent contrast in the red region. Thus, one would expect that cyan would have decent visual acuity, but not quite so much as the magenta.

But, as I said: 1) there is a wide overlap between the spectral range of the L and M cones, so we can't really think of there being a sharp distinction between L and M in terms of wavelength, and 2) there is quite a bit of variability in the relative number of L and M cones in different people, so one rule may not apply to all people.

If you are allowed a bit larger range of inks, then blue ink would be best, since it has good contrast both in the green and red regions of the spectrum. But if blue is being made by overprinting cyan and magenta inks, then register could cause problems.

One more consideration is the strength of the ink. Obviously, if you print at a higher density, you have better contrast. This would tend to favor black ink over cyan and magenta (which are typically printed at comparable densities), and both would be favored over yellow.

So, all in all, I would go with magenta ink, if all you have available is CMYK. If you have a spot color available, I would go for a dark blue. You can quickly check the contrast by viewing the ink under green illumination.

Wednesday, November 20, 2013

What difference does it make? (part 2)

Let's see... where did I leave off in part 1?  Our hero, Albert Munsell left us with a posthumous challenge. He developed this wonderful color space -- a way of organizing crayons [1] -- which has for some strange reason become known as the Munsell Color System. This is one of the oddest things I have ever seen in science history, by the way. One of the basic rules in the history of science is that you never name something after the person who invented it!


The wonderful Munsell Color Space had this wonderful trait that it is "perceptually linear". Well at least mostly. The thing is, there was a lot of effort put into making sure that pairs of colors that are adjacent kinda felt like they were the same distance apart as any other pair of adjacent colors.

But, the Munsell color space is not measurable, that is, I can't just put a color meter on an object and have it tell me the position of that color in Munsell units. So, they invented CIELAB -- but it did not quite have that perceptual linearity that Munsell had bragging rights to. If you took a one unit step in any direction from a given point in CIELAB space (that is, from one color), it probably wouldn't look to be the same size as a one unit step away from some other color. Also, a step in one direction (like in the direction of higher chroma) may not look to be the same size as a step in another direction (like in the direction of a slightly different hue).

So, what's a color scientists to do!?!?!

Taming of the ΔE

As I write this, I am sitting in a hotel in Hong Kong, sipping on a Coke that I bought for the alarming sum of 32 dollars (Hong Kong dollars, mind you). My wife is currently back home. For the sake of the discussion, let's say that she is in a bar in Wisconsin, listening to reggae music [2]. Also for the sake of the discussion, let's say she is also drinking a Coke, for which she paid four dollars. And let's say that my buddy Dave, who lives in Sweden, is drinking a Coke that he paid three euros for. And let's say that my buddy, Steve, in England is also drinking a Coke that he got for 2.50 pounds. While the absolute numbers are different, for each of us, the perceived cost is about the same. All of us are getting equally ripped off for drinking carbonated sugar water. 

Such it is with the adjustment that has been done to color differences. I don't mean that we are getting ripped off when we order a color difference margarita, but that there is a local exchange rate that is used to convert between actual numbers and perceived cost.

Let me 'splain a bit more about the details of that local exchange rate.

Enter CMC

CIELAB came along with a method for determining the distance between two colors. It is called ΔE. Technically I should say that it was called ΔE. Now, it's called ΔEab to distinguish it from its antecessors, which we will enumerate shorthly. ΔEab is computed in the normal Pythagorean way with all those hypotenuses and square roots and all that. It's just the distance that you would measure with a tape measure, as if the colors were all laid out in a physical model of color space. Don't let anyone tell you it's more complicated than that. A ΔEab is defined as one step in any direction, and was originally intended to refer to one "just noticeable difference".

The error in ΔEab assessment of color difference can be generally characterized by saying that higher the chroma (richer color) the larger the overestimation of a color difference. R. McDonald noticed this in 1974, and proposed a fairly simple method to correct ΔE values. I don't know this for sure, but I believe McDonald worked for J P Coates Thread Company [3]. This work all lead to ΔEJCP79.

In Old McDonald's formula, the differences in L*, a*, and b* are first converted into ΔL, ΔC, and ΔH. These represent the difference in lightness, in chroma, and in hue. I show below ΔC in green, and ΔH in red.


This is where my Hong Kong dollar analogy comes in. These three differences are then scaled, each according to the position of the colors in CIELAB space. The scaling is shown below. I didn't bother to show how to compute SL, SC, and SH, mainly because I'm lazy. 

The ΔEJCP79 Color Difference Formula

This formula was from 1979. But that gosh darn McDonald kept working on this formula. He, along with Clarke and Rigg, published a modification in 1984. This modified version was standardized in 1986 by the Colour Measurement Committee of the Society of Dyers and Colourists. They named it after their own group: ΔECMC.

The formula embodied a few general ideas that are summarized in the artist's conception shown below. First, the collection of all colors that are viewed as being "too close to tell the difference between" are described by an ellipsoid in CIELAB. Second, those ellipsoids get more elongated as you move away from a neutral gray color. Third, all the ellipses are tilted about the neutral axis, that is, they point to a* = b* = 0.

Artists conception of CMC just noticeably difference ellipses

This color difference formula has been successful. According to a recent poll by IDEAlliance, ΔECMC is currently the most commonly used color difference formula in the print industry, with 45% of the respondents saying this was the formula they used to specify color tolerances.

The menu gets longer

The CMC formula was updated in 1987 by Luo and Rigg and called the BFD color difference formula. Don't ask what me what BFD stands for, cuz I don't know. But it's probably not what you are thinking. For some reason, BFD never took off. Maybe because people thought it was not a Big Friggen Deal?


Then came ΔE94, which was accepted as a trial standard by CIE in 1994. This color difference formula is a simpler version of the CMC formula with similar performance. The CIE, by the way, is a standards organization which fits under the ISO standards umbrella. The name stands for International Commission on Illumination. For those of you who noticed that "Illumination" does not start with the letter "E", note that the committee goes under the French name Commission Internationale de l'Eclairage.

Dong-Ho Kim wrote his PhD dissertation in 1997 on yet another color difference formula. Excuse me... I meant colour difference formula, since his work was done at the University of Leeds in England. The formula was known as LCD for Leeds Colour Difference.

Like BFD, Dr. Kim's formula never got taken to the prom. Perhaps he didn't have a good publicist? Or perhaps his work was overshadowed by the work of the ISO committee TC 1-47, which published CIE 142-2001. This document introduced ΔE00 which is also known by the euphonious name "CIEDE2000".

The CIE was a bit circumspect about this formula. The document describes a recommendation, and not a standard. "A period of use, testing, and reporting by the user community will precede a determination on whether to make the new method a standard."

Now, I don't want to say the formula for ΔE00 is ugly, but let's face it. When it was born, the doctor slapped it's mother. This formula gives Stephen King nightmares. Seriously, the formula is complicated enough that I have had two different people send me spreadsheets to debug. There is an oft referenced paper that provides a data set for testing implementations of the formula.

From the standpoint of an applied mathematician, I honestly worry about all the fitted parameters. To understand why this is a concern, have a look at my blog post on when regression goes bad. Still, the standards group in the printing industry, TC 130 (which I happen to be a member of) recently ratified this as the color difference formula of choice.

Remember how ΔECMC gave us ellipses for just noticeable difference, and that the ellipses all pointed toward the neutral point? CIEDE2000 gives us quasi-ellipses which sometimes don't quite point to neutral.

Quasi ellipses, shown in a*b*, all of which have radius of 2 ΔE00

To recap, we have ΔEabΔEJCP79ΔECMC, ΔEBFDΔE94, LCD, and ΔE00. Seven color difference formulas, arranged in chronological order, with every other one catching some users along the way. (I am guessing that the next ΔE formula won't be shopping for a prom dress any time soon!) Which one is best? Generally speaking, the last formula, despite it's distinct lack of pulchritude and parsimony, agrees better with psycho-physical testing. The CIE has gone from it's original stance of "suggested formula" to "standard formula".

What about a uniform color space?

Remember my analogy about Hong Kong dollars? Wouldn't it be nice if we had once single currency that applied to colors everywhere in color space? If we could somehow warp color space so as to match human perception, life would be so much easier. Or so I think.

One problem that would go away is the so called "which color do I use to define my ellipse" problem. I glossed over this problem when I introduced ΔECMC, but consider this: with ΔECMC, the color difference between color one and color two is generally not the same as the color difference between color two and color one. In this formula, the first color is always used to "calibrate the ruler" for measuring color difference. ΔE00 solved this problem by defining an imaginary color midway between the two colors you are comparing.

Another fall of the "which color do I use to define my ellipse" problem is that ΔE00 has a warranty of 5. It is not recommended for color differences greater than that.

Really, what we want is not a way to distort ΔL*, Δa*, and Δb* values for any particular color, but rather a way to distort the whole color space so that the whole Pythagorean thing works. Apparently, I am not the only person who had that thought. Here are some folks who have entered the sweepstakes for the best uniform color space:

Labmg (Colli, Gremmo, and Moniga, 1989)
ATD (Guth, 1994)
DCI-95 (Rohner and Rich, 1995)
LLAB (Luo, Lo, and Kuo, 1995)
??? (Tremeau and Laget, 1995)
CIECAM97 (CIE standard, 1997)
RLAB (Fairchild, 1998)
IPT (Ebner and Fairchild, 1998)
L*’a*’b*’ (Thomsen, 1999)
DIN99 (DIN standard 6176, 2000)
CIECAM02 (CIE standard, 2002)
QTD (Granger, 2008)
LEaEb(Berns, 2008)
LAB2000 (Lissner and Urban, 2010)

Wow. I think this just goes to show ya. People want this uniform color space, but it's not a simple task to come up with one. One can only hope that some dashing young math guy will one day come up with a simple equation that gives us a uniform color space. Just think of the fame and fortune that this guy will receive!

---------------------------
[1] Interesting point of history here: Munsell developed a set of crayons. The rights to these crayons were purchased by Binney and Smith in 1926 to augment their Crayola line of crayons. I assume that most of my readers have heard of these.

[2] For those who are not familiar with Wisconsin, this is one of the few states where there are more bars than churches. The majority of these bars will be featuring a reggae band. I may not have this exactly correct, but someone once told me that their brother heard that Wisconsin is known as the reggae capitol of the Midwest.

[3] A thread company? Really? It may seem odd that this guy is doing color science, but consider the importance of color when looking at thread, especially when it comes to accepting a batch of thread as being the correct color. This work all lead to JCP79.

Wednesday, November 6, 2013

What difference does it make? (part 1)

I want to talk about the difference between two colors, but I need to lay some background first. This background is useful for understanding how we got ourselves into such a nice mess.

Albert Munsell, jealously guarding this cool little color toy
from two envious kids [1]

For the purposes of this blog post, I am going to say that Color Science (with capital letters) began with the work of Albert Munsell just after the turn of the last century. I call him the Father of Color Science, and I think I can get away with affixing that moniker to him because:

1. If he were alive today, he would be 155 years old, and there is still a book of his available: The Munsell Book of Color. The 2010 edition is available for the low, low cost of $994.75.

2. The Rochester Institute of Technology has a building named after him, "The Munsell Color Science Laboratory".

3. He has his own friggen' website: http://munsell.com/. At 155 years old? Complete with a blog! Although I suspect that some of his more recent blog posts were by ghost writers.

I have blogged about the Munsell color space before, in a marvelous post entitled Organizing Your Crayons. That incredible blog post gave a superficial understanding of value, hue, and chroma. That task of organizing crayons was already a pretty cool thing to be known for. But I neglected one of the really big things that he did: perceptual linearity. The colors in Munsell space are organized so as to be equally spaced according to the eye. 

The world's most attractive color space supermodel,
clearly enjoying her experience with the Munsell Color Space

This was a monumental undertaking, and the undertaker was none other than Albert Munsell. Painstakingly, he mixed colors in all combinations, at each step trying to find mixtures exactly half way between two colors. His ultimate goal was to organize colors in a way that is visually uniform. The result was the best-selling book "Atlas of the Munsell Color System", first published in 1915.

Four pages from the Color Atlas

Our messed up perception

I'm gonna ponder a bit about our perception of difference. Imagine getting a raise from $10 per hour to $10.50 per hour. Not a bad raise, right? 5%? Compare that to getting "that same raise" -- of $0.50 per hour -- if you are making $50 per hour. That's only a 1% raise. The skinflints! This example shows that our perception of salary and money is not linear. We think in terms of percentage of change. A mathematician (or an engineer who remembered her math) would say that our perception of the size of a raise is logarithmic. 

Our perception of loudness is also logarithmic, so we measure sound pressure in a nonlinear scale, decibels. Each step of ten in decibels represents a factor of ten in energy. Each step of one decibel is about a 26% increase. Our perception of musical pitch is also logarithmic, so we "measure" pitch in a logarithmic scale that we call musical notation. Each key on the piano is roughly 5.9% higher in pitch than the one just to the left of it. (Want some more math about the frequency of notes on a piano?)

The brightness of stars and the intensity of earthquakes are also measured on a logarithmic scale. The general rule that all of our perceptions are logarithmic is known as the Weber-Fechner law. The law is named after Weber and Fechner, by the way.

The same law applies more or less to our perception of color. Let's say that we give someone a pile of little tiles with different shades of gray, and ask them to find the gray tile that is half way between pure black (0% reflectance) and pure white (100% reflectance). What would the reflectance of the mid-gray be? You would think that it might be pretty close to 50%, but not so. The preferred choice is somewhere around 20%.

Nonlinearity in the chromaticity diagram

Now I'm going to take back what I said about Munsell being the father of science. Lord Kelvin (AKA James Thompson) said this about science: "When you can measure what you are speaking about, and express it in numbers, you know something about it, when you cannot express it in numbers, your knowledge is of a meager and unsatisfactory kind; it may be the beginning of knowledge, but you have scarcely in your thoughts advanced to the stage of science."

Munsell provided us with a fancy book with lots of pretty colors. He gave us a three dimensional ordering system that allowed us to uniquely specify every color in the world. I guess you could say that his three attributes are the expression in numbers of color, but I could argue either way about whether he truly provided us with a way to measure color. 

The genesis of the color measurement work came in the late 1920's and early 1930's. W. D. Wright and J. Guild (whose first names are doomed to be lost in the annals of history) performed experiments to measure the spectral response of the human eye. The culmination of that work resulted in "the standard observer" functions that were standardized in 1931. Applying this standard to spectrometer data, we arrive at the beloved X, Y, and Z tristimulus values that define the color that the human eye sees.

This was all well and good, and everyone was justifiably excited. But when the champagne had gone flat and the helium balloons lost their buoyancy, they realized that the tristimulus values were just not intuitive. The numbers did not readily relate to our intuitive understanding of hue, value, and chroma. 

The diagram below shows one early attempt at relating these numbers to something intuitive. The x axis is the x tristimulus value, and the y axis is the y tristimulus value. The brightly colored overlay shows a rough mapping of these numbers into our perception of colors.

The chromaticity diagram, showing the MacAdam ellipses

Another deficiency of the chromaticity diagram is illustrated by the "MacAdam" ellipses on the chart in the above diagram. These ellipses represent the range of tristimulus values that we would perceive as being the same color [3]. Anything within those ellipses looks the same.

Munsell provided us with a color space that had this wonderful property of perceptual linearity. Beyond just being cool, this property is of practical importance. While it is important that we can say "if two objects have the same XYZ values, then they are the same color", it is even more important to be able to specify how close to the same XYZ values that they need to be in order for us to perceive them to be the same color. And even more important still is the idea of being able to quantify when a measured color is acceptably close to a target color.

Attempts to rectify the situation

The challenge was taken up by many researchers. The goal was basically this: to find a mathematical transform to convert XYZ tristimulus values into a color space that looked like the Munsell color space. Richard Hunter, in his book The Measurement of Appearance provides a handy summary of the work that went into this effort between 1931 and 1976. I recommend printing this image off and tacking it to the wall in your office. I am sure that you will find yourself frequently referring to it.

A family tree of color spaces
(Stolen with neither malice or remorse from Hunter's book)

As you will see, the culmination of this work came in 1976, with the standardization of the color space called L*a*b*. This is a natural point for Hunter to end his color tree, since this book was published in 1975. How he came to know that L*a*b* would become a standard the year after his book was published is a mystery to me. He must have had some inside information.

L*a*b*, AKA CIELAB [4], did a good job of capturing the essence of the layout of the Munsell color space. The L* value correlates moderately well with Munsell's "value" axis. The a* and b* values can be translated quite easily into analogs of Munsell's hue and chroma. A mathematician (or an engineer who remembered her math) would be immediately reminded here of the arctangent function. 

L*a*b* also came along with a reasonably simple way to express the difference between two colors. If you lay out two colors on a three dimensional grid, you can use a tape measure to determine the distance between two colors. A mathematician (or an engineer who remembered her math) would recognize the Pythagorean theorem in this. 

The L*a*b* values are scaled so that one step in any direction corresponds to a "just noticeable difference" in color. This step is referred to as a ΔE (read as delta E). Unfortunately, a ΔE does not do a great job at predicting color difference. For example, a step of 5.0 ΔE in the direction of making yellow a more saturated color is just barely noticeable. A step of 0.5 ΔE in any direction around a neutral gray is noticeable.

As another example of the disparity between ΔE and our actual perception of color difference, one brilliant researcher devoted an entire blog post to counting the number of discernible colors. An entire blog post! Can you imagine that?!?!? When counted in L*a*b* space, there were something over 2 million. But the real number is somewhere closer to only 346 thousand.

What was needed is a more accurate way of expressing color difference. That's the topic of the next part in this series.

-----------------------------------------
[1] I need to be fair here. Albert Munsell was a brilliant man who devoted his life to understanding color, and to teaching kids about color. 

[2] At least that's the way they look on my monitor. Like most computer monitors, mine is not calibrated, so I can't really be sure what the ramps will look like on your monitor!

[3] Technically, the ellipses are drawn at ten times that threshold of just noticeable difference.

[4] These are the only correct names for this color space. They are routinely called Lab or CIELab or even LAB. These are all incorrect and naughty. Note that Hunter invented Lab, so it is just plain wrong to call CIELAB by this name. Wrong.