How does Colour affect Autofocus?

It turns out calibrating AF Microadjustment is actually pretty difficult.  Sure, there’s lots of information on the web about how you can do it with a piece of paper, but there are so many variables involved that a static paper target doesn’t really cut it for useful real-world results.

At Reikan, I’ve been looking at focus calibration for a little over 5 years now.  Over that time, I’ve made a lot of assumptions about how a camera’s autofocus system works and often found that – after testing – those assumptions aren’t quite right.  And there’s almost no way you’ll get detailed information out of camera manufacturers – they’re more tight lipped than the NSA!

FoCal came about because I wanted to test various ideas about autofocus systems, but a lot of the testing was difficult or impossible to do manually because it took too long or you couldn’t touch the camera during the testing.  I keep finding more things to test and analyse, hence the addition of lots of interesting tests in FoCal Pro.

Recently, thanks to a discussion with a long time and well respected user of FoCal, I took some time to look in detail at just how the spectrum of the light illuminating the subject can affect the autofocus results – i.e. how does colour affect autofocus? – and the findings are quite surprising so far.

In the FoCal Lab we have performed a lot of tests with various light sources to give the general recommendations for testing, but it’s only recently that I’ve taken the opportunity to test with some more unusual monochromatic light sources (the sort that it’s not recommended to calibrate against!).  Following on from this, I’ve also played with some custom demosaicing algorithms for raw image data to be able to analyse focus results for red, green and blue lighting and also get light spectral quality information.

It’s important to point out here that any results shown below are very early data.  There’s a lot more testing to do in order to properly understand the interaction between the various parts of the autofocus and imaging systems when faced with different light sources.  So… this post is just for interest – there will be more concrete findings to follow.

The Autofocus and Imaging Systems and their response to Colour

It’s important to have in your mind that the camera Phase Detect AF system and the Imaging system are independent.

I use the term “AF system” because I’m not talking about just the AF sensor, but everything that goes into getting what the camera considers an “in focus“ image on the sensor.  This includes the main mirror and it’s cushioning, the secondary mirror, the AF sensor itself, the lens optics and motors, the algorithms used to determine focus quality, lens drive and – in a lot of newer cameras – the metering sensor as well.  ALL of these components have an input into how the focus is achieved and how accurate and fast it is, so you can’t discount any aspect of the system when analysing general results captured from the imaging sensor.

So, you have to be a bit careful about how results are interpreted.  When you light the subject with a monochromatic red light, the results analysed at the imaging sensor don’t absolutely tell you what the AF sensor saw.

The imaging sensor consists of millions of photodiodes which are sensitive to everything from around 400nm (blue/violet) through to 1µm or above (well into infra-red).  The whole sensor is covered with an infrared blocking filter and a colour-filter array composed of red, green and blue dye panels which cover the individual photodiodes. The characteristics of these dyes are different for different manufacturers – letting different amount of various colours of light through.  So, for example, the “red pixels” will be sensitive mainly to red but will also show some signal if exposed to a bright pure green light as the dye is not a perfect bandpass filter.

The Testing

To try to see what happens with different lighting, I used a specially modified version of FoCal which allows analysis of the data from the red, green and blue photosites independently.  I could then run the AF Consistency test across a range of AF Microadjustment values and see where the best focus was for each colour, in this instance relative to the uncalibrated AF position (i.e. the position that the camera/lens would focus with an AF Microadjustment value of 0).

I tested with 2 different light sources in a number of configurations:

– Monochromatic Lighting: individual red, green and blue single-wavelength lights

– Pseudo-white Lighting: the red, green and blue lights all illuminating the target together, giving a visual “white” but actually composed of 3 very distinct monochromatic light sources

– Daylight: a fairly balanced broad-spectrum white light from diffused daylight

For each of the tests, the percentage of total energy received in the red, green and blue channels is shown giving an indication of the light component levels (as the camera sensor sees them).

Test Results

Below are a series of graphs showing the results from the testing.  Bear in mind that this is an early set of tests and there will be lots more information coming, as well as improvements to the analysis and results presentation.

A few notes on the results:

  • The results are normalised to the peak measured result (this will have a value of 1.0)
  • The vertical lines show the predicted best-focus position for each colour (if there isn’t a vertical line, it means there wasn’t enough light of that colour to determine the result)
  • The distance shown in brackets is the depth-of-focus offset (i.e. the focus point offset at the sensor) from a zero adjustment.

Canon EF 40mm f/2.8 STM


Canon EF 40STM, Red Lighting (Red: 96.1%,Green: 3.9%,Blue: 0.0%)
Canon EF 40STM, Red Lighting (Red: 97.4%, Green: 2.6%, Blue 0.0%)


Canon EF 40STM, Green Lighting (Red: 0.0%,Green: 91.9%,Blue: 8.1%)
Canon EF 40STM, Green Lighting (Red: 0.0%, Green: 92.5%, Blue 7.5%)


Canon EF 40STM, Blue Lighting (Red: 0.1%,Green: 0.0%,Blue: 99.9%)
Canon EF 40STM, Blue Lighting (Red:0.1%, Green: 0.0%, Blue 99.9%)

RGB Combined – “Pseudo-white”

Canon EF 40STM, Combined RGB lighting (Red: 60.7%,Green: 21.4%,Blue: 18.0%)
Canon EF 40STM, Combined RGB lighting (Red: 60.7%, Green: 21.4%, Blue: 18.0%)


Canon EF 40STM, Daylight (Red: 35.7%,Green: 33.0%,Blue: 31.3%)
Canon EF 40STM, Daylight (Red: 35.4%, Green: 32.9%, Blue: 31.7%)

Canon EF 24-70mm f/2.8L


Canon EF 24-70 f/2.8L, Daylight (Red: 39.6%,Green: 33.4%,Blue: 27.0%)
Canon EF 24-70 f/2.8L, Daylight (Red:39.5%, Green:33.5%, Blue: 27.0%)

Canon EF 85mm f/1.2L


Canon EF 85mm f/1.2L, Daylight (Red: 38.9%,Green: 33.2%,Blue: 27.9%)
Canon EF 85mm f/1.2L, Daylight (Red: 39.5%, Green: 33.5%, Blue 27.0%)

Interpreting the Results

Although I have a lot of theories and practical evidence of certain behaviours,  I’m not even going to try and explain the results for a few reasons:

Firstly, the results above are run with an immature test.  There’s no autofocus consistency validation, and whilst they were repeated to check result validity there could reasonably be some errors which may affect the finer details of the interpretation of the results.

Secondly, there’s not enough data to draw any serious conclusions.  We can observe that it certainly looks like the perfect focus position for red, green and blue light isn’t in the same position which could result in some image softening in some channels (and this could likely be from axial chromatic aberration – where each wavelength of light is focused on a different plane parallel to the sensor plane).

Thirdly, there’s a fair chance that the camera manufacturers implement a correction to autofocus position based on spectral content as measured by the AF (and metering) sensor.  If this is the case, there’s not going to be any linear change as you adjust the amount of red, green and blue, and it would be very difficult (or most likely impossible) to determine what’s actually happening in the complete focus system.


For now, the best conclusion from this is to make sure you calibrate your camera and lenses under the lighting conditions you’re most likely to shoot in.  For example, if you calibrate under warm incandescent lighting, you may find that your focus isn’t optimal for clear blue daylight shooting.

The results are really exciting because they start to quantify some detailed effects as a result of the AF system and lens design, and will go towards helping get more accurate calibration for a wider range of shooting conditions.

This data will be available in FoCal 2 (for FoCal Pro users) – you’ll be able to automatically determine best focus for various colours as well as getting an idea of the spectral content of your source lighting.  There are a few other features which will help make more use of this from a calibration point of view, but I’ll leave that to another post.

7 comments on “How does Colour affect Autofocus?

    • I hear you Brian! If only CDAF was as quick and generally reliable as PDAF. It’s nearly there, but not quite yet. Hopefully we’ll be able to give some detailed information soon which will help you get even more from your camera and lenses under different lighting conditions without making the calibration process too onerous.

  • Great post! That was an enlightening read and gives me further regard to the fact I recently purchased FocalPro.

    Thanks! 🙂

  • Interesting read and another piece of great work, Rich.

    However, I am almost certain that all more light sensitive PDAF systems use color correction factors from their rgb metering systems. It is even known to make the Nikon SB910 red flash AF beam fail with the D800 (correction applied even if beam is too weak to be visible to the AF sensors).

    Therefore, I still think that two separate calibrations for daylight and tungsten cannot be avoided. I am nevertheless curious to watch for anything FoCal 2 will have on offer here.

  • This is a major problem indeed. I experience this with my Canon 5D III with my 70-200 2.8 L IS. In daylight the focus is perfectly OK.
    In theater the problems start to show…The color of the lighting changes all the time, and so does the accuracy of the focus. With cool light, no problems, but the warmer the color, the more front focus I see appearing. There is no point in trying to change your calibration depending on the lighting changing….
    To be honest, more and more I find myself using my m43 Olympus OMD EM5 II even in such circumstances. Yes, it has more grain and the focus in low light can be slower or problematic, but at least, the pictures are in focus, irrespective of the color of the light.

    • Hi Fadi,

      Short answer is we don’t yet know. It’s actually the sort of information that is not generally available for any cameras (at least information direct from Nikon or Canon) and it’s hard to be 100% sure exactly how the function presents itself. We do believe for certain cameras the colour can/does change slightly the AF function at least to a slight extent.

      Best Regards,


Leave a Reply

Your email address will not be published. Required fields are marked *