RedShark News - Video technology news and analysis

Bringing back focus with software

Written by David Shapton | Nov 15, 2012 4:00:00 PM
Bringing Back Focus

Putting things back into focus is one of those things that always seemed destined to be just a dream. Wouldn't it be great if - after the shoot - you could just tweak something and your images would look sharp and crisp - just as if they'd been photographed properly in the first place?

There are all sorts of reasons why this doesn't typically happen, and they're mostly to do with information - or the lack of it.

Most of us think of images as patterns: areas of colour that describe objects, or are simply abstract.

Lack of focus is a lack of information. You can think of it like this:

Imagine a chess board. If you have all the information you need to reproduce the chess board, it will look sharp. The edges between the black and the whie squares will have quite distinct, sharp edges. If you were to run a light sensor horizontally across the board at a constant speed, the output from it would be a square wave.

But what if you have less information? You won't know exactly where the edges of the squares are. You're idea of their location will be fuzzy, and so will any image you reproduce based on that information.

If you try the light sensor trick again, the output will be more like a sine wave than a square one.

Sharp edges translate to high frequencies in the signal. The better your system is at coping with a wide bandwidth, the sharper your edges will be.

Conversely, if your system loses high frequencies, then your images will look fuzzy.

Focus

If the light rays from your lens don't converge at a single point, then your pictures will be out of focus. The idea that you can put missing detail back into a blurred image seems impossible, and it usually is; all a "sharpen" tool does is provide a sort of faux crispness based on emphasising the areas of the picture where the most rapid changes (i.e. the highest frequencies) occur. Sharpening is like a tone control on your HiFi: it doesn't add detail (i.e. data)  to the recording, it just boosts what is already there, and within certain limits, can give a perceived improvement.

Here's an important question: is lack of focus the same as a lack if information, or is there retrievable information in an out-of-focus image?

Lytro

Not if you have a Lytro camera and some very sophisticated software  - but the Lytro is more than a camera that doesn't focus very well - it captures light from many angles and does this in the knowledge that it will be decoded in a certain way.  This is a special case and it doesn't mean that you can do the same thing with a conventional print or digital image retrospectively.

Until now, that is.

Vladimir Yuzhiov is a Russian developer specialising in image processing and analysis. He's spent some time trying to retrieve information from out-of-focus images, and he's getting real results.

The power of mathematics

Using a technique called "Reverse Convolution" he's able to use rules that can approximate where the information is spread when an image goes out of focus.

You can read how he does this on his site, but unless you're able to understand Fourier Transforms and similar mathematical functions, it won't mean much.

The proof of the pudding is in an image near the end of his project description, that shows a message that is too out of focus to be read. Then, post processing, it is legible. So Vladimir is retrieving real information and not just boosting edges. This is the difference between his technique and Sharpening.

He is clearly on to something here, and while it's far from perfect, it is now possible to envisage a time cameras or even NLEs apply focusing as easily as they now apply blur.