Saturday, 15 November 2014

Forensics: Gaussian Analysis - Defocus

Scope and Objective
In an Introduction to Gaussian Analysis (HERE) I discussed the anatomy of different image quality parameters and observed how very many of them follow a Normal or Gaussian distribution around a position of optimum quality.  In the posting Focus Anatomy I explored some of the general concepts and terminology around focus and defocus ('out of focus').  I explained that a perfectly focused point (Airy disk) does not exhibit a perfectly Gaussian signature but displays qualities of both particles and waves.  Around a very Gaussian central focused point of an Airy disk lie concentric rings which are formed due to diffraction (a wave property of light).  There are also anomalies introduced by the camera lens and processor which further distort focus.  These include the aperture, the type of lens and the demosaicing step during processing.  Despite all of this, focus can still be very closely approximated using Gaussian analysis as outlined below.

The Gaussian Signature for Defocus (the Gaussian Blur tool)
The Gaussian Blur tool essentially presents the Gaussian signature for defocus.  This tool has long been available in Adobe Photoshop, for artificially creating defocus in images.  When we use the Gaussian Tool in Adobe Elements and compare the results with images created naturally there is a startlingly similarity between the two.

However, as explained above, defocus does not exactly follow a Gaussian distribution.  Defocused points tend to have a less than perfect shape and don't tend to have a perfectly neat Gaussian gradient from centre to edge.  Some characteristics of natural defocus and the Gaussian blur tool are very similar however, such as the overall rate at which objects lose overall contrast and, more especially, edge contrast (acutance) as they are progressively defocused and dissolved.  There is also a relationship between the contrast of a defocused point and it's relative size - objects expand in size as they are increasingly defocused.  The effect is quite like the expansion of a baloon.  When a mark is placed on a deflated baloon and then the baloon is inflated the mark gets bigger but at the same time becomes lighter and less clearly defined.  The analogy isn't exactly the same as defocus but there is similarity.

The value of all of this is that we can, in theory re-engineer a defocused image in an effort to understand some of what is going on.

Lens Tool in Adobe Photoshop/Elements
There is a new tool in the Adobe tool bag which may offer an even closer approximation to real camera defocus for an individual camera lens. With this tool it is possible to distort the blur effect taking into account aperture and some lens distortions, even noise and specular highlights.  I could envisage a situation in the future where, with careful study of the characteristics of lenses someone might develop a ready-reckoner for use with the Lens Tool. One could select the lens used and various lens settings and the ready-reckoner would spit out a list of corresponding settings for the Lens Blur tool to help recreate the focus conditions of the lens.  A good exif programme (like Opanda iexif 2) can provide much of the lens information needed for such a ready-reckoner, including lens type, f-number, aperture value and focal length.  Unfortunately I havn't been able to find any ready-reckoners for the Lens Tool online.  Playing around with focus using the Lens Tool is liable to introduce more uncertainty than clarity so for now I advise sticking with the much simpler and more reliable Gaussian Blur tool.

The Plan
Here is my proposed recipe for analysing the Gaussian signature for Defocus.

Step 1 Careful Review of the Images
Once again it pays to spend time carefully pouring over all of the available images, even if they are out of focus.

Step 2 Re-engineer Defocus
Because we are not used to studying things defocused it can be difficult to appreciate the extend to which defocus reduces contrast, increases the relative size of things, and ultimately dissolves detail.  Perhaps the best way to appreciate all of this is to take a sharp image, artificially defocus it, and compare the results with the defocused image we are analysing.

Take for example these South American (Magellanic) Snipe from Chile Gallinago paraguaiae magellanica.  Lets for argument's sake say that someone has queried the rear, out of focus bird as being a Puna Snipe Gallinago andina.  We probably don't have enough information from the image to say one way or another but as an interesting exercise it might help to put the bird in front into the same level of defocus to see how they compare.

Using Adobe Elements I have isolated the snipe in the foreground using the lasso tool and defocused it using the Gaussian Blur tool.

Interestingly, while the level of defocus is very similar, if we look closely we can tell that the bird in the background has a different defocus pattern.  It's bokeh is less appealing owing to halos in the defocused image.  There is for example a pale halo around the eyering.  This example shows some of the drawbacks in this analysis.  The Gaussian blur tool will only go part of the way to replicating the focus parameters of the lens or other conditions.  On this other hand, this example shows how an anomaly such as this 'double eye-ring' can be explained as a lens design issue (or possibly motion blur - rear bird may have moved during the exposure) and not a genuine field mark.  Luckily I captured other images of the rear bird which helped clarify it's true identity, and that this is mark around the eye is indeed just an focus anomaly.

This might not be the most inspiring example but hopefully it illustrates the main point.  We frequently come across cases where field marks are obscured or missing in out of focus images.  The question arises - what were these marks like 'in focus'?  By re-engineering defocus from a sharp image we can at least understand the circumstances a bit better and hopefully make a reasonable assessment of the evidence.

Step 3 Consider other factors
Because we know that Gaussian analysis of focus only goes part of the way to explaining defocus, we must be mindful of other factors, including the effects of lens design and aperture.  Also, defocus isn't the only form of blurring in images.  Motion Blur due to movement of the camera and/or subject during image exposure can look quite similar to defocus but has quite a different blur pattern and mechanism behind it.  Motion blur often produces two ghost images offset from one another with a hazy smeared image between them.  The rearmost snipe and background above appear to show a double image.  It is possible that both the snipe and the grass were in motion during this exposure though bare in mind that lens design and in particular aperture shape can produce a similar effect.

Step 4 Document 
We document our methods and results so others can check and verify the evidence.

No comments:

Post a Comment