# Into the sub-pixel realm: Optical simulation

It seems to me that pixel-peeping has degenerated to the level of the ordinary and mundane, and must now be replaced with a novel activity: Sub-pixel peeping!

As this is naturally beyond the capabilities of our cameras, it requires a bit of ingenuity. The camera is replaced with a computer simulation, which can explore much finer scales.

Why do this? My prime motivation is to develop a simulation which can parallel my lens and camera testing, providing insights that are not possible with the camera alone. For example, the simulation environment permits separation of the effects of diffraction and lens point-spread; each may be exercised individually, so by adjusting simulation parameters until its results match physical test results, one may infer the value of the unknown parameter, in this case, point-spread diameter. This yields a lens figure-of-merit unencumbered by the veil of diffraction, thus being sufficiently discriminatory to discern the qualities of the very finest optics. Similarly, this approach may be used to infer AA-filter shifts and other parameters whose effects are not physically separable.

Once the parameter values are known, simulation can be used to assess the outcomes of various scenarios, much more quickly and easily than physical tests could be set up and run.

Those interested in seeing for themselves, the effects of defocus, diffraction, lens point-spread and AA-filter function, and how these affect images gathered by a camera sensor, are invited to visit my new Optical Simulation page. It is my hope that you will at least find some enlightenment in the visualizations which can be created. There is virtually no end to the "what if" studies you can perform.

As I continue using the simulation tool, I'll share interesting results here.

- Marianne

Veni, vidi, exposui

Resolution formulae: Do they work?

A popular formula for the net resolution of combined optical systems is

Rnet = 1/(1/R1 + 1/R2), where Rnet is the resolution of the combination and R1 and R2 are the individual resolutions of the two sub-systems. For example, if a particular film has a resolution of 100 lp/mm and a lens has a resolution of 45 lp/mm at the selected aperture, the predicted net resolution when using them together is 1/(1/100 + 1/45) = 31 lp/mm. This is based on a simple idea, namely that the diameters of the "blur circles" of each subsystem simply add together. But is this correct? I decided to find out, and this is a problem ideally suited to the optical simulator.

For this study, I chose MTF50 resolution to be the criterion, using single-point objects. Then MTF50 occurs when the separation between the single-point images is equal to the 1/4-power diameter of the point spread function. That is, resolution in lp/mm is 1/(1/4-power dia. in mm).

The specific approach becomes: Run the simulator to combine a diffraction response with a lens point-spread response, then compare the 1/4-power diameter of the result with the 1/4-power diameters of the inputs. For example, the f/8 diffraction curve has a 1/4-power diameter of 6.1 microns, so in the presence of diffraction alone, MTF50 occurs when these are placed 6.1 microns apart; in other words, a resolution of 164 lp/mm. If we combine this diffraction with various lens point-spread functions, how does the 1/4-power diameter of the result relate to those of the inputs? Here are a few sample numbers from my study:

Diffraction 6.1 microns + lens PSF 1.4 micron -> 1/4-pwr dia. 6.2 microns (net res 161lp/mm).

Diffraction 6.1 microns + lens PSF 4.2 micron -> 1/4-pwr dia. 7.2 microns (net res 138lp/mm)

Diffraction 6.1 microns + lens PSF 7.1 micron -> 1/4-pwr dia. 9.2 microns (net res 108lp/mm)

Diffraction 6.1 microns + lens PSF 11.3 micron -> 1/4-pwr dia. 13 microns (net res 77lp/mm)

We see immediately that the diameters do not directly add. For most of the cases I tried, the formula quoted above returns values that are up to 30% off - not a very accurate formula at all! However, an alternative rule found in some references does provide good accuracy (within 3% in the cases I tried):

Rnet = 1/sqrt(1/R1^2 + 1/R2^2), which is the formula which I would recommend adopting.

- Marianne

Veni, vidi, exposui

You may find the simulator application, explanations and examples on my new Optical simulation page.

- Marianne

Veni, vidi, exposui

Hi Marianne

Very interesting. Question: how to you calculate the effect of the AA filter ?

BTW Happy New Year !

Thierry - posted as regular forum member

Thank you Marianne for this interesting thread. I will follow it with interest.

Wish you and your family a Very Happy New Year.

How do we know what the resolution of a lens is on a perfect sensor? After all, we only measure lens/camera system resolutions. I was looking at the Tamron 17-50 f2.8 on the D7000 at photozone. At 24mm and f5.6 we see an MTF50 of 2783 in the center, or 178 lp/mm. Now, assuming that the sensor resolves to Nyquist we get a sensor resolution of 3264 or 209 lp/mm. I estimated the resolution of the lens with a perfect DX sensor using "your" formula and got a crazy result of 332 lp/mm. Oddly though, when I plugged it back in for resolution of the lens on a 24MP DX camera I got a sort of reasonable result of 205 lp/mm. Also, I plugged the number back in for the D200 and got a resolution of 147 lp/mm, whereas photozone reports 140.

I'm sure all of this fun is the result of some conceptual error on my part - if not a stupid computational error - and look forward to one of your always illuminating responses.

Jim

Once again, an interesting contribution to the forum from one of it's most valued members. Thanks very much for this.

Here are a few of my favorite things...

---> http://www.flickr.com/photos/95095968@N00/sets/72157626171532197/

JimPearce wrote:

How do we know what the resolution of a lens is on a perfect sensor? After all, we only measure lens/camera system resolutions. I was looking at the Tamron 17-50 f2.8 on the D7000 at photozone. At 24mm and f5.6 we see an MTF50 of 2783 in the center, or 178 lp/mm. Now, assuming that the sensor resolves to Nyquist we get a sensor resolution of 3264 or 209 lp/mm. I estimated the resolution of the lens with a perfect DX sensor using "your" formula and got a crazy result of 332 lp/mm. Oddly though, when I plugged it back in for resolution of the lens on a 24MP DX camera I got a sort of reasonable result of 205 lp/mm. Also, I plugged the number back in for the D200 and got a resolution of 147 lp/mm, whereas photozone reports 140.

The resolution formula works well for "nicely behaved" systems that have smooth point-spread profiles and monotonic roll-off of the MTF curves with spatial frequency.

Sensors, however, are a rather different kind of beast. They have abrupt spatial response, and their sampling nature gives them relatively erratic MTF curves - some of my prime motivators for creating the simulator.

Keep in mind that the numbers from Photozone encompass even more than the lens/camera system, since their Imatest analyses are performed on the raw converter output (from ACR), not directly on the camera RAW data. It's quite clear that the numbers they obtain include the effect of an approximately 2:1 increase in amplitude slope at the step edges being analyzed, which is a result of the default sharpening applied by the converter. Consider that the best lenses they test on the D3x are reported to achieve MTF50 near 4000 lw/ph, which is the Nyquist frequency for the D3x. It's a mathematical impossibility for a sensor with an AA filter to achieve MTF50 at Nyquist!

Regarding your opening question, today we can get close to measuring the true optimum resolution of a lens, with the D800E and scanning techniques, using near-point sources. I have the equipment now - it's just a matter of getting the time to use it. The simulation work that I'm doing supports this effort.

In the meantime, I do have some interesting insights from the simulator to share, regarding the sensitivity of the D800E versus D800 to very small lens aberrations. That will be the subject of my next post . . .

- Marianne

Veni, vidi, exposui

Very interesting.

Best wishes for a 2013 full of magic, health and wealth.

With very kind regards,

Raul

"There is not a thin line between love and hate. There is - in fact - a Great Wall of China with armed sentries posted every 20 feet between love and hate." (House)

In the presence of diffraction, how well can a camera sensor discern the very small lens aberrations exhibited by the highest quality optics? How much of a handicap, does an AA filter present, i.e., is the absence of an AA filter of much benefit?

For this study, I examined the simulated responses of a D800 and D800E at f/5.6, using an estimated 0.4-sensel shift for the AA filter of the D800 (typical AA filters use 0.5-sensel shift, so the 0.4 value would be considered a weak AA filter). The test object used is a narrow line, only a small fraction of a sensel in width. This particular object choice yields two different parameters usable for estimating relative lens sharpness: Quarter-power width of the response, and the response center peak value. [As blurring of the test object increases, the energy is spread wider, resulting in a reduction of the peak value.]

Case 1: Detecting the change from a lens PSF half-power diameter of 1um, to 2um

This is a difficult case, equivalent to distinguishing between lenses that, without diffraction, would have resolutions of 700lp/mm and 350lp/mm! Without an AA filter, the D800E detects a decrease of central brightness of 5% while the D800 sees a 2.5% change. Regarding the spread of the response, the D800E sees a 6% increase, and the D800 a 2.9% increase. For both parameters, then, the D800E has twice the sensitivity of the D800.

Case 2: Detecting the change from a lens PSF half-power diameter of 1um, to 4um

The D800E detects a decrease of central brightness of 19% while the D800 sees a 10% change. Regarding the spread of the response, the D800E sees a 28% increase, and the D800 a 13% increase. As in case 1, the D800E exhibits about twice the sensitivity of the D800, to the change in quality of the optics.

- Marianne

Veni, vidi, exposui

we expected that the AA was going to muddle the finest stuff.

So it is a factor of about two !!

Thinking of your former post on AA filtering http://forums.dpreview.com/forums/post/37628446 it would be interesting to see what the D800E does. We could take your former measurements on the D7000 as a substitute for the D800 as the pixel size is really close.

wishing you a Happy New Year !

B

PS: I am unclear about your units for sensel shift. You say 0.5 is normal. I would have expected one needs 1 pixel size shift (4.7 mum for D800/E) to hit all Bayer colors equally with a finely focused beam.

Marianne Oelund wrote:

JimPearce wrote:

How do we know what the resolution of a lens is on a perfect sensor? After all, we only measure lens/camera system resolutions. I was looking at the Tamron 17-50 f2.8 on the D7000 at photozone. At 24mm and f5.6 we see an MTF50 of 2783 in the center, or 178 lp/mm. Now, assuming that the sensor resolves to Nyquist we get a sensor resolution of 3264 or 209 lp/mm. I estimated the resolution of the lens with a perfect DX sensor using "your" formula and got a crazy result of 332 lp/mm. Oddly though, when I plugged it back in for resolution of the lens on a 24MP DX camera I got a sort of reasonable result of 205 lp/mm. Also, I plugged the number back in for the D200 and got a resolution of 147 lp/mm, whereas photozone reports 140.

The resolution formula works well for "nicely behaved" systems that have smooth point-spread profiles and monotonic roll-off of the MTF curves with spatial frequency.

Sensors, however, are a rather different kind of beast. They have abrupt spatial response, and their sampling nature gives them relatively erratic MTF curves - some of my prime motivators for creating the simulator.

Keep in mind that the numbers from Photozone encompass even more than the lens/camera system, since their Imatest analyses are performed on the raw converter output (from ACR), not directly on the camera RAW data. It's quite clear that the numbers they obtain include the effect of an approximately 2:1 increase in amplitude slope at the step edges being analyzed, which is a result of the default sharpening applied by the converter. Consider that the best lenses they test on the D3x are reported to achieve MTF50 near 4000 lw/ph, which is the Nyquist frequency for the D3x. It's a mathematical impossibility for a sensor with an AA filter to achieve MTF50 at Nyquist!

Yes it is.

But the practical purpose of the AA-filter is to filter out the frequencies above Nyquist which it does to a degree but not perfectly as practical AA-filters are weaker than that to retain actual resolution closer to Nyquist. This is attenuated by the sharpening process to undo the resolution (contrast) reducing function of the AA-filter up to Nyquist.

The AA-filter/sharpening process is a practical although not theoretically perfect way of filtering out the frequencies above Nyquist but still giving visible resolution close to Nyquist.

Regarding your opening question, today we can get close to measuring the true optimum resolution of a lens, with the D800E and scanning techniques, using near-point sources. I have the equipment now - it's just a matter of getting the time to use it. The simulation work that I'm doing supports this effort.

In the meantime, I do have some interesting insights from the simulator to share, regarding the sensitivity of the D800E versus D800 to very small lens aberrations. That will be the subject of my next post . . .

Looking forward to seeing the results.

Kind regards

Kaj

http://www.pbase.com/kaj_e

WSSA member #13

It's about time we started to take photography seriously and treat it as a hobby.- Elliott Erwitt

Marianne Oelund wrote:

I examined the simulated responses of a D800 and D800E at f/5.6, using an estimated 0.4-sensel shift for the AA filter of the D800

Good call, Frans van der Bergh used an OLPF split distance of 0.375 'pixels' on the D7k to get a good match to his MTF model including AA and diffraction. Scroll to the bottom half of the page if you haven't seen it before.

As in case 1, the D800E exhibits about twice the sensitivity of the D800, to the change in quality of the optics.

With your setup, shouldn't you be able to extract the D800 AA's MTF50 value by measuring the D800's and D800E's equally set up?

Thanks for the excellent mental gymnastics!

Jack

Marianne Oelund wrote:

You may find the simulator application, explanations and examples on my new Optical simulation page.

-- hide signature --- Marianne

Veni, vidi, exposui

Marianne, are you planning to release the source code to your simulator?

Leo

Leo360 wrote: Marianne, are you planning to release the source code to your simulator?

Yes, when it's 100% complete.

- Marianne

Veni, vidi, exposui

Marianne Oelund wrote

Case 1: Detecting the change from a lens PSF half-power diameter of 1um, to 2um

That is similar to the difference between an aberration-free f/0.75 and an aberration-free f/1.5 lens, in the presence of diffraction for both.

Case 2: Detecting the change from a lens PSF half-power diameter of 1um, to 4um

The difference between perfect f/0.75 and f/3.0 lenses, again with diffraction.

If we ever get any two of those in the F mount, the D800E will be the top choice for sure.

It will be extremely interesting to see a simulation of the difference in detectability between a nearly perfect f/2.8 lens and a slightly more aberrated one. That one is much more testable (still requires a healthy lens budget though). That playing field starts at 3.7 microns.

Marianne Oelund wrote:

Case 1: Detecting the change from a lens PSF half-power diameter of 1um, to 2um

This is a difficult case, equivalent to distinguishing between lenses that, without diffraction, would have resolutions of 700lp/mm and 350lp/mm! Without an AA filter, the D800E detects a decrease of central brightness of 5% while the D800 sees a 2.5% change. Regarding the spread of the response, the D800E sees a 6% increase, and the D800 a 2.9% increase. For both parameters, then, the D800E has twice the sensitivity of the D800.

Case 2: Detecting the change from a lens PSF half-power diameter of 1um, to 4um

The D800E detects a decrease of central brightness of 19% while the D800 sees a 10% change. Regarding the spread of the response, the D800E sees a 28% increase, and the D800 a 13% increase. As in case 1, the D800E exhibits about twice the sensitivity of the D800, to the change in quality of the optics.

You probably thought of this already but I didn't see it mentioned above.

Because the D800 family has 36MP resolution, not 14.4GP, I realized that there needs to be a 20X downsampling before the patterns can resemble what the camera will produce.

I quickly ran 3 simulations, all at f/2.8, diffraction, and your default AA filter setting. The point spread functions I applied were 0, 1, and 2 microns. At your native BMP output the differences in those 20X-oversampled patterns were readily apparent. But once I downsampled to 50 pixels on the long edge, 4 dots became one pixel that looks just like the non-AA rendition. When I get time to get back to it I'll "probe" the pixels with the cursor in Lightroom.

just Tony wrote:

You probably thought of this already but I didn't see it mentioned above.

Because the D800 family has 36MP resolution, not 14.4GP, I realized that there needs to be a 20X downsampling before the patterns can resemble what the camera will produce.

The simulated sensor RAW data output isn't shown as an image. Use the /L switch to output the sensel DN values to a text file, which can be pasted into a spreadsheet for analysis.

- Marianne

Veni, vidi, exposui

Marianne Oelund wrote:

Use the /L switch to output the sensel DN values to a text file, which can be pasted into a spreadsheet for analysis.

First of all, I'm late in thanking you for an interesting analytical tool. So... thanks.

I didn't see an explanation of the term "DN". Did you take a central 980x20 band of micro-samples, then perform a straightforward binning of 20x20 blocks to generate the 49x1 strip of sensel values?

- Canon EOS M58.8%
- Panasonic G85/G803.3%
- Panasonic FZ2500/FZ20001.9%
- Panasonic LX10/LX151.2%
- Panasonic GH5 development3.6%
- Sony a99 II15.9%
- Nikon KeyMission 170 and 801.0%
- Fujifilm GFX 50S development28.3%
- Olympus E-M1 II development18.7%
- Olympus E-PL80.1%
- Olympus 25mm F1.2 Pro1.5%
- Olympus 12-100mm F4 IS Pro1.9%
- Olympus 30mm F3.5 Macro0.1%
- Sigma 85mm F1.4 Art3.6%
- Sigma 12-24mm F4 Art2.6%
- Sigma 500mm F4 DG OS HSM Sport2.4%
- YI M12.2%
- GoPro Hero50.8%
- GoPro Karma drone2.2%