Saturday, April 13, 2013

DNGMonochrome 0.9.71 beta released

It's a bit of an intermediate release, not planned, and mainly fixes some problems with the algorithm.

  • Fixes the 'maze' artifact on M8 and M9 conversions. This problem showed mainly on M8 photos and in brighter red areas of M9 photos. On the M8, the artifact was visible at 200% magnification with sharpening set to at least 20%. Incorporating the BayerGreenSplit value in the algorithm solved the issue. On the new M and the Canon conversions, the artifact didn't show (the BayerGreenSplit value on the M is 50 - for the M8 and M9 it's 500 - and on the supported Canons the value isn't registered at all when converting CR2 files to DNG).
  • Fixes the few artifacts left when using the 'sharper' setting. Due to the implementation of the BayerGreenSplit value, the 'sharper' setting has less effect now on M8 and M9 photos (compared to previous versions). These artifacts were only visible at 300 to 400% magnification, mostly on highlighted edges.
  • Fixes several smaller bugs that might have had a negative impact on the RAW and RGB conversions.

A note in general when using Lightroom: when importing monochrome DNGs, Lightroom will default to the settings of your color DNG. For sharpening, this default setting might be too high. DNGMonochrome concentrates on sharpness and resolution, and the produced DNGs need less sharpening than the Lightroom color versions do. Make sure to cast an eye on this setting if you think the DNG looks gritty, too noisy or too sharp.

You can download the new version of DNGMonochrome here.

Monday, April 8, 2013

The Labyrinth

Now, this wasn't the issue I had in mind to talk about next, but a user alerted me to a strange artifact in his M8 photos.

I recognized it, because I also saw it in one of my M9 photos, but on my photo it was a tiny patch and only visible at 400% magnification. I hadn't really bothered about it, under the assumption it was photo specific.

This is what it looks like:



800% crop from a red patch from M9 photo


As you can see, it's sort of a maze pattern.

Not immediately realizing what caused it, I started investigating. This user was kind enough to send me the original RAW file, because I only have a handful of M8 photos, and on my M9 photos this problem is hardly a problem and was difficult to spot.

On the M8 photo the artifact was way more obvious: visible at 200%, quite ugly at 300% and it was almost everywhere in the photo.

First I thought the sharpening was set too high, because if you import M8 monochrome DNGs, Lightroom (my version at least) starts at a default of 25% sharpening, which I think is too high for monochrome DNGs. Lowering the sharpening helped, and the pattern then disappears enough to not be distracting at 200%. Adding some masking also helped.

Problem gone, nice DNG at 100%.

But that didn't take away the fact I thought it was weird.

What caused this very specific pattern on parts that should look more equally gray?

So I first started tweaking the algorithm, assuming it got lost on these equal parts... something wrong with determining the direction for the averaging perhaps?

But that didn't help a lot. I could improve it a bit, but not get rid of it.

It was a bit maddening, since none of my attempts seemed to make a big difference, just these tiny changes that were not enough. It felt like I wasn't only trying to fix the maze, but that I was actually walking in it! Then I decided to try a re-size, because that only leaves the green pixels, and then see what kind of pattern that would create, if any.

And there it was: the green pixels were all over the place. And that didn't make sense to me, because I always assumed a regular patch of brightness would give similar values for the green pixels (apart from noise).

I could see the origins of the maze in this pattern... quite obvious interpolating on these green pixels would bring it out in full glory.

Concentrating on this strange difference between the green pixels, I suddenly remembered reading in the DNG documentation about the BayerGreenSplit value, which indicates how closely two green pixels (one on a red row, and one on a blue row) 'track' each others value.

And that was the 'eureka' moment.

Not taking this value seriously leads to the maze artifact, because the software wrongly assumes the value of the second green channel (the green pixels on a blue row) is unique. And although the value is indeed unique, it doesn't necessarily mean the algorithm should treat it as such.

How to implement the BayerGreenSplit value exactly is at this point still a bit unclear, because the documentation doesn't state in what units the value is set. The value can range from 0 to 5000, and the M8/M9 DNGs are set to 500, but 500 of what? Is this the direct difference between the two pixels? Or is it the difference after gamma correcting or exposure correcting? Or is it the minimum allowed divergence at which point you have to start correcting?

Frankly I think Adobe should be more clear on this value, since they use it in ACR. DNG is supposed to be an open standard, so not specifying clearly how certain parameters work, or how they should be interpreted, sort of leaves developers guessing, like I am now...

Experimenting with it in a first rough trial, by pulling the two green channels closer together, I've managed to get rid of the maze completely, so it's definitely the cause and the solution.

The divergence itself seems linked to the red channel: the more red, the more the green channels start to diverge, at least in the M9 conversion. It might be that red light is bleeding into the green pixels or the green pixels on a blue row are more sensitive to red light.

For now I've only concentrated on the M8 and M9, I'll have to analyze further to see what the Canon photos do.

You can mitigate the problem by not sharpening too much and by using the masking option (talking about Lightroom sharpening) so the more equal areas don't get sharpened at all.

Obviously that tip is just a work around, since this pattern needs to go.

This has priority, so I'll try to fix it as soon as possible, and bring out a new release.