Sunday, January 27, 2013

Tone Mapping JPGs---Or Why I'm Loving CIECAM02

At times we users fixate on the RAW part of RAWTherapee and fail to notice how great it is postprocessing JPGs. In fact I'd be willing to nominate RT, or should I say JT, as the best JPG editor on the Internet.

Example. I took this image last fall when Wife and I set out on a country ride to find a Halloween pumpkin for the front porch.  At a 'take your pick and please put the money in the cash box' roadside stand Wife walked about selecting the perfect pumpkin while I walked about snapping photos. Like this one of Indian corn.



The corn kernels are especially underexposed. I'd been shooting landscapes with the camera set to -0.33EV so not to blow out the skies and, as often happens, I forgot to change the setting . The camera also picked its exposure based on the bright husks. So how well will CIECAM02  tone mapping with JPGs?


Quite well as it turned out.

For the post proceed jpg I used pretty much the same workflow I described in my last post.
1-click the appropriate boxes to turn on the tools
2-click the highlight exposure warning icon. (white triangle on main tool bar)
3-use a single custom S curve to bring out the colors on the corn cob. When I went too far with the curve, the blown highlight on the individual corn kernels blackened. When I post processed a test jpg using that curve the rich colors washed out.
4-fine tune to taste using the Brighness, Colorfulnes and Contrast sliders

Are the results better or worse using the JPGs instead of NEFs?

 Wife walked in when I had a JPG version up on the screen next to a NEF version. She immediately picked the JPG version as the best. Since I'd used more Contrast on the JPG , I'd lean more towards a tie. With some images using a NEF would be better or even necessary. Recovering blown highlights, for instance, happens before the demosaicing step and won't work with a JPG. But with this image I could pixel peak with tight crops without seeing much difference.

So what are the advantages of using JPGs?

On the technical side speed and memory usage. Users with older 32 bits machines should find this quite useful.

And on the social side, there are mucho more JPGs out in the world than there are RAW files. Even on my machine. I have about five years of JPG only photography from before I owned a RAW enabled camera waiting to be sorted out and made more perfect for the digital version of the family album I've been promising to create.

No more excuses. Just don't tell Wife. Or even worse the Grandmas.

You can find this build of RT at-
http://www.visualbakery.com/RawTherapee/Downloads.aspx

Unfortunately as of January 27 there is no manual entry for CIECAM02. But it will appear shortly. The online manual is at-
https://docs.google.com/document/d/1DHLb_6xNQsEInxiuU8pz1-sWNinnj09bpBUA4_Vl8w8/edit

For Jacques's paper on CIECAM02-
http://jacques.desmis.perso.neuf.fr/RT/ciecamRT3.html


Tuesday, January 22, 2013

CIECAM02-a WORKFLOW

Edit--Preliminary results of the "Perfect Monitor Chase"
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.


Now that we have an up to date--as of January 20 2013--64 bit win7 build on line, I was able to sit down and work out a workflow for tone mapping  using  CIECAM02.  Tone mapping is important to me since I take a lot of underexposed images. Sometimes deliberately. With low light  and moving subjects like Charlotte and her friends it's 1/125 second shutter priority and let the ISO fall where it may. I can deal with camera noise but blur is forever.

And sometimes...you know how it is keeping track of all those pesky camera settings. In the photo of Charlotte and her birthday check I faced harsh outdoor lighting coming over Charlotte's shoulder but I can't remember where  the  -.67 EV setting came from.

The original NEF converted with the RT neutral profile.



With a +1.41 EV exposure correction. Any greater exposure correction clipped the R channel at my test point on Charlotte's right leg up by her shorts. With this much EV the writing on the check and much of her right leg is washed out.  With deep shadows on her face this is a candidate for tone mapping.


Using the default setting of RT's original LAB based tone mapping . Tone mapping cleaned up the overexposed check and legs but didn't do much with the shadows on her face.



 The tool tip on tone mapping says to use CIECAM02:
1-check the box to enable the CIECAM02 tool- obvious
2 set the algorithm to Brightness + Colorfulness-less obvious
3-check the box to enable tone mapping using CIECAM02--again obvious

What to do next awaits a long manual entry. Jacques, the author of this masterpiece of post processing has written a long and programmer oriented paper on this tool. In French. His email English is far better than what's left of my high school French. So I depend on Google Translates. I won't say Google Translates totally mangles his French but I found it tough going pulling out the details. So if I've missed an obvious workflow...c'est la vie.

Step one of my version is to use the Brightness curves to brighten the image. I used tone mapping's default strength of  .25 but cut its Edge Stopping slider back to .55. It sharpens detail like Charlotte's hair and the default 1.4 setting seemed overaggressive.




I used the two control cage Brightness curves  for this post. After I'd made the screen clips I decided  it really did not matter what curve type or types I used. This step makes the image as bright as you can without clipping any of the color channels. So also check the 'show CIECAM02 histogram in curve' box. By design or bug it shows up only in the curve1 box. Adjust the curves so the histogram touches the right edge just short of clipping. A clipped channel will also develop a peak topped by a colored box in the main histogram box.

The image you get from curves alone is not likely to be pretty. This one is a bit washed out.



 So now you use the sliders to pretty it up.




Between Brightness, Colorfulness and Contrast you can fine tune to anything you want. For aesthetic reasons I set the yard behind Charlotte's head to almost total black. That made the shadows on her face a little darker than I would have liked. But all in all RT with CIECAM02 turned a disaster of a snap into something worth blogging about.

And there is more. CIECAM02 now works with Sharpening. Microcontrast, Defringe and Contrast by Detail.

With no sharpening


And with unsharp on and set a bit heavy. Don't know what they did but unsharp mask now seems to be less prone to halos and other artifacts


You can find this build of RT at-
http://www.visualbakery.com/RawTherapee/Downloads.aspx

Unfortunately as of  January 22 there is no manual entry for CIECAM02. But it will appear shortly. The online manual is at-
https://docs.google.com/document/d/1DHLb_6xNQsEInxiuU8pz1-sWNinnj09bpBUA4_Vl8w8/edit

For Jacques's paper on CIECAM02-
http://jacques.desmis.perso.neuf.fr/RT/ciecamRT3.html


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:
  http://www.visualbakery.com/RawTherapee/Downloads.aspx


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


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

Monday, January 14, 2013

CIECAM02 What IS IT?

If everything goes as planned and everything on the to-do list is checked off the  next stable build, RT 4.1, will be posted in early February. That build promises mucho minor bug fixes, welcome speedups and CIECAM02.

So what is RAWTherapee's latest and greatest addition.  If you google CIECAM02 the wiki entry pops up at the top of the list. If you understand what you read there, email me a translation in people talk. You obviously understand what going on far better than I do. Tis a confusing topic.

In the RAWTherapee implementation we are looking at 12 different sliders coupled with three curve sets and  five curve types. So I will state upfront that if you are looking for a blog about adjusting this slider to create exactly that effect look somewhere else.  I'm not even close to working out those details. But I will say by dragging  sliders around without knowing  exactly what will happen I've corrected many color problems. I've also seen interesting tone mapped HDR images in the developer's forum.  for examples go to http://imgur.com/a/yqzLm#0

With a total of 12 sliders and 5 curves types  CIECAM02 corrects the subtle and not so subtle differences in how we humans see a scene or image and how cameras makes an image. The most obvious difference is chromatic constant or in photographer talk white balance. Another effect, seen by anyone who has thumbed through an optical illusion book, is what wiki calls the white illusion. Both grey patches are identical but they look different when displayed against white or black backgrounds
.



The  'scene condition' section deals with these effects. To quote wiki 'Though the human visual system generally does maintain constant perceived color under different lighting, there are situations where the relative brightness of two different stimuli will appear reversed at different illuminance levels. For example, the bright yellow petals of flowers will appear dark compared to the green leaves in dim light while the opposite is true during the day. This is known as the  Purkinje effect, and arises because the peak sensitivity of the human eye shifts toward the blue end of the spectrum at lower light levels.'

The top slider makes only minor adjustments to the histogram. I check the auto adjustment box in the corner.  With the dark surround--for example viewing a  framed photo hung in a dark hallway-- the change is more pronounced. To counter the Punkinje effect, it shifts the blue channel in the histogram. There are two algorithms for this, the first using only the normal RT adjustments with the second factoring in the CIECAM02 adjustments.


 In the next section there are 9 different sliders if I show them all.



Since I did the screen shots out of order, this is the photo I wanted to create. I started with the shot below, an ISO6400 image deliberately underexposed so I could shoot at 1/125 second when the girls were bowling.




I worked with the brightness and colorfulness algorithm. Instead of colorfulness I could have chosen chroma or saturation. To quote wiki  "colorfulnesschroma, and saturation are related but distinct concepts referring to the perceived intensity of a specific colorColorfulness is the degree of difference between a color and grayChroma is the colorfulness relative to the brightness of another color that appears white under similar viewing conditions. Saturation is the colorfulness of a color relative to its own brightness.Perhaps there are technical advantages to using the other two choices, but I haven't found any yet.




After adjusting for exposure and white balance I did a curves adjustment on colorfulness to create a brightly saturated cake and table cloth along with neutral and slightly subdued skin tones. The dull slider made big changes, the neutral slider didn't do much. With the strong blues and purples in this image the pastel slider shifted the colors more than the saturation slider. When I switched from colorfulness to chroma or saturation the colors shifted slightly. In short with curves and the sliders  I could smoothly adjust the colors to just about anything I wanted. 

Pushing  matters further, with hue slider I could dress the girls in green without destroying the skin tones. 


Finally there is a set of adjustments to correct the differences between viewing an image on a monitor in a well lit room, on TV screen in a darker room or using a projector in a very dark room 

To sum up CIECAM02 is an excellent addition to RAWTherapee