Gamma Encoding – Under the Hood

Gamma, Gamma Encoding & Decoding

Gamma – now there’s a term I see cause so much confusion and misunderstanding.

So many people use the term without knowing what it means.

Others get gamma mixed up with contrast, which is the worst mistake anyone could ever make!

Contrast controls the spatial relationship between black and white; in other words the number of grey tones.  Higher contrast spreads black into the darker mid tones and white into the upper mid tones.  In other words, both the black point and white point are moved.

The only tones that are not effected by changes in image gamma are the black point and white point – that’s why getting gamma mixed up with contrast is the mark of a “complete idiot” who should be taken outside and summarily shot before they have chance to propagate this shocking level of misunderstanding!

What is Gamma?

Any device that records an image does so with a gamma value.

Any device which displays/reproduces said image does so with a gamma value.

We can think of gamma as the proportional distribution of tones recorded by, or displayed on, a particular device.

Because different devices have different gamma values problems would arise were we to display an image that has a gamma of X on a display with a gamma of Y:

Ever wondered what a RAW file would look like displayed on a monitor without any fancy colour & gamma managed software such as LR or ACR?

gamma,gamma encoding,Andy Astbury

A raw file displayed on the back of the camera (left) and as it would look on a computer monitor calibrated to a gamma of 2.2 & without any colour & gamma management (right).

The right hand image looks so dark because it has a native gamma of 1.0 but is being displayed on a monitor with a native gamma of 2.2

RAW file Gamma

To all intents and purposes ALL RAW files have a gamma of 1.0

gamma,gamma encoding,Andy Astbury

Camera Sensor/Linear Gamma (Gamma 1.0)

Digital camera sensors work in a linear fashion:

If we have “X” number of photons striking a sensor photosite then “Y” amount of electrons will be generated.

Double the number of photons by doubling the amount of light, then 2x “Y” electrons will be generated.

Halve the number of photons by reducing the light on the scene by 50% then 0.5x “Y” electrons will be generated.

We have two axes on the graph; the horizontal x axis represents the actual light values in the scene, and the vertical y axis represents the output or recorded tones in the image.

So, if we apply Lab L* values to our graph axes above, then 0 equates to black and 1.0 equates to white.

The “slope” of the graph is a straight line giving us an equal relationship between values for input and output.

It’s this relationship between input and output values in digital imaging that helps define GAMMA.

In our particular case here, we have a linear relationship between input and output values and so we have LINEAR GAMMA, otherwise known as gamma 1.0.

Now let’s look at a black to white graduation in gamma 1.0 in comparison to one in what’s called an encoding gamma:

gamma,gamma encoding,Andy Astbury

Linear (top) vs Encoded Gamma

The upper gradient is basically the way our digital cameras see and record a scene.

There is an awful lot of information about highlights and yet the darker tones and ‘shadow’ areas are seemingly squashed up together on the left side of the gradient.

Human vision does not see things in the same way that a camera sensor does; we do not see linearly.

If the amount of ambient light falling on a scene suddenly doubles we will perceive the increase as an unquantifiable “it’s got brighter”; whereas our sensors response will be exactly double and very quantifiable.

Our eyes see a far more ‘perceptually even’ tonal distribution with much greater tonal separation in the darker tones and a more compressed distribution of highlights.

In other words we see a tonal distribution more like that contained in the gamma encoded gradient.

Gamma encoding can be best illustrated with another graph:

gamma,gamma encoding,Andy Astbury

Linear Gamma vs Gamma Encoding 1/2.2 (0.4545)

Now sadly this is where things often get misunderstood, and why you need to be careful about where you get information from.

The cyan curve is NOT gamma 2.2 – we’ll get to that shortly.

Think of the graph above as the curves panel in Lightroom, ACR or Photoshop – after all, that’s exactly what it is.

Think of our dark, low contrast linear gamma image as displayed on a monitor – what would we need to do to the linear slope  to improve contrast and generally brighten the image?

We’d bend the linear slope to something like the cyan curve.

The cyan curve is the encoding gamma 1/2.2.

There’s a direct numerical relationship between the two gamma curves; linear and 1/2.2. and it’s a simple power law:

  •  VO = VIγ where VO = output value, VI = input value and γ = gamma

Any input value (VI) on the linear gamma curve to the power of γ equals the output value of the cyan encoding curve; and γ as it works out equals 0.4545

  •  VI 0 = VO 0
  •  VI 0.25 = VO 0.532
  •  VI 0.50 = VO 0.729
  •  VI 0.75 = VO 0.878
  •  VI 1.0 = VO 1.0

Now isn’t that bit of maths sexy………………..yeah!

Basically the gamma encoding process remaps all the tones in the image and redistributes them in a non-linear ratio which is more familiar to our eye.

Note: the gamma of human vision is not really gamma 1/2.2 – gamma 0.4545.  It would be near impossible to actually quantify gamma for our eye due to the behavior of the iris etc, but to all intents and purposes modern photographic principles regard it as being ‘similar to’..

So the story so far equates to this:

gamma,gamma encoding,Andy Astbury

Gamma encoding redistributes tones in a non-linear manner.

But things are never quite so straight forward are they…?

Firstly, if gamma < 1 (less than 1) the encoding curve goes upwards – as does the cyan curve in the graph above.

But if gamma > 1 (greater than 1) the curve goes downwards.

A calibrated monitor has (or should have) a calibrated device gamma of 2.2:

gamma,gamma encoding,Andy Astbury

Linear, Encoding & Monitor gamma curves.

As you can now see, the monitor device gamma of 2.2 is the opposite of the encoding gamma – after all, the latter is the reciprocal of the former.

So what happens when we apply the decoding gamma/monitor gamma of 2.2 to our gamma encoded image?

gamma,gamma encoding,Andy Astbury

The net effect of Encode & Decode gamma – Linear.

That’s right, we end up back where we started!

Now, are you thinking:

  • Don’t understand?
  • We are back with our super dark image again?

Welcome to the worlds biggest Bear-Trap!

The “Learning Gamma Bear Trap”

Hands up those who are thinking this is what happens:

gamma,gamma encoding,Andy Astbury

If your arm so much as twitched then you are not alone!

I’ll admit to being naughty and leading you to edge of the pit containing the bear trap – but I didn’t push you!

While you’ve been reading this post have you noticed the occasional random bold and underlined text?

Them’s clues folks!

The super dark images – both seascape and the rope coil – are all “GAMMA 1.0 displayed on a GAMMA 2.2 device without any management”.

That doesn’t mean a gamma 1.0 RAW file actually LOOKS like that in it’s own gamma environment!

That’s the bear trap!

gamma,gamma encoding,Andy Astbury

Gamma 1.0 to gamma 2.2 encoding and decoding

Our RAW file actually looks quite normal in its own gamma environment (2nd from left) – but look at the histogram and how all those darker mid tones and shadows are piled up to the left.

Gamma encoding to 1/2.2 (gamma 0.4545) redistributes and remaps those all the tones and lightens the image by pushing the curve up BUT leaves the black and white points where they are.  No tones have been added or taken away, the operation just redistributes what’s already there.  Check out the histogram.

Then the gamma decode operation takes place and we end up with the image on the right – looks perfect and ready for processing, but notice the histogram, we keep the encoding redistribution of tones.

So, are we back where we started?  No.

Luckily for us gamma encoding and decoding is all fully automatic within a colour managed work flow and RAW handlers such as Lightroom, ACR and CapOnePro etc.

Image gamma changes are required when an image is moved from one RGB colour space to another:

  • ProPhoto RGB has a gamma of 1.8
  • Adobe RGB 1998 has a gamma of 2.2
  • sRGB has an oddball gamma that equates to an average of 2.2 but is nearly 1.8 in the deep shadow tones.
  • Lightrooms working colour space is ProPhoto linear, in other words gamma 1.0
  • Lightrooms viewing space is MelissaRGB which equates to Prophoto with an sRGB gamma.

Image gamma changes need to occur when images are sent to a desktop printer – the encode/decode characteristics are actually part and parcel of the printer profile information.

Gamma awareness should be exercised when it comes to monitors:

  • Most plug & play monitors are set to far too high a gamma ‘out the box’ – get it calibrated properly ASAP; it’s not just about colour accuracy.
  • Laptop screen gamma changes with viewing position – God they are awful!

Anyway, that just about wraps up this brief explanation of gamma; believe me it is brief and somewhat simplified – but hopefully you get the picture!

Become a Patron!

Become a patron from as little as $1 per month, and help me produce more free content.

Patrons gain access to a variety of FREE rewards, discounts and bonuses.

MTF, Lens & Sensor Resolution

MTF, Lens & Sensor Resolution

I’ve been ‘banging on’ about resolution lens performance and MTF over the last few posts so I’d like to start bringing all these various bits of information together with at least a modicum of simplicity.

If this is your first visit to my blog I strongly recommend you peruse HERE and HERE before going any further!

You might well ask the question “Do I really need to know this stuff – you’re a pro Andy and I’m not, so I don’t think I need to…”

My answer is “Yes you bloody well do need to know, so stop whinging – it’ll save you time and perhaps stop you wasting money…”

Words used like ‘resolution’ do tend to get used out of context sometimes, and when you guys ‘n gals are learning this stuff then things can get a mite confusing – and nowhere does terminology get more confusing than when we are talking ‘glass’.

But before we get into the idea of bringing lenses and sensors together I want to introduce you to something you’ve all heard of before – CONTRAST – and how it effects our ability to see detail, our lens’s ability to transfer detail, and our camera sensors ability to record detail.

Contrast & How It Effects the Resolving of Detail

In an earlier post HERE I briefly mentioned that the human eye can resolve 5 line pairs per millimeter, and the illustration I used to illustrate those line pairs looked rather like this:

5 line pairs per millimeter with a contrast ratio of 100% or 1.0

5 line pairs per millimeter with a contrast ratio of 100% or 1.0

Now don’t forget, these line pairs are highly magnified – in reality each pair should be 0.2mm wide.  These lines are easily differentiated because of the excessive contrast ratio between each line in a pair.

How far can contrast between the lines fall before we can’t tell the difference any more and all the lines blend together into a solid monotone?

Enter John William Strutt, the 3rd Baron Rayleigh…………

5 line pairs at bottom threshold of human vision - a 9% contrast ratio.

5 line pairs at bottom threshold of human vision – a 9% contrast ratio.

The Rayleigh Criterion basically stipulates that the ‘discernability’ of each line in a pair is low end limited to a line pair contrast ratio of 9% or above, for average human vision – that is, when each line pair is 0.2mm wide and viewed from 25cms.  Obviously they are reproduced much larger here, hence you can see ’em!

Low contrast limit for Human vision (left) & camera sensor (right).

Low contrast limit for Human vision (left) & camera sensor (right).

However, it is said in some circles that dslr sensors are typically limited to a 12% to 15% minimum line pair contrast ratio when it comes to discriminating between the individual lines.

Now before you start getting in a panic and misinterpreting this revelation you must realise that you are missing one crucial factor; but let’s just recap what we’ve got so far.

  1. A ‘line’ is a detail.
  2. but we can’t see one line (detail) without another line (detail) next to it that has a different tonal value ( our line pair).
  3. There is a limit to the contrast ratio between our two lines, below which our lines/details begin to merge together and become less distinct.

So, what is this crucial factor that we are missing; well, it’s dead simple – the line pair per millimeter (lp/mm) resolution of a camera sensor.

Now there’s something you won’t find in your cameras ‘tech specs’ that’s for sure!

Sensor Line Pair Resolution

The smallest “line” that can be recorded on a sensor is 1 photosite in width – now that makes sense doesn’t it.

But in order to see that line we must have another line next to it, and that line must have a higher or lower tonal value to a degree where the contrast ratio between the two lines is at or above the low contrast limit of the sensor.

So now we know that the smallest line pair our sensor can record is 2 photosites/pixels in width – the physical width is governed by the sensor pixel pitch; in other words the photosite diameter.

In a nutshell, the lp/mm resolution of a sensor is 0.5x the pixel row count per millimeter – referred to as the Nyquist Rate, simply because we have to define (sample) 2 lines in order to see/resolve 1 line.

The maximum resolution of an image projected by the lens that can be captured at the sensor plane – in other words, the limit of what can be USEFULLY sampled – is the Nyquist Limit.

Let’s do some practical calculations:

Canon 1DX 18.1Mp

Imaging Area = 36mm x 24mm / 5202 x 3533 pixels/photosites OR LINES.

I actually do this calculation based on the imaging area diagonal

So sensor resolution in lp/mm = (pixel diagonal/physical diagonal) x 0.5 = 72.01 lp/mm

Nikon D4 16.2Mp = 68.62 lp/mm

Nikon D800 36.3Mp = 102.33 lp/mm

PhaseOne P40 40Mp medium format = 83.15 lp/mm

PhaseOne IQ180 80Mp medium format = 96.12 lp/mm

Nikon D7000 16.2mp APS-C (DX) 4928×3264 pixels; 23.6×15.6mm dimensions  = 104.62 lp/mm

Canon 1D IV 16.1mp APS-H 4896×3264 pixels; 27.9×18.6mm dimensions  = 87.74 lp/mm

Taking the crackpot D800 as an example, that 102.33 lp/mm figure means that the sensor is capable of resolving 204.66 lines, or points of detail, per millimeter.

I say crackpot because:

  1. The Optical Low Pass “fights” against this high degree of resolving power
  2. This resolving power comes at the expense of S/N ratio
  3. This resolving power comes at the expense of diffraction
  4. The D800E is a far better proposition because it negates 1. above but it still leaves 2. & 3.
  5. Both sensors would purport to be “better” than even an IQ180 – newsflash – they ain’t; and not by a bloody country mile!  But the D800E is an exceptional sensor as far as 35mm format (36×24) sensors go.

A switch to a 40Mp medium format is BY FAR the better idea.

Before we go any further, we need a reality check:

In the scene we are shooting, and with the lens magnification we are using, can we actually “SEE” detail as small as 1/204th of a millimeter?

We know that detail finer than that exists all around us – that’s why we do macro/micro photography – but shooting a landscape with a 20mm wide angle where the nearest detail is 1.5 meters away ??

And let’s not forget the diffraction limit of the sensor and the incumbent reduction in depth of field that comes with 36Mp+ crammed into a 36mm x 24mm sensor area.

The D800 gives you something with one hand and takes it away with the other – I wouldn’t give the damn thing house-room!  Rant over………

Anyway, getting back to the matter at hand, we can now see that the MTF lp/mm values quoted by the likes of Nikon and Canon et al of 10 and 30 lp/mm bare little or no connectivity with the resolving power of their sensors – as I said in my previous post HERE – they are meaningless.

The information we are chasing after is all about the lens:

  1. How well does it transfer contrast because its contrast that allows us to “see” the lines of detail?
  2. How “sharp” is the lens?
  3. What is the “spread” of 1. and 2. – does it perform equally across its FoV (field of view) or is there a monstrous fall-off of 1. and 2. between 12 and 18mm from the center on an FX sensor?
  4. Does the lens vignette?
  5. What is its CA performance?

Now we can go to data sites on the net such as DXO Mark where we can find out all sorts of more meaningful data about our potential lens purchase performance.

But even then, we have to temper what we see because they do their testing using Imatest or something of that ilk, and so the lens performance data is influenced by sensor, ASIC and basic RAW file demosaicing and normalisation – all of which can introduce inaccuracies in the data; in other words they use camera images in order to measure lens performance.

The MTF 50 Standard

Standard MTF (MTF 100) charts do give you a good idea of the lens CONTRAST transfer function, as you may already have concluded. They begin by measuring targets with the highest degree of modulation – black to white – and then illustrate how well that contrast has been transferred to the image plane, measured along a corner radius of the frame/image circle.

MTF 1.0 (100%) left, MTF 0.5 (50%) center and MTF 0.1 (10%) right.

MTF 1.0 (100%) left, MTF 0.5 (50%) center and MTF 0.1 (10%) right.

As you can see, contrast decreases with falling transfer function value until we get to MTF 0.1 (10%) – here we can guess that if the value falls any lower than 10% then we will lose ALL “perceived” contrast in the image and the lines will become a single flat monotone – in other words we’ll drop to 9% and hit the Rayleigh Criterion.

It’s somewhat debatable whether or not sensors can actually discern a 10% value – as I mentioned earlier in this post, some favour a value more like 12% to 15% (0.12 to 0.15).

Now then, here’s the thing – what dictates the “sharpness” of edge detail in our images?  That’s right – EDGE CONTRAST.  (Don’t mistake this for overall image contrast!)

Couple that with:

  1. My well-used adage of “too much contrast is thine enemy”.
  2. “Detail” lies in midtones and shadows, and we want to see that detail, and in order to see it the lens has to ‘transfer’ it to the sensor plane.
  3. The only “visual” I can give you of MTF 100 would be something like power lines silhouetted against the sun – even then you would under expose the sun, so, if you like, MTF would still be sub 100.

Please note: 3. above is something of a ‘bastardisation’ and certain so-called experts will slag me off for writing it, but it gives you guys a view of reality – which is the last place some of those aforementioned experts will ever inhabit!

Hopefully you can now see that maybe measuring lens performance with reference to MTF 50 (50%, 0.5) rather than MTF 100 (100%, 1.0) might be a better idea.

Manufacturers know this but won’t do it, and the likes of Nikon can’t do it even if they wanted to because they use a damn calculator!

Don’t be trapped into thinking that contrast equals “sharpness” though; consider the two diagrams below (they are small because at larger sizes they make your eyes go funny!).

A lens can transfer full contrast but be unsharp.

A lens can have a high contrast transfer function but be unsharp.

A lens can have low contrast transmission (transfer function) but still be sharp.

A lens can have low contrast transfer function but still be sharp.

In the first diagram the lens has RESOLVED the same level of detail (the same lp/mm) in both cases, and at pretty much the same contrast transfer value; but the detail is less “sharp” on the right.

In the lower diagram the lens has resolved the same level of detail with the same degree of  “sharpness”, but with a much reduced contrast transfer value on the right.

Contrast is an AID to PERCEIVED sharpness – nothing more.

I actually hate that word SHARPNESS; and it’s a nasty word because it’s open to all sorts of misconceptions by the uninitiated.

A far more accurate term is ACUTANCE.

How Acutance effects perceived "sharpness" and is contrast independent.

How Acutance effects perceived “sharpness”.

So now hopefully you can see that LENS RESOLUTION is NOT the same as lens ACUTANCE (perceived sharpness..grrrrrr).

Seeing as it is possible to have a lens with a higher degree resolving power, but a lower degree of acutance you need to be careful – low acutance tends to make details blur into each other even at high contrast values; which tends to negate the positive effects of the resolving power. (Read as CHEAP LENS!).

Lenses need to have high acutance – they need to be sharp!  We’ve got enough problems trying to keep the sharpness once the sensor gets hold of the image, without chucking it a soft one in the first place – and I’ll argue this point with the likes of Mr. Rockwell until the cows have come home!

Things We Already Know

We already know that stopping down the aperture increases Depth of Field; and we already know that we can only do this to a certain degree before we start to hit diffraction.

What does increasing DoF do exactly; it increases ACUTANCE is what it does – exactly!

Yes it gives us increased perceptual sharpness of parts of the subject in front and behind the plane of sharp focus – but forget that bit – we need to understand that the perceived sharpness/acutance of the plane of focus increases too, until you take things too far and go beyond the diffraction limit.

And as we already know, that diffraction limit is dictated by the size of photosites/pixels in the sensor – in other words, the sensor resolution.

So the diffraction limit has two effects on the MTF of a lens:

  1. The diffraction limit changes with sensor resolution – you might get away with f14 on one sensor, but only f9 on another.
  2. All this goes “out the window” if we talk about crop-sensor cameras because their sensor dimensions are different.

We all know about “loss of wide angles” with crop sensors – if we put a 28mm lens on an FX body and like the composition but then we switch to a 1.5x crop body we then have to stand further away from the subject in order to achieve the same composition.

That’s good from a DoF PoV because DoF for any given aperture increases with distance; but from a lens resolving power PoV it’s bad – that 50 lp/mm detail has just effectively dropped to 75 lp/mm, so it’s harder for the lens to resolve it, even if the sensors resolution is capable of doing so.

There is yet another way of quantifying MTF – just to confuse the issue for you – and that is line pairs per frame size, usually based on image height and denoted as lp/IH.

Imatest uses MTF50 but quotes the frequencies not as lp/mm, or even lp/IH; but in line widths per image height – LW/IH!

Alas, there is no single source of the empirical data we need in order to evaluate pure lens performance anymore.  And because the outcome of any particular lens’s performance in terms of acutance and resolution is now so inextricably intertwined with that of the sensor behind it, then you as lens buyers, are left with a confusing myriad of various test results all freely available on the internet.

What does Uncle Andy recommend? – well a trip to DXO Mark is not a bad starting point all things considered, but I do strongly suggest that you take on board the information I’ve given you here and then scoot over to the DXO test methodology pages HERE and read them carefully before you begin to examine the data and draw any conclusions from it.

But do NOT make decisions just on what you see there; there is no substitute for hands-on testing with your camera before you go and spend your hard-earned cash.  Proper testing and evaluation is not as simple as you might think, so it’s a good idea to perhaps find someone who knows what they are doing and is prepared to help you out.   Do NOT ask the geezer in the camera shop – he knows bugger all about bugger all!

Do Sensors Out Resolve Lenses?

Well, that’s the loaded question isn’t it – you can get very poor performance from what is ostensibly a superb lens, and to a degree vice versa.

It all depends on what you mean by the question, because in reality a sensor can only resolve what the lens chucks at it.

If you somehow chiseled the lens out of your iPhone and Sellotaped it to your shiny new 1DX then I’m sure you’d notice that the sensor did indeed out resolve the lens – but if you were a total divvy who didn’t know any better then in reality all you’d be ware of is that you had a crappy image – and you’d possibly blame the camera, not the lens – ‘cos it took way better pics on your iPhone 4!

There are so many external factors that effect the output of a lens – available light, subject brightness range, angle of subject to the lens axis to name but three.  Learning how to recognise these potential pitfalls and to work around them is what separates a good photographer from an average one – and by good I mean knowledgeable – not necessarily someone who takes pics for a living.

I remember when the 1DX specs were first ‘leaked’ and everyone was getting all hot and bothered about having to buy the new Canon glass because the 1DX was going to out resolve all Canons old glass – how crackers do you need to be nowadays to get a one way ticket to the funny farm?

If they were happy with the lens’s optical performance pre 1DX then that’s what they would get post 1DX…duh!

If you still don’t get it then try looking at it this way – if lenses out resolve your sensor then you are up “Queer Street” – what you see in the viewfinder will be far better than the image that comes off the sensor, and you will not be a happy camper.

If on the other hand, our sensors have the capability to resolve more lines per millimeter than our lenses can throw at them, and we are more than satisfied with our lenses resolution and acutance, then we would be in a happy place, because we’d be wringing the very best performance from our glass – always assuming we know how to ‘drive the juggernaut’  in the first place!

Become a Patron!

Become a patron from as little as $1 per month, and help me produce more free content.

Patrons gain access to a variety of FREE rewards, discounts and bonuses.

Lens Performance

I have a friend – yes, a strange concept I know, but I do have some – we’ll call him Steve.

Steve is a very talented photographer – when he’ll give himself half a chance; but impatience can sometimes get the better of him.

He’ll have a great scene in front of him but then he’ll forget things such as any focus or exposure considerations the scene demands, and the resulting image will be crap!

Quite often, a few of Steve’s character flaws begin to emerge at this juncture.

Firstly, Steve only remembers his successes; this leads to the unassailable ‘fact’ that he couldn’t possibly have ‘screwed up’.

So now we can all guess the conclusive outcome of that scenario can’t we……..that’s right; his camera gear has fallen short in the performance department.

Clairvoyance department would actually be more accurate!

So this ‘error in his camera system’ needs to be stamped on – hard and fast!

This leads to Steve embarking on a massive information-gathering exercise from various learned sources on ‘that there inter web’ – where another of Steve’s flaws shows up; that of disjointed speed reading…..

The terrifying outcome of these situations usually concludes with Steve’s confident affirmation that some piece of his equipment has let him down; not just by becoming faulty but sometimes, more worryingly by initial design.

These conclusions are always arrived at in the same manner – the various little snippets of truth and random dis-associated facts that Steve gathers, all get forcibly hammered into some hellish, bastardized ‘factual’ jigsaw in his head.

There was a time when Steve used to ask me first, but he gave up on that because my usual answer contravened the outcome of his first mentioned character flaw!

Lately one of Steve’s biggest peeves has been the performance of one or two of his various lenses.

Ostensibly you’ll perhaps think there’s nothing wrong in that – after all, the image generated by the camera is only as good as the lens used to gather the light in the scene – isn’t it?

 

But there’s a potential problem, and it  lies in what evidence you base your conclusions on……………

 

For Steve, at present, it’s manufacturers MTF charts, and comparisons thereof, coupled with his own images as they appear in Lightroom or Photoshop ACR.

Again, this might sound like a logical methodology – but it isn’t.

It’s flawed on so many levels.

 

The Image Path from Lens to Sensor

We could think of the path that light travels along in order to get to our camera sensor as a sort of Grand National horse race – a steeplechase for photons!

“They’re under starters orders ladies and gentlemen………………and they’re off!”

As light enters the lens it comes across it’s first set of hurdles – the various lens elements and element groups that it has to pass through.

Then they arrive at Becher’s Brook – the aperture, where there are many fallers.

Carefully staying clear of the inside rail and being watchful of any lose photons that have unseated their riders at Becher’s we move on over Foinavon – the rear lens elements, and we then arrive at the infamous Canal Turn – the Optical Low Pass filter; also known as the Anti-alias filter.

Crashing on past the low pass filter and on over Valentines only the bravest photons are left to tackle the the last big fence on their journey – The Chair – our camera sensor itself.

 

Okay, I’ll behave myself now, but you get the general idea – any obstacle that lies in the path of light between the front surface of our lens and the photo-voltaic surface of our sensor is a BAD thing.

Andy Astbury,Wildlife in Pixels,lens,resolution,optical path,sharpness,resolution,imaging pathway

The various obstacles to light as it passes through a camera (ASIC = Application Specific Integrated Circuit)

The problems are many, but let’s list a few:

  1. Every element reduces the level of transmitted light.
  2. Because the lens elements have curved surfaces, light is refracted or bent; the trick is to make all wavelengths of light refract to the same degree – failure results in either lateral or longitudinal chromatic aberration – or worse still, both.
  3. The aperture causes diffraction – already discussed HERE

We have already seen in that same previous post on Sensor Resolution that the number of megapixels can effect overall image quality in terms of overall perceived sharpness due to pixel-pitch, so all things considered, using photographs of any 3 dimensional scene is not always a wise method of judging lens performance.

And here is another reason why it’s not a good idea – the effect on image quality/perceived lens resolution of anti-alias, moire or optical low pass filter; and any other pre-filtering.

I’m not going to delve into the functional whys and wherefores of an AA filter, save to say that it’s deemed a necessary evil on most sensors, and that it can make your images take on a certain softness because it basically adds blur to every edge in the image projected by the lens onto your sensor.

The reasoning behind it is that it stops ‘moire patterning’ in areas of high frequency repeated detail.  This it does, but what about the areas in the image where its effect is not required – TOUGH!

 

Many photographers have paid service suppliers for AA filter removal just to squeeze the last bit of sharpness out of their sensors, and Nikon of course offer the ‘sort of AA filter-less’ D800E.

Side bar note:  I’ve always found that with Nikon cameras at least, the pro-body range seem to suffer a lot less from undesirable AA filtration softening than than their “amateur” and “semi pro” bodies – most notably the D2X compared to a D200, and the D3 compared to the D700 & D300.  Perhaps this is due to a ‘thinner’ filter, or a higher quality filter – I don’t know, and to be honest I’ve never had the desire to ‘poke Nikon with a sharp stick’ in order to find out.

 

Back in the days of film things were really simple – image resolution was governed by just two things; lens resolution and film resolution:

1/image resolution = 1/lens resolution + 1/film resolution

Film resolution was a variable depending on the Ag Halide distribution and structure,  dye coupler efficacy within the film emulsion, and the thickness of the emulsion or tri-pack itself.

But today things are far more complicated.

With digital photography we have all those extra hurdles to jump over that I mentioned earlier, so we end up with a situation whereby:

1/Image Resolution = 1/lens resolution + 1/AA filter resolution + 1/sensor resolution + 1/image processor/imaging ASIC resolution

Steve is chasing after lens resolution under the slightly misguided idea the resolution equates to sharpness, which is not strictly true; but he is basing his conception of lens sharpness based on the detail content and perceived detail ‘sharpness’ of his  images; which are ‘polluted’ if you like by the effects of the AA filter, sensor and imaging ASIC.

What it boils down to, in very simplified terms, is this:

You can have one particular lens that, in combination with one camera sensor produces a superb image, but in combination with another sensor produces a not-quite-so-superb image!

On top of the “fixed system” hurdles I’ve outlined above, we must not forget the potential for errors introduced by lens-to-body mount flange inaccuracies, and of course, the big elephant-in-the-room – operator error – ehh Steve.

So attempting to quantify the pure ‘optical performance’ of a lens using your ‘taken images’ is something of a pointless exercise; you cannot see the pure lens sharpness or resolution unless you put the lens on a fully equipped optical test bench – and how many of us have got access to one of those?

The truth of the matter is that the average photographer has to trust the manufacturers to supply accurately put together equipment, and he or she has to assume that all is well inside the box they’ve just purchased from their photographic supplier.

But how can we judge a lens against an assumed standard of perfection before we part with our cash?

A lot of folk, including Steve – look at MTF charts.

 

The MTF Chart

Firstly, MTF stands for Modulation Transfer Function – modu-what I hear your ask!

OK – let’s deal with the modulation bit.  Forget colour for a minute and consider yourself living in a black & white world.  Dark objects in a scene reflect few photons of light – ’tis why the appear dark!  Conversely, bright objects reflect loads of the little buggers, hence these objects appear bright.

Imagine now that we are in a sealed room totally impervious to the ingress of any light from outside, and that the room is painted matte white from floor to ceiling – what is the perceived colour of the room? Black is the answer you are looking for!

Now turn on that 2 million candle-power 6500k searchlight in the corner.  The split second before your retinas melted, what was the perceived colour of the room?

Note the use of the word ‘perceived’ – the actual colour never changed!

The luminosity value of every surface in the room changed from black to white/dark to bright – the luminosity values MODULATED.

Now back in reality we can say that a set of alternating black and white lines of equal width and crisp clean edges represent a high degree of contrast, and therefore tonal modulation; and the finer the lines the higher is the modulation frequency – which we measure in lines per millimeter (lpmm).

A lens takes in a scene of these alternating black and white lines and, just like it does with any other scene, projects it into an image circle; in other words it takes what it sees in front of it and ‘transfers’ the scene to the image circle behind it.

With a bit of luck and a fair wind this image circle is being projected sharply into the focal plane of the lens, and hopefully the focal plane matches up perfectly with the plane of the sensor – what used to be refereed to as the film plane.

The efficacy with which the lens carries out this ‘transfer’ in terms of maintaining both the contrast ratio of the modulated tones and the spatial separation of the lines is its transfer function.

So now you know what MTF stands for and what it means – good this isn’t it!

 

Let’s look at an MTF chart:

Nikon 500mm f4 MTF chart

Nikon 500mm f4 MTF chart

Now what does all this mean?

 

Firstly, the vertical axis – this can be regarded as that ‘efficacy’ I mentioned above – the accuracy of tonal contrast and separation reproduction in the projected image; 1.0 would be perfect, and 0 would be crappier than the crappiest version of a crap thing!

The horizontal axis – this requires a bit of brain power! It is scaled in increments of 5 millimeters from the lens axis AT THE FOCAL PLANE.

The terminus value at the right hand end of the axis is unmarked, but equates to 21.63mm – half the opposing corner-to-corner dimension of a 35mm frame.

Now consider the diagram below:

Andy Astbury,image circle,photography,frame,full frame,dimensions,radial,

The radial dimensions of the 35mm format.

These are the radial dimensions, in millimeters, of a 35mm format frame (solid black rectangle).

The lens axis passes through the center axis of the sensor, so the radii of the green, yellow and dashed circles correspond to values along the horizontal axis of an MTF chart.

Let’s simplify what we’ve learned about MTF axes:

Andy Astbury,image circle,photography,frame,full frame,dimensions,radial,

MTF axes hopefully made simpler!

Now we come to the information data plots; firstly the meaning of Sagittal & Meridional.   From our perspective in this instance I find it easier for folk to think of them as ‘parallel to’ and ‘at right angles to’ the axis of measurement, though strictly speaking Meridional is circular and Sagittal is radial.

This axis of measurement is from the lens/film plane/sensor center to the corner of a 35mm frame – in other words, along that 21.63mm radius.

Andy Astbury,image circle,photography,frame,full frame,dimensions,radial,

The axis of MTF measurement and the relative axial orientation of Sagittal & Meridional lines. NOTE: the target lines are ONLY for illustration.

Separate measurements are taken for each modulation frequency along the entire measurement axis:

Andy Astbury,image circle,photography,frame,full frame,dimensions,radial,

Thin Meridional MTF measurement. (They should be concentric circles but I can’t draw concentric circles!).

Let’s look at that MTF curve for the 500m f4 Nikon together with a legend of ‘sharpness’ – the 300 f2.8:

MTF chart,Andy Astbury,lens resolution

Nikon MTF comparison between the 500mm f4 & 300mm f2.8

Nikon say on their website that they measure MTF at maximum aperture, that is, wide open; so the 300mm chart is for an aperture of f2.8 (though they don’t say so) and the 500mm is for an f4 aperture – which they do specify on the chart – don’t ask me why ‘cos I’ve no idea.

As we can see, the best transfer values for the two lenses (and all other lenses) is 10 lines per millimeter, and generally speaking sagittal orientation usually performs slightly better than meridional, but not always.

10 lpmm is always going to give a good transfer value because its very coarse and represents a lower frequency of detail than 30 lpmm.

Funny thing, 10 lines per millimeter is 5 line pairs per millimeter – and where have we heard that before? HERE – it’s the resolution of the human eye at 25 centimeters.

 

Another interesting thing to bare in mind is that, as the charts clearly show, better transfer values occur closer to the lens axis/sensor center, and that performance falls as you get closer to the frame corners.

This is simply down to the fact that your are getting closer to the inner edge of the image circle (the dotted line in the diagrams above).  If manufacturers made lenses that threw a larger image circle then corner MTF performance would increase – it can be done – that’s the basis upon which PCE/TS lenses work.

One way to take advantage of center MTF performance is to use a cropped sensor – I still use my trusty D2Xs for a lot of macro work; not only do I get the benefit of center MTF performance across the majority of the frame but I also have the ability to increase the lens to subject distance and get the composition I want, so my depth of field increases slightly for any given aperture.

Back to the matter at hand, here’s my first problem with the likes of Nikon, Canon etc:  they don’t specify the lens-to-target distance. A lens that gives a transfer value of 9o% plus on a target of 10 lpmm sagittal at 2 meters distance is one thing; one that did the same but at 25 meters would be something else again.

You might look at the MTF chart above and think that the 300mm f2.8 lens is poor on a target resolution of  30 lines per millimeter compared to the 500mm, but we need to temper that conclusion with a few facts:

  1. A 300mm lens is a lot wider in Field of View (FoV) than a 500mm so there is a lot more ‘scene width’ being pushed through the lens – detail is ‘less magnified’.
  2. How much ‘less magnified’ –  40% less than at 500mm, and yet the 30 lpmm transfer value is within 6% to 7% that of the 500mm – overall a seemingly much better lens in MTF terms.
  3. The lens is f2.8 – great for letting light in but rubbish for everything else!

Most conventional lenses have one thing in common – their best working aperture for overall image quality is around f8.

But we have to counter balance the above with the lack of aforementioned target distance information.  The minimum focus distances for the two comparison lenses are 2.3 meters and 4.0 meters respectively so obviously we know that the targets are imaged and measured at vastly different distances – but without factual knowledge of the testing distances we cannot really say that one lens is better than the other.

 

My next problem with most manufacturers MTF charts is that the values are supplied ‘a la white light’.

I mentioned earlier – much earlier! – that lens elements refracted light, and the importance of all wavelengths being refracted to the same degree, otherwise we end up with either lateral or longitudinal chromatic aberration – or worse still – both!

Longitudinal CA will give us different focal planes for different colours contained within white light – NOT GOOD!

Lateral CA gives us the same plane of focus but this time we get lateral shifts in the red, green and blue components of the image, as if the 3 colour channels have come out of register – again NOT GOOD!

Both CA types are most commonly seen along defined edges of colour and/or tone, and as such they both effect transferred edge definition and detail.

So why do manufacturers NOT publish this information – there is to my knowledge only one that does – Schneider (read ‘proper lens’).

They produce some very meaningful MTF data for their lenses with modulation frequencies in excess of 90 to 150 lpmm; separate R,G & B curves; spectral weighting variations for different colour temperatures of light and all sorts of other ‘geeky goodies’ – I just love it all!

 

SHAME ON YOU NIKON – and that goes for Canon and Sigma just as much.

 

So you might now be asking WHY they don’t publish the data – they must have it – are they treating us like fools that wouldn’t be able to understand it; OR – are they trying to hide something?

You guys think what you will – I’m not accusing anyone of anything here.

But if they are trying to hide something then that ‘something’ might not be what you guys are thinking.

What would you think if I told you that if you were a lens designer you could produce an MTF plot with a calculator – ‘cos you can, and they do!

So, in a nutshell, most manufacturers MTF charts as published for us to see are worse than useless.  We can’t effectively use them to compare one lens against another because of missing data; we can’t get an idea of CA performance because of missing red, green and blue MTF curves; and finally we can’t even trust that the bit of data they do impart is even bloody genuine.

Please don’t get taken in by them next time you fancy spending money on glass – take your time and ask around – better still try one; and try it on more than 1 camera body!

Become a patron from as little as $1 per month, and help me produce more free content.

Patrons gain access to a variety of FREE rewards, discounts and bonuses.

Noise and the Camera Sensor

Camera sensors all suffer with two major afflictions; diffraction and noise; and between them these two afflictions cause more consternation amongst photographers than anything else.

In this post I’m going to concentrate on NOISE, that most feared of sensor afflictions, and its biggest influencer – LIGHT, and its properties.

What Is Light?

As humans we perceive light as being a constant continuous stream or flow of electromagnetic energy, but it isn’t!   Instead of flowing like water it behaves more like rain, or indeed, bullets from a machine gun!   Here’s a very basic physics lesson:

Below is a diagram showing the Bohr atomic model.

We have a single positively charged proton (black) forming the nucleus, and a single negatively charged electron (green) orbiting the nucleus.

The orbit distance n1 is defined by the electrostatic balance of the two opposing charges.

Andy Astbury,noise,light,Bohr atomic model

The Bohr Atomic Model

If we apply energy to the system then a ‘tipping point’ is reached and the electron is forced to move away from the nucleus – n2.

Apply even more energy and the system tips again and the electron is forced to move to an even higher energy level – n3.

Now here’s the fun bit – stop applying energy to the system.

As the system is no longer needing to cope with the excess energy it returns to its natural ‘ground’ state and the electron falls back to n1.

In the process the electron sheds the energy it has absorbed – the red squiggly bit – as a quantum, or packet, of electromagnetic energy.

This is basically how a flash gun works.

This ‘packet’ has a start and an end; the start happens as the electron begins its fall back to its ground state; and the end occurs once the electron arrives at n1 – therefore it can perhaps be tentatively thought of as being particulate in nature.

So now you know what Prof. Brian Cox knows – CERN here we come!

Right, so what’s this got to do with photography and camera sensor noise

Camera Sensor Noise

All camera sensors are effected by noise, and this noise comes in various guises:

Firstly, the ‘noise control’ sections of most processing software we use tend to break it down into two components; luminosity, or luminance noise; and colour noise.  Below is a rather crappy image that I’m using to illustrate what we might assume is the reality of noise:

Andy Astbury,noise

This shot shows both Colour & Luminance noise.
The insert shows the shot and the small white rectangle is the area we’re concentrating on.

Now let’s look at the two basic components: Firstly the LUMINANCE component

Andy Astbury,noise

Here we see the LUMINANCE noise component – colour & colour noise components have been removed for clarity.

Next, the COLOUR NOISE bit:

Andy Astbury,noise

The COLOUR NOISE component of the area we’re looking at. All luminance noise has been removed.

I must stress that the majority of colour noise you see in your files inside LR,ACR,CapOne,PS etc: is ‘demosaicing colour noise’, which occurs during the demosaic processes.

But the truth is, it’s not that simple.

Localised random colour errors are generated ‘on sensor’ due to the individual sensor characteristics as we’ll see in a moment, because noise, in truth, comes in various guises that collectively effect luminosity and colour:

Andy Astbury,noise

Shot Noise

This first type of noise is Shot Noise – called so because it’s basically an intrinsic part of the exposure, and is caused by photon flux in the light reflected by the subject/scene.

Remember – we see light in a different way to that of our camera. What we don’t notice is the fact that photon streams rise and fall in intensity – they ‘flux’ – these variations happen far too fast for our eyes to notice, but they do effect the sensor output.

On top of this ‘fluxing’ problem we have something more obvious to consider.

Lighter subjects reflect more light (more photons), darker subjects reflect less light (less photons).

Your exposure is always going to some sort of ‘average’, and so is only going to be ‘accurate’ for certain areas of the scene.

Lighter areas will be leaning towards over exposure; darker areas towards under exposure – your exposure can’t be perfect for all tones contained in the scene.

Tonal areas outside of the ‘average exposure perfection’ – especially the darker ones – may well contain more shot noise.

Shot noise is therefore quite regular in its distribution, but in certain areas it becomes irregular – so its often described as ‘pseudo random’ .

Andy Astbury,noise

Read Noise

Read Noise – now we come to a different category of noise completely.

The image is somewhat exaggerated so that you can see it, but basically this is a ‘zero light’ exposure; take a shot with the lens cap on and this is what happens!

What you can see here is the background sensor noise when you take any shot.

Certain photosites on the sensor are actually generating electrons even in the complete absence of light – seeing as they’re photo-voltaic they shouldn’t be doing this – but they do.

Added to this are AD Converter errors and general ‘system noise’ generated by the camera – so we can regard Read Noise as being like the background hiss, hum and rumble we can hear on a record deck when we turn the Dolby off.

Andy Astbury,noise

Thermal & Pattern Noise

In the same category as Read Noise are two other types of noise – thermal and pattern.

Both again have nothing to do with light falling on the sensor, as this too was shot under a duvet with the lens cap on – a 30 minute exposure at ISO 100 – not beyond stupid when you think of astro photography and star trail shots in particular.

You can see in the example that there are lighter and darker areas especially over towards the right side and top right corner – this is Thermal Noise.

During long exposures the sensor actually heats up, which in turn increases the response of photosites in those areas and causes them to release more electrons.

You can also see distinct vertical and some horizontal banding in the example image – this is pattern noise, yet another sensor noise signature.

Andy Astbury,noise

Under Exposure Noise – pretty much what most photographers think of when they hear the word “noise”.

Read Noise, Pattern Noise, Thermal Noise and to a degree Shot Noise all go together to form a ‘base line noise signature’ for your particular sensor, so when we put them all together and take a shot where we need to tweak the exposure in the shadow areas a little we get an overall Under Exposure Noise characteristic for our camera – which let’s not forget, contains other elements of  both luminance noise and colour noise components derived from the ISO settings we use.

All sensors have a base ISO – this can be thought of as the speed rating which yields the highest Dynamic Range (Dynamic Range falls with increasing ISO values, which is basically under exposure).

At this base ISO the levels of background noise generated by the sensor just being active (Pattern,Read & Thermal) will be at their lowest, and can be thought of as the ‘base noise’ of the sensor.

How visually apparent this base noise level is depends on what is called the Signal to Noise Ratio – the higher the S/N ratio the less you see the noise.

And what is it that gives us a high signal?

MORE Photons – that’s what..!

The more photons each photosite on the sensor can gather during the exposure then the more ‘masked’ will be any internal noise.

And how do we catch more photons?

By using a sensor with BIGGER photosites, a larger pixel pitch – that’s how.  And bigger photosites means LESS MEGAPIXELS – allow me to explain.

Buckets in the Rain A

Here we see a representation of various sized photosites from different sensors.

On the right is the photosite of a Nikon D3s – a massive ‘bucket’ for catching photons in – and 12Mp resolution.

Moving left we have another FX sensor photosite – the D3X at 24Mp, and then the crackpot D800 and it’s mental 36Mp tiny photosite  – can you tell I dislike the D800 yet? 

One the extreme left is the photosite from the 1.5x APS-C D7100 just for comparison.

Now cast your mind back to the start of this post where I said we could tentatively regard photons as particles – well, let’s imagine them as rain drops, and the photosites in the diagram above as different sized buckets.

Let’s put the buckets out in the back yard and let’s make the weather turn to rain:

Andy Astbury,Wildlife in Pixels,sensor resolution,megapixels,pixel pitch,base noise,signal to noise ratio

Various sizes of photosites catching photon rain.

Here it comes…

Andy Astbury,Wildlife in Pixels,sensor resolution,megapixels,pixel pitch,base noise,signal to noise ratio

It’s raining

OK – we’ve had 2 inches of rain in 10 seconds! Make it stop!

Andy Astbury,Wildlife in Pixels,sensor resolution,megapixels,pixel pitch,base noise,signal to noise ratio

All buckets have 2 inches of water in them, but which has caught the biggest volume of rain?

Thank God for that..

If we now get back to reality, we can liken the duration of the rain downpour as shutter speed, the rain drops themselves as photons falling on the sensor, and the consistency of water depth in each ‘bucket’ as a correct level of exposure.

Which bucket has the largest volume of water, or which photosite has captured the most photons – in other words which sensor has the highest S/N Ratio?   That’s right – the 12Mp D3s.

To put this into practical terms let’s consider the next diagram:

Andy Astbury,Wildlife in Pixels,sensor resolution,megapixels,pixel pitch,base noise,signal to noise ratio

Increased pixel pitch = Increased Signal to Noise Ratio

The importance of S/N ratio and its relevance to camera sensor noise can be seen clearly in the diagram above – but we are talking about base noise at native or base ISO.

If we now look at increasing the ISO speed we have a potential problem.

As I mentioned before, increasing ISO is basically UNDER EXPOSURE followed by in-camera “push processing” – now I’m showing my age..

Andy Astbury,noise,iso

The effect of increased ISO – in camera “push processing” automatically lift the exposure value to where the camera thinks it is supposed to be.

By under exposing the image we reduce the overall Signal to Noise Ratio, then the camera internals lift all the levels by a process of amplification – and this includes amplifying  the original level of base noise.

So now you know WHY and HOW your images look noisy at higher ISO’s – or so you’d think – again,  it’s not that simple; take the next two image crops for instance:

Andy Astbury, iso,noise,sensor noise

Kingfisher – ISO 3200 Nikon D4 – POOR LIGHT – Click for bigger view

Andy Astbury, iso,noise,sensor noise

Kingfisher – ISO 3200 Nikon D4 – GOOD LIGHT – CLICK for bigger view

If you click on the images (they’ll open up in new browser tabs) you’ll see that the noise from 3200 ISO on the D4 is a lot more apparent on the image taken in poor light than it is on the image taken in full sun.

You’ll also notice that in both cases the noise is less apparent in the high frequency detail (sharp high detail areas) and more apparent in areas of low frequency detail (blurred background).

So here’s “The Andy Approach” to noise and high ISO.

1. It’s not a good idea to use higher ISO settings just to combat poor light – in poor light everything looks like crap, and if it looks crap then the image will look even crappier.When I get in a poor light situation and I’m not faced with a “shot in a million” then I don’t take the shot.

2. There’s a big difference between poor light and low light that looks good – if that’s the case shoot as close to base ISO as you can get away with in terms of shutter speed.

3. I you shoot landscapes then shoot at base ISO at all times and use a tripod and remote release – make full use of your sensors dynamic range.

4. The Important One – don’t get hooked on megapixels and so-called sensor resolution – I’ve made thousands of landscape sales shot on a 12Mp D3 at 100 ISO. If you are compelled to have more megapixels buy a medium format camera which will generate a higher S/N Ratio because the photosites are larger.

5. If you shoot wildlife you’ll find that the necessity for full dynamic range decreases with angle of view/increasing focal length – using a 500mm lens you are looking at a very small section of what your eye can see, and tones contained within that small window will rarely occupy anywhere near the full camera dynamic range.

Under good light this will allow you to use a higher ISO in order to gain that crucial bit of extra shutter speed – remember, wildlife images tend to be at least 30 to 35% high frequency detail – noise will not be as apparent in these areas as it is in the background; hence to ubiquitous saying of  wildlife photographers “Watch your background at all times”.

Well, I think that’s enough to be going on with – but there’s oh so much more!

Become a patron from as little as $1 per month, and help me produce more free content.

Patrons gain access to a variety of FREE rewards, discounts and bonuses.