Wednesday, June 20, 2012

DNGMonochrome - an experiment - IV


...what's lurking in your DNG files that you haven't seen yet?

Turning M9 color DNGs into monochrome DNGs

A series about the development of an experimental piece of software, called DNGMonochrome, able to convert color DNGs into monochrome DNGs...

The software is available here.

In part III, I ended showing you the results of my second attempt... a ratio based algorithm, implemented after not being fully satisfied with my first (gradient based) attempt.

(On a side note: these algorithm names are not 'official' names... despite the fact I call them 'ratio' and 'gradient' they are in fact - where their core working is concerned, and after me tuning them - not that different... it's just easier for me to keep them apart that way...)

Not fully sure what I was looking at, I ran another photo through the software and started to compare that one... here are the 100% crops of the shot with a Summilux 50mm f/1.4 asph, ISO 200, 1/60 sec...

Lightroom color DNG turned B&W - no sharpening or noise reduction - notice the girls cap above the flower...

Ratio based algorithm converted M9 DNG to monochrome - no sharpening or noise reduction... compare the vest under her chin...

The complete photo at the end of this post...


More tests

To make sure - looking for mistakes, something wrong with my method - I re-ran the JPG conversion and I paid some more attention to the crop sizes. Then I tried the same in Photoshop and not in Lightroom.

Results were similar (same type of RAW converter).

Then I tried to get the Lightroom one sharper, without using sharpening but by playing with the color mix, assuming a certain mix might be responsible.

That didn't help at all.

Then I tried a different method of black and white, by desaturating.

That didn't help either.

I then started to inspect my results at 400%.

Not very pleasant, this serious pixel peeping at 400%, but I was determined to find fault, if there was any...


Why 400%?

Well, question on my mind was: how far do you zoom in to look for defects?

At what percentage do you say: this becomes unreasonable?

Should it be 200%, 400%, 800%, a 1000%?

I thought for practical use, I would be reasonably safe if I could repair obvious problems visible at around 400%.

It depends on a potential print size I suppose, but printing is a world in itself.

I don't print a lot and the biggest photo printer I owned was A4 - 210 x 297 millimeters - 8.27 x 11.69 inches - (it broke down on me recently and I haven't replaced it yet... it means I can't run print tests at the moment), but I also feel a true test of this method should be at least A3 - 297 x 420 millimeters - 11.69 x 16.54 inches.

A quick detour in the realm of printing seemed to suggest that 150% should be okay. So setting the standard 250% higher than that should suffice, was my idea.


Problems with the algorithm, oh my...

I then discovered upon very close inspection this algorithm didn't do a great job on high contrast edges. It's prone to aliasing. Especially visible for instance on the nose bridge of my test subject. In the color version there's a bit of blooming going on there, and the ratio based algorithm doesn't know how to deal with that properly.

I also discovered what signal processing people call 'ringing'. A faint echo, in black, behind highlighted edges.

After some brooding on how to solve these issues, I decided to try to enhance the gradient based approach with a variant of the VNG algorithm (Variable Number of Gradients), to see how that one would deal with the nose bridge.

It's actually comparable to my very first attempt (the gradient based algorithm) but it's more extensive in determining the best average and it looks at a slightly larger area.

I obviously also had to adapt it slightly, since I'm not color interpolating.

And although it fixed the nose bridge of my test subject, then the results became very similar to the more fuzzy Lightroom output and my first gradient based attempt.

I had lost the advantage.


Mixing once more

I then decided to try to combine the algorithms.

Use the ratio based algorithm for the detail, and let the newest gradient based algorithm deal with the more contrasty edges.

And after experimenting a bit with the two algorithms on how to combine them best, that worked out pretty well.

Retaining the sharper output, I managed to fix for instance my test subject's nose bridge.

It made me feel a little bit like a doctor in a private clinic (Frank and Stein), where they perform plastic surgery... but what the heck...

However, wondering about some other aspects of the ratio based algorithm in comparison with the gradient based - noise levels for instance, but I'll get back to that - I decided to have a closer look at the ratio based algorithm.

That led to an adaptation - after all, this was an experiment - let's call it ratio II.


Stay on the road. Keep clear of the moors!

I fully understand if by now you have wandered off the path of my monochrome journey - feeling a bit lost - because at this part of my travels I am juggling 2 algorithms (gradient and ratio) in at least 4 different shapes (Gradient I, Gradient II, Ratio I, Ratio II) and some of them mixed (Ratio I and Gradient II), trying to compare all the results with Lightroom... and we're only half way!

Things will get more whacky in a few parts from now... stay on the road... (personally I never believed they would have been safer if they'd stayed on the road...)... somewhere at the end of this quest I will try to recapture a bit.

But since I more or less dropped Gradient no. I (overtaken by Gradient II), let's just call that one 'Gradient'.

See the crops here of 400%, direct screenshots from Lightroom - this is how Lightroom presents 400% - then cropped more carefully in Photoshop.

Lightroom color DNG converted to B&W...

Ratio I - first ratio based implementation... notice how the nose bridge turns quite ugly, like some pixels are chipped away... there's also what signal processing people call 'ringing' going on... almost like an echo - in black - right after the brightness of the nose bridge...

Gradient - result is very much like the Lightroom B&W, the nose bridge is fixed, but the fuzz is back... apart from the nose bridge, note how the background of this one differs compared to the B&W of Lightroom, with a much more even distributed - less blotchy - kind of noise...

Ratio I and Gradient mixed - the bridge is fixed - still a very slight amount of ringing - but without the fuzz in the rest of the photo... currently the limit can be set through the software... if you desire the full gradient result, that's also possible...

Ratio II - ratio based leaning towards Gradient - the bridge is also fixed in this one - although let's say by a less experienced surgeon - and it has less noise compared to Ratio I - sharpness wise I would say it's somewhere in the middle between Ratio I and Gradient...


Observations

Now, some interesting observations can be made if you look at these crops.

First of all - if you please - compare Gradient to the Lightroom B&W. They are rather similar. But notice the background of both crops. I believe here one of the advantages of the monochrome approach is showing: the noise of Gradient is less blotchy and more evenly distributed than the Lightroom background. I suspect that's the color noise (or lack thereof) making the difference. I also think Gradient, - despite producing similar (or close to) results as Lightroom - has a very slight edge in sharpness.

Besides - although I am trying to stay objective, which isn't easy - I really feel the Lightroom one is over the top smooth. Perhaps it's a consequence of the forced color interpolation, where they have to get to this result to make the color version look okay. It's not my favorite, scrolling through these crops.


Noise

But second, also quite noticeable: Ratio I is way more noisy than Gradient, Ratio II and Lightroom (if you discount the color noise).

This method in itself doesn't cause additional noise, at least not that I can establish visually: it's the choice of algorithm. Since Gradient is as clean as the Lightroom B&W.

Ratio II however (shown last), which internally leans a bit more towards Gradient, is less noisy and doesn't suffer from the nose-bridge faults as produced by Ratio I.

Sharpness wise, Ratio II seems to sit somewhere in the middle, but I feel it's closer to Ratio I than to Gradient.

But the noise, the noise... it leads to again some questions, which I will try to tackle in the next part: about noise, what can be done about it. Including some harder evidence on the different algorithms I am using, deciding which one is the best 'scientifically'...

You might be surprised...


Surprised by the Light

Captured her and her mum in the subway, at the moment the train left the underground tunnel back to the living... the sudden change from dark to light left the little girl completely mesmerized...

Photo is rotated a bit (shot from the hip, I had to rotate anti clock wise) and cropped... also some slight post crop vignetting was added... no sharpening and no noise reduction... the shown size (640 pixels here) is not the uploaded size... click on it for a 1280 pixels version... stick to the 'full' version... the other sizes are automatically down scaled and do not reflect the true output...

Color M9 DNG turned into monochrome DNG with DNGMonochrome and the Ratio II algorithm...

... continue with part V
... back to part III

No comments:

Post a Comment