Thursday, January 17, 2013

Tone Mapping using CIECAM02

Edit--Preliminary results of the "Perfect Monitor Chase" (see next post)
Compared to flat screen monitors my Sun workstation monitor is too dark by about .5 ev. So what I thought was perfect exposure and color--what this blog post is about--will--most likely--look overexposed and washed out on your monitor.

Why 'most likely'?  Because flat screens are all over the place. My local library has a wide assortment. On Internet 7 this blog post looked pretty good. On Internet 2 its colors were so garish I cringed. So I leave this edit  by saying the examples I posted might look terrible but I still stand by the workflow instructions.

Plus, if anyone knows an accurate way to set up the gain and bias of the three RGB guns in this beast leave a comment to point me in the right direction.

In my last post on CIECAM02 I mentioned tone mapping  without going into details. While I did have a build, #181, that integrated both tools, my sys7 64 bit windows system did not like the build. It was compiled on a 32 bit Linux computer and worked great with that operating system.  But it came without a windows installer to register  its dlls and after an average of ten slider adjustments it crashed. Not an ideal way to learn how to use a new tool.

Edit  Build 185 is now available for both 32 and 64 bit PCs. Looks to be rock sold and faster than before.You can find it at Ollis's site:

Despite the crashes, the build gave off hints of great things to come. So, without any great expectations of success, I went down to the old office turned junk room to dust off my old 32 bit Vista machine. To my surprise, as long as I didn't run out of memory during a conversion, the build worked.

I started with a snap of Matilda before we went to the bowling alley for Charlotte's birthday party. It was the first in a series so I suspect I took it to test the lighting conditions. Not a totally bad snap, but it needed fixing before I could email it to Matilda.

Without going into the details which I'll save for after a final release, here are the results.
The old way, using LAB mode and without CIECAM02.

And the new way

Before CIECAM02 I might have been satisfied with the first version, but there is no question that the second version does a much better job correcting the blown highlights in Matilda's hair.

Her face is still shaded more that I like with red channel number of about 50 percent. If I increased the strength of the tone mapping to lighten it, white blotches with a black center appear on Matilda's little hair pin and then on the blown parts of her hair. This is not a bug. The white happens when tone mapping runs out of data (RGB 255, 255, 255) and the black when the algorithm overflows. On PCs and perhaps MACs this produces a negative number, something RAWTherapee and other image processor interpret as black. (RGB 0,0,0).  Even RAWTherapee can't fix everything.

In my last post I also said I hadn't found much difference between the three 'lightness vs xxxx' algorithms. This time, with Matilda's hair, the 'lightness vs chroma' worked best. CIECAM02 also has its built in "lightness' curves. I used those to bring up the red channel on Matilda's forehead to about 62 percent.

Which brings up another complication. After I installed my #181 build on my old 32 bit machine I created the three tone mapped images. They looked good downstairs. But when I brought them up to my 64 bit machine they looked much too dark.  Last summer  I blogged about how accurately I calibrated the antique Sun Workstation monitor using paint chips but CRT monitors do drift, especially older ones. As for the monitor downstairs, it is a flat screen that I bought in a garage sale for $2-- one not guarantied to be on the gold standard for monitor accuracy.

My laptop and third computer is currently in parts since I have to replace its CPU fan, so I went over to my next door neighbor to check how the images looked on his new laptop--somewhere in between what I was seeing on my computers.

This is a problem that the old timer darkroom print folks in my computer club have been trying to pound into the heads of us new timer digital folks. You can not guarantee how light or dark the images you slaved over to get perfect will look when they pop up on other people's monitors out in Internet Land. So if you enjoy these tutorials  please take a moment to add a comment--just a 'too dark' or 'washed out' or 'about right'  to let me know what you are seeing.  Blogging on how great RAWTherapee is while using bad imagery isn't convincing.

Double Thanks.

Sorry if you ran into the "prove you are not a robot" thingy during a comment. Now off. So comment away.


  1. look good on ron machine

  2. word verication is now off?

  3. library internet 8
    lighter colors vivid

  4. colors far too vivid internet2
    old lab mapping best

  5. internet 5
    lighter but with decent colors

  6. internet7
    lighter but close to my monitor

  7. internet 4
    looks good too

  8. looks good at neighborhood center

  9. The first of the 3 cropped examples, the one you call "The old way, using LAB mode and without CIECAM02." has by far got, in my opinion, the best tonal properties.

  10. JEL

    Thanks for the comment. One of the problems of my lets-see-what-happens-and-post-about-it-quick style of blogging is what I thought I knew in January and what I think I know now can be quite different.

    After I posted this I went for the holy grail of color management--where I could take my actual color sample--paint cards-and place them against the image on my monitor and not see any differences. And I came close.

    Then I went out into the real world and tried it on other people's computers. And didn't come anywhere near close.

    So I'm not surprised at what you reported. Different monitors- different looks. And since I can't do much about it I've stopped worrying about it or trying to correct anything except for may own prints. Here are the gory details

  11. This comment has been removed by the author.

  12. You've really brought out the vivid colours in Matilda's hair! Thanks for the awesome tutorial!