Monday, May 11, 2015

Wavelets A Third Look

I suspect that by the time you read this blog post it will be out of date. Things are moving fast in RT wavelet land and wavelet tone mapping is galloping up behind me.

In my last post I talked about a three tool workflow using only wavelets, noise reduction and CIECAM. In this post I'm stripping down farther and using only wavelets.  Along the way I'll add my opinion about the multitude of adjustments that may panic a novice user into slider shock.

First question. "Are wavelets worth the learning curve?"  Yup and double yup.  With only a few adjustments you can do this.


****
If you aren't already aware how blogspot works click on the following images to bring up a menu at the bottom. Original size enlarges the screen shot into something more readable.


In the wavelet setting section the strength slider combines the wavelet and the original image.  I haven't found much use for the combined images but moving the slider back and forth between  0 and 100 is a quick way to see how wavelets have improved (or degraded) your image.

You can create a stack of up to 9 wavelets in any image larger than 1024 pixels. Unfortunately this includes 100% detail windows. They need to be large when I'm working on a D7000 image.  Since my 24 inch 1920 by 1080 pixel monitor doesn't have that much real estate I zoom to 100% and forget detail windows.  But if I spring for a dual monitor card for my birthday--I already have a 1024 oixel 19 inch monitor--I might rethink that strategy.

Change file size to tiled if you are using a 32 bit machine. For a 64 bit machine with a decent amount of memory full image eliminates any tile artifacts.

The D in edge quality stands for the Daubechies function. It's a step up from the Mexican Hat function used by Gimp since you can change the number of coefficients.  It that mathematical  talk leaves you confused the thing to remember is that you don't notice changes until you blow up your image to about 400%.  So if you aren't planning to use a very small crop or print a very large poster leave it at the default  setting. (See Update below. RT keeps improving.)

****


After playing around with wavelet I decided my Nikon D7000 and its kit len are a bit soft. Seven or eight clicks on the contrast + button improved things. I've also changed the default 'apply to' box from adding contrast to only the shadows and highlights to adding it to the full image. Since this improved all the D7000 images I have tested so far I'll include this as a default when I create my custom three tool profile. So use wavelets to check out your camera and lens combination to see how they perform.

If you are doing conventional development don't bother opening the preview image section. But if you occasionally slip into the Crazy Artist mode it's a double WOW place to start. I'll give an example at the bottom of this post.

****


There are three chromatic sub tools.  The pastel-saturated tool links the chroma changes to the contrast settings I've already set.  The slider shifts the effect from pastel tones to saturated tones. It works but has a limited range. In my first wavelet post I discussed both this and the nine point 'curve' that was replaced by the sliders in the next sub tool.


With  this sub tool  you can set the chroma change for each wavelet. I suspect if  I was working on another image with a range of details that  I wanted to make more colorful and another range of details that I wanted to mute this would be a useful tool. But don't expect big changes.

For landscape images I use the third sub tool.


The single slider goes from no changes to oversaturated. This will be the default in my three tool workflow.

****


Edge sharpening is much improved.  In my first post I dismissed  it with "a little goes a long way." It wasn't finished and created an artifact lover's heaven, This image shows the changes I've made so far without wavelet sharpening.

****


With 30% sharpening   All edges are sharper. But we are beginning to add sharpening noise to the walkway in front of the building. Wavelets haven't magically ended the battle between 'really-sharp' and 'lot-of-noise'.


Here is the noise at 65%, Sharp but noisy. At 100% it is much worse.

*****


My compromise in the battle was a sharpening of 43%,. Note how the blocks of the wall now jump out of the image and the sidewalk is reasonably noise free. To clean up that noise I used the denoise/ refine tool.  Unfortunately I was interrupted and forgot to save a screenshot.  The tool is simple, just a check box and three of the new combined sliders that control different denoising algorithms. The top setting is strength. The bottom is detail.

With this image level 2 worked best over all. But to remove all the noise residual in the blue sky I needed a small amount of level 1.

Leave the edge detection box unchecked.  The way it is setup now it blurs the image. This maybe because the defaults are wrong. Or it may need more work. It will, I suspect, be used to fine tune the noise and edge detection

{Update. With RT 4.2.173 this sub tool works far better--or I'm better at using it on an image that has a lot of detail. The default strength should be 0,  not 82, as I suspected.  The noise threshold slider cuts noise when used with the noise/refine tools.  The threshold high slider sharpens edges, mainly by increasing the local contrast. And it now has a visible effect on 100% images. especially when edge quality is set at D14 high.}

To finish I straightened the image to eliminate the jags on the verticals of the doors and windows

****


As a comparison I moved to the top and brought the strength slider down to 0.  Like I said earlier wavelet sharpening is very much improved.

****
I'm skipping over the gamut tool. It's supposed to have a much bigger effect on wavelet tone mapping so I save it for another post. And to be honest I haven't worked out how or why I would want to use it.

****


The residual image is, to quote, "what is left over once you extract the wavelets."  In practice that means nothing you do to the wavelets will change the residual and vice verse.  To modify the residual the wavelet tab come with a set of non wavelet tools.

As expected the first four sliders lighten or darken the shadows and highlights with the threshold sliders determining what tones are considered shadow and highlights. The contrast and chromaticity sliders also work as expected and the HH curves, set for blue sky, turn it greenish or purplish when I drag the blue control point up and down

When wavelets are finished I may discover a big reason for using this tool. But if I hadn't decided to everything with wavelet I 'd be using CIECAM for these adjustments.  The extra sliders and curves gives me much more control over the look of the final image.

****

I'm not going to attempt to illustrate  what you will see when you play around with preview setting. At the default--all wavelets viewed in all directions-- you see your image.  With the other setting you can see each individual wavelet or the stack of wavelets above and below that wavelet. Then you can scan the stack vertically, horizontally, diagonally or in all directions. Then you can set three different background: the unmodified residual image, the grayed out version and the blackened version.  Add the fact that what you see depends on such things as the local contrast of your original image and you have some idea of the number of combinations.





This is a stack, level 2 and I,  viewed vertically against a grayed residual image.

****


And this is the same thing viewed vertically.  A bit of a difference.

****
Some time after midnight as I was about close up, my Crazy Artist muse conked me on the head and yelled in my ear. "Forget this one tool workflow crap. artist boy. Open up all them curves and sliders and buttons. Move them control points around. Go for the ugly. Go for the weird. Go for the crazy crazy, crazy til you got something so crazy I'll let you to put my name on it. And if you don't get it exactly right first time, don't worry. I'll be back to make you do it again. Cause I'm an addictive muse, artist boy."


Best viewed original size

While this post was written using RT 4.2.151 get RT 4.2.173 from the download page
There's been some fixes and improvement but the layout is unchanged.

http://rawtherapee.com/downloads

Monday, March 9, 2015

Second View Wavelets--The Workflow

Yesterday in my last tutorial I outlined a possible default workflow based on wavelets. Today I experimented around to see how well it works.



Photo loaded

This image  was taken at in 9-11 memorial that was traveling the county by truck last summer. I shot it handheld with my D7000 at ISO6400  1/100 sec.

 Contrast

Around 6 clicks on  the contrast + button. The D7000 produces soft raw file straight out of the camera



Fifty Percent Wavelet Sharpening

After a certain point more sharpening only increases noise and artifacts. With my camera I've been switching between 25 and 50 percent. At some point I'll settle on a default setting.


Noise Reduction without Median Filter

A decent looking result until you increase the magnification The ratios for the luminous noise sliders were 80 strength, 20 detail which is higher than my usual 50-50 ratio,



Artifacts

Scattered line artifacts are more obvious at 200% magnification especially if you blowup the screen shot.


3X3 Strong Median Filter

The median filter does a good job reducing the artifacts. There is a small lose in detail but the overall wavelet line sharpening is not affected much.  I'm not ready to scream from the rooftops-just from this blog post- but I beginning to think you don't have to trade detail for low noise anymore in high ISO images 

A BIG BIG advance for low-light no-flash handheld photographers like me. Perhaps one of the developers could comment on this dreamy idea.


CIECAM  color tune up

I used the curve and lightness slider to darken the area around the poster. I used the contrast and chroma sliders to bring up the colors on the woman's blouse.


The final edit vs the original

Bottom line.  My D7000 raw files need more contrast and sharpening when they come out of the camera.  My high ISO raw files also need noise reduction. So these three operations can be combined into default profiles similar to the three default versions that come with RT

CIECAM tuning and cropping are too image dependent. But the GUI could be set up with these tools ready to go and  everything else  closed up. With that setup I'd be willing to bet that I could process 90% of my images with just these four tools, two of which work automatically.  











First View--The Wavelet Tool

[EDIT  (June 30, 2015)  RawTherapee's wavelet tool is moving ahead at warp speed.  An example. Two day's ago I asked a developer about sharpening artifacts and wondered if they might disappear in a future build. A couple hours later I got a message that a new build, RT 4.2.231, was up on the RT download page.

The great news was that this build fixed the artifact problems.  The bad news is that I was in the middle of researching a fifth look at wavelets and have to redo my research.

And no, I don't have a private in with a superfast developer. He had been working on the problems for a while.  And yes there are three more tutorials after this one with a fifth being written.  The second is on a potential default workflow; the third is on developing a well exposed landscape shot using only wavelets; and the fourth on cleaning out the noise in pop star Lorde's latest widely shared selfie.

The tutorials have become more dated as the wavelet tool evolved so the screen shots aren't  accurate.
And in the three day since I posted the Lorde tutorial I've discovered a better way of cleaning up high ISO images using the new build--one I will explain in the next tutorial.

So upgrade to RT's latest build so we can continue to explore the exciting landscape of wavelet land.]


My book on wavelets with the equations in an appendix--one written for non math types like myself--only runs 250 odd pages. So I may eventually slog through the non math pages. Wavelets are complex and don't lend themselves to short summaries. Still the one big thing I've picked up so far is that wavelets are transforms.

Just as  jpgs are transforms  When you convert a raw file into a jpg  in the first half of the process the algorithm  creates an intermediate state, the color information. If  RT's software allowed you to do a reverse transform -the second half of the process- without changing anything you would end up with the same size image you started  with.

Something not very useful. So you have two sliders to changing things. If you are like me, you leave the subsampling slider on balance and forget about it. The second slider, quality factor, sets the size of the jpg by finding pixels with colors that are 'close enough' and coding them into a single value. If you go overboard and set the quality factor too low for very small jpgs 'close enough'  becomes "way too much" causing banding and other artifacts,

With  RT's wavelet tool, instead of colors you are dealing with spacial frequencies. Think Contrast by Details  with much more powerful sliders. With them you can fine tune your raw or your jpg and approach that ultimate goal- the perfect image. Or if you flip into Crazy Artist mode you can create some insanely weird images .

I created the images for this tutorial using developer's build 104. As might be expected, not everything worked.  Big things like CIECAM which crashed RT. Or smaller things like edge sharpening and color adjustments that need more work. Plus there is a warning that the pp3  format will be changing and any wavelet editing done with this build won't work with the final build. Despite all this, the build was worth studying and blogging about.

I was about to post when developer's build 113 appeared in the forum. It has a set of neat fixes. Like a working CIECAM  and improved edge sharpening. So instead of following a single image from loading to final development I'll be sticking in additional images highlighting what I discovered



In this screenshot I've set the strength at 100 percent--only wavelets.  Strength is a useful slider since if you go a bit too far with the wavelet adjustments mixing wavelets and your original image can help cleans things up.

Of the 9 possible wavelet levels I'm using the default stack: 7 wavelets starting at level 1, the finest detail, and going on up to level 7, the coarsest detail. Levels 8 and 9 where the 'detail' is essentially the whole image controls chroma when colors are linked to these sliders (see below).

If you have an older 32 bit system you can use tile size to reduce the memory needed.

You are looking at level 1 through 4 scanned in all directions. I could have scanned horizontally, vertically or diagonally to create different looking images. While CrazyArtist images belong is different tutorials this is a good time to say that starting with a stack of wavelets can lead to some unusual images.

Wavelet image editing is not new. Google Gimp and you can find several longish tutorials on how to remove skin imperfections by modifying and combining layers. While this approach is not insanely difficult, RT is the only editing system  I know of where you have everything you need in simple tool.


The jpg show a  model with excellent complexion (or one who has been well photoshopped) but nobody is totally perfect. After going back to "all levels in all direction", the setting for working on the complete image, I increased the contrast of the first 4 levels. This brought out a mole, (the arrow)


Bringing the sliders for level 3 and 4 (the spacial frequency of the mole) into the negative range eliminated it.

With the 104 build  when looking at the spot where the mole had been with high magnification you could see an artifact that didn't match the surrounding skin tone. With the 113 build the match is much smoother. Another fix.




You can change the chroma with this curve.  Your options include 'all chroma' and 'pastel- saturated chroma'.  The second option adds a slider that direct the changes from the pastel to the highly saturated colors. The third option, a non curve mode, linked chroma to levels 8 and 9.  This makes far more drastic changes.

I've dragged the curve up to increase the chroma.  Dragging it down would have decreased it.

This curve will be reworked.  In the final release it with be replaced with another type of curve or with a set of sliders. These will allow you to set the chroma of each wavelet level separately. Something I suspect that will make some interesting looks.



Edge sharpening is another use of wavelets. With build 104 a little went a long way. The image started to create artifacts at about 8 so using it didn't sharpen much.

 A big fix showed up in build 113, Now you can do this.

No sharpening vs. 100 % sharpening.

Coupled with NR and its median filter wavelet sharpening now works over its whole range. With not a trace of a halo. Good by unsharp mask.



At the bottom we have the gamut controls and residual image or color information. Here you can lighten or darken  the shadows and highlights and control contrast and overall chromaticity. These sliders work as expected.

With build 113 for the fine tune you can leave the bottom two sliders at zero and switch to CIECAM . Its numerous curves and sliders gives you far better control over the look of the image.




The toning section in both builds hasn't been implemented. These color tab adjustments worked as expected.


On the other hand the vibrance tool modifies wavelet edited image more than ordinarily edited image.


In the end I finished with a black and white edit


Original image joined to the wavelet processed image.

Where are we at now.  Once the wavelet tool is finished, I suspect it will become the core of my workflow. This shot of girl-scouts during butterfly month at the local gardens was shot at ISO 3200.
The editing steps were:
1-auto exposure
2-about 6 clicks on contrast +
3-sharpening and noise reduction
4-switched to CIECAM to correct colors using a brightness parameter curve
5-final slider adjustments
6-development
7-using this image's profile to batch process a set of similar images.

Bottom line,  A short, quick and high quality workflow. Wavelets RULE!

If you want to play around  you can find developer's builds in the RT forum.  Just remember these edits aren't going to work with the final version.