Sunday, November 16, 2014

DNGDeblur - Introduction

Screenshot of a first version - the official release will look slightly different...


DNGDeblur runs on Windows only and was tested on Windows 7 and Windows Vista. It might run on Windows 8 without problems, but I haven't tested it on that platform. It needs quite a bit of memory, and a fast processor never hurts.

And to get an important issue out of the way: I do not intend to develop a MAC version.

Supported cameras

In general DNGDeblur can deblur color or monochrome RAW files from a limited number of cameras - when their RAWs are in the DNG format - and JPEGs from any source.

Note that the term 'deblurring' needs to be taken lightly. This program is not a one step solution to your blurry photographs. It will not work satisfactory on every blurry photo you throw at it (more on that in next posts) and you do have to spend some time and effort per photo to get to the best results. If you dislike post processing photos or if you are by nature an impatient person, DNGDeblur might not be for you.

DNGDeblur supports native DNG as produced by Leica cameras (supported are the S2, M8, M9, M, MM and T - the M-E should also work, if not, shoot me an email).

Additionally, if you have files from a Canon EOS 350D, 500D, 550D, 30D, 40D, 5D Mark II or 5D Mark III you can also use DNGDeblur if you convert your RAW CR2 file (the full CR2, not a downsized in-camera RAW) to DNG, using the free Adobe DNG converter (or Lightroom to export as DNG).

Same story for Nikon D200, D800, D800E and the Sony A7s (and to be clear: also these files need to be converted to DNG first).

I doubted the Nikon D800 and the Leica S2 a bit, because those files are so huge that deblurring the RAW might simply not show in the end result (if a smaller JPEG is produced). These RAWs also take quite a bit of time to process. But the files work in DNGDeblur and don't seem to pose any problems, so why not.

DNGDeblur also supports monochrome DNGs produced by DNGMonochrome, but that's hardly an advantage since the deblurring engine in DNGMonochrome is exactly the same as the one in DNGDeblur (although DNGMonochrome doesn't let you reload your monochrome DNG, in that sense DNGDeblur might be handy). The monochrome support in DNGDeblur is mainly meant for the Leica MM.

The deblurred DNG is currently written uncompressed, so don't be surprised if the endresult is bigger than what you started with. Adobe's DNG converter seems to JPEG compress all files it converts (that's lossless compression). The compression used by the Leica M8 and Leica M9 (on the latter it's optional) is different: that's a lossy compression. But also that compression gets lost in translation by DNGDeblur and you'll end up with an uncompressed DNG.

The Circles

Besides deblurring a DNG or JPEG, DNGDeblur can also deblur parts of a DNG or JPEG in so called 'deblur circles', which can be placed on the photo, much like the radial filters of Lightroom. This is especially handy for photos that have large out of focus areas, where only a face or eyes need to be deblurred. You can place more than one of these circles on a photo, resize them, turn them into ellipses, feather them and drag them around. The deblurring will stay confined within the circles and no part of the photo outside the circles is altered when you create the final output. See this post for an example.

So why can't DNGDeblur handle any old DNG?

I know that DNG is supposed to be a general standard, but as it turns out, it really requires implementing total support of the DNG standard in the software. Some cameras use options that other cameras do not use.

The Canon EOS 550D and the 5D Mark II for instance gave me major problems. When I ran their DNGs through DNGDeblur, the resulting deblurred DNGs contained huge color shifts and a wrong white balance compared to the original. None of the other supported cameras showed these problems. Of course: it was the ActiveArea tag again, not properly implemented by me, so pixels started shifting all over the place. I've been there before with the Canon 5D Mark II. And as it turns out: the Canon 550D has an equally awkward ActiveArea tag, hence the same problem with those files. But the problems are solved for both cameras. Just an example to show that I really need to test photos of every camera I intend to support, before I can open up the software for that specific camera.

However, if you have a camera that doesn't fall into the supported list, you can still use DNGDeblur for JPEGs.

JPEG support

Since I'm not totally opposed to the idea that deblurring RAW files is actually quite stupid (more on this stunning revelation later), DNGDeblur can also handle JPEGs. But only if the JPEG is 8-bit or 24-bit per pixel (that should not be a big problem, most JPEGs are). The deblurred JPEG result is always stored as 24-bit per pixel (also if your input JPEG was 8-bit per pixel) and is written with a 100% quality setting (which cannot be changed).

Since I added JPEG support last minute, the EXIF information in the original JPEG is not preserved in the deblurred copy (to get that right requires a bit more time and effort). I hope to address that issue in future versions, since I consider it quite a serious problem. In fact this was one of my main gripes with some of the deblurring software out there: producing low quality JPEGs with all the info stripped. At least I got the quality right, now I just need to keep the EXIF in tact.

[NOTE: EXIF preservation was added in version 1.1.0, so above paragraph is not valid anymore]

So why the doubt about deblurring RAW, calling it stupid even? Well, RAW files are usually quite big, and with the pixel race still going on (see the Nikon D800 or the Sony A7r) RAW files aren't getting any smaller (although the Sony A7s shows that some manufacturers might be reconsidering). It means the kernel to deblur needs to be bigger, which makes it harder to deblur without introducing a lot of artifacts. Deblurring RAW seems to work fine for files up to say give or take 20mp, but when the files get larger I really doubt the practicality of it. It might be smarter to then switch to a smaller JPEG end product, since a then much smaller kernel can have a much stronger effect. Hence the JPEG support (also a nice bonus for people who skip RAW completely).

However, stupid or not, DNGDeblur started out as an experiment, to see if it was actually possible to deblur a RAW file and keep it RAW. And that it is.


You can download DNGDeblur here.

Next post about DNGDeblur I'll show you a bit of the user interface and try to explain how this deblurring actually works.

No comments:

Post a Comment