Understanding image sharpness part 5:
Lens testing
by Norman Koren

Site map/guide to tutorials
Contact | News

Making fine prints in your digital darkroom
Understanding image sharpness and MTF
Image galleries / How to purchase prints
Photographic technique
Image editing with Picture Window Pro

A simplified zone system
Canon FS4000US 4000 dpi scanner
Epson 2450 flatbed scanner
Digital vs. film | Canon EOS-10D
Building simple web pages
updated Feb. 15, 2005
Color Management by X-Rite  Canon  Epson  HP  i1  Eye-One - Densitometers - Spectrophotometers - Eizo - Canon Large Format
 
Help support this site by linking to these merchants
or

In Association with Amazon.com
for books & merchandise

for all your photographic needs



View image galleries

Google

Search WWW Search www.normankoren.com

Table of contents

for the
image sharpness
series

Part 1: Introduction
Part 1A: Film and lenses
Part 2: Scanners and sharpening
4000 vs. 8000 dpi scans
Part 3: Printers and prints
Part 4: Epson 1270 results
Part 5: Lens testing
Why test? | Resources | New chart | Download
Print the charts and assemble the target
Distance | Photographing the target
Interpretation | What to look for | ImageJ
Determining MTF qualtitatively | sfrcalc
Part 6: Depth of field and diffraction
Digital cameras vs. film, part 1 | part 2
Part 8: Grain and sharpness: comparisons
In this page we discuss lens testing (actually, testing complete photographic systems) using the Koren 2003 lens test chart, which has continuously varying spatial frequency. You can download, print and assemble it yourself. This approach is primarily intended for film images, but Imatest Log frequency analyzes digitized images of the chart described below.
 
For digital cameras or digitized film images, the approach used by Imatest is far more accurate and convenient.
Imatest: affordable software for measuring sharpness and image quality
Green is for geeks. Do you get excited by a good equation? Were you passionate about your college math classes? Then you're probably a math geek a member of a maligned and misunderstood but highly elite fellowship. The text in green is for you. If you're normal or mathematically challenged, you may skip these sections. You'll never know what you missed.

Why test your lens?

Some excellent lens test results are available on the Internet. So why test your own?
  1. Lenses vary from sample to sample. You may have a limited period to return a newly purchased lens, and you need to evaluate it quickly.
  2. You may not be able to find test results for your particular lens.
  3. You may want to learn more about the fine details of its performance, for example, how does sharpness vary with aperture, with distance from the image center, or with distance from the subject?
  4. You can learn how other aspects of your technique and imaging system— tripods, filters, film, mirror lock, etc.— affect image sharpness.
The lens tests presented here deal primarily with sharpness. Lenses have other attributes that affect image quality: distortion, contrast, flare, uniformity of illumination, color rendition, "bokeh" (out of focus behavior), etc., many of which are tested by Imatest, but sharpness is arguably the most important contributor to image quality. (Distortion, light falloff, and lateral chromatic aberration can be corrected in software.) For film, these tests provide an approximate estimate of the 50% and 10% MTF frequencies— far from precise, but better than the classic USAF 1951 chart. For digital cameras and digitized film images the test chart sine pattern can produce MTF plots using either the free software described below or Imatest Log frequency (more convenient and accurate). The Imatest slanted-edge SFR method produces even more accurate and repeatable results.

Lens testing resources

Robert Monaghan's Lens Resolution Testing page contains links to test targets and serious discussions about image sharpness. His Medium Format Articles Page is also a great resource.
Bob Atkins, the busy director of the photo.net nature photography pages, had a page on Technical Optics that covers lens testing. He also sells a lens test kit based on a modified USAF 1951 test chart.
Richard Stringer, a Canadian cinematographer, has developed a set of Target Resolution Charts for use in the film industry. A significant improvement over USAF 1951.
Edmund Optics has a line of lens test targets. Their 36x24 inch Resolving Power Chart NT83-001, illustrated on the right and based on the USAF 1951 test chart (below), sells for $18.95. Their other versions of the USAF 1951 Glass Slide Resolution Targets cost between $103 and $850. Ouch.  
Lens testing charts from Sine Patterns, LLC  Specialized industrial strength targets.
How to test a lens by Charles Sleicher, PhD, is full of valuable tips. Excellent reading. He also sells a test kit derived from the USAF 1951 chart.
PDML lens testing procedure  Uses USAF chart.
ZGC Motion Picture Film & Video Sales and Service has several charts. Their 7A9 Sharpness Indicator Test Chart is quite interesting.
Photodo articles on MTF and lens performance  Extremely informative, but little detail on their testing techniques, which use elaborate equipment not available to consumers. Photodo also has a large data base of lens tests. They stopped testing lenses in 2000 because of a familiar Internet problem: no money to be made.
Ken Rockwell's glossary of lens testing terms  A reminder that there's more to lens quality than sharpness.
Resolution test patterns  Page by John Beale.  Contains a nice Postscript/PDF test pattern.
Horst Kretzschmar ( www.eos-d60.de ) has started a series of lens tests on the Canon EOS D60 using my lens test charts. The test method is in the article, Machen Sie mit beim neuen Objektivtest an Ihrer Canon EOS-D60. My Deutsch isn't good enough to decipher it; for that I used the Google translator.
White Paper: Using a Nyquist Chart from Photobit Technology. Good reading on a test chart specific to digital cameras, which can suffer from serious aliasing and Moiré effects.
William Castleman has some interesting descriptions of Canon lenses and bodies, including the EOS-1Ds and EOS-1D Mark II. His latest tests use my Koren 2003 test chart.

Why a new lens test chart?

The USAF 1951 lens test chart (on the right; Robert Monaghan's detailed printable PDF version) and its variants have been a standard for half a century. But it is unsuited for computer analysis because of its fragmented arrangement, and it is poorly suited for visually estimating MTF (Modulation Transfer Function, which is synonymous with spatial frequency response; see Understanding image sharpness part 1). It is often misused. People strain their eyes to find highest resolution at which bars can be distinguished. This frequently results in impressive resolution numbers (over 100 lp/mm) that are poorly related to visible image quality. The goal of testing with the new chart is to be able to say, "at a given f-stop, the center or corner of this lens has 50% MTF at roughly x lp/mm and 10% MTF at y lp/mm. These numbers are well standardized and closely related to perceived image quality and resolution. In this context, MTF means contrast compared to low spatial frequency images.

The Koren 2003 lens test chart

I originally named the new chart in honor of the fiftieth anniversary of the USAF 1951 lens test chart, then I updated it in 2002 and 2003. (The Imatest Log Frequency chart, which can be created by Imatest Test Charts, is a more recent update which omits the scales because spatial frequencies are automatically detected by Imatest.) Actually "lens" test chart is something of a misnomer since it's difficult to test a lens in isolation. You are really testing an imaging system. A typical version of the chart is shown below. The Moiré fringing visible above 75 lp/mm and most prominent around 145 lp/mm is an artifact of the interaction between the pattern and screen pixels; it does not appear on the printed chart. Here are some features of the new chart:

2.5 mm chart example

Structure of the Koren 2003 lens test chart

The test chart consists of 6 bands. The primary sine pattern (bands 1 and 4) and the primary bar pattern (bands 3 and 6), are each repeated twice. The other bands are used for reference and visual comparison. A portion of the chart is shown on the left, below. The bands are,
 
1, 4. Sine pattern, 2-200 lp/mm, for determining MTF response— the contrast at a given frequency relative to low frequencies.
.
3, 6. Bar pattern, 2-200 lp/m, for observing sharpness— more visible than for the sine pattern. At high spatial frequencies where contrast has dropped by half or more, the bar pattern contrast is higher than the sine pattern by about 27% (a factor of 4/pi). The sine pattern gives correct MTF.
.
2. 50% contrast reference: a sine pattern varying between 25 and 75% reflectance at constant spatial frequency. The actual printed level is affected by gamma, discussed below. A sine pattern is used because the image on film appears to be sinusoidal at spatial frequencies where MTF is 50% or less. This band is intended to illustrate the appearance 50% contrast in order to facilitate your visual estimate of the 50% contrast MTF frequency in bands 1 and 4. You should be able to estimate this frequency with an accuracy of around 10%.
.
5. 10% contrast reference: a sine pattern varying between 45 and 55% reflectance at constant spatial frequency. Similar to band 2, but intended to illustrate the appearance of 10% contrast. The chart is designed so that each contrast reference band is adjacent to both sine and bar patterns. Contrast reference bands 2 and 5 are not used with digitized images.

In addition, there is a thin middle gray reference band between and to the right of bands 3 and 4.

Chart details

The test charts come in several flavors, identified by their intended length when reproduced on film or a digital sensor, gamma, length in pixels, and ink spread correction. Similar test charts, with the sacle omitted, can be created using Imatest Test Charts.

Chart length:  The names of the charts below (2.5 and 5mm) are the intended lengths of the chart when reproduced on film or a digital sensor. They are designed to be printed at 50, 80, or 100x magnification (relative to the intended size on the film or sensor) to avoid printer limitations.

2.5 mm charts (illustrated above) are designed to be printed 25 cm (9.84 inches) long (100x magnification) on a 4.5x11 inch strip— half of a letter sized or A4 sheet. The 7086 pixel long charts are best for printing at multiples of 720 dpi (Epson printers). The 5906 pixel long charts are best for printing at multiples of 600 dpi (Canon and HP printers). 2.5 mm charts are recommended for compact digital cameras, which have tiny sensors (11 mm diagonal or less) and lenses with relatively short focal length.

5 mm charts are designed to be printed 25 cm (9.84 inches) long (50x magnification), which fits on a 4.25x11 inch strip— half of a letter sized or A4 sheet, or 40 cm (15.75 inches) long (80x magnification), which fits on half of an A3 sheet.

You can print these charts any size you want as long as you note the magnification and photograph them at the appropriate distance, but I recommend the standard sizes to avoid confusion.

Print magnification: advantages/disadvantages


400 dpi scan of 50x chart, printed on the Epson 1270 at 1440 dpi, shown between 80 and 200 lp/mm.
Gamma is the exponent of the function that relates pixel level to monitor brightness and print reflectivity. It affects the density of the sine patterns, but has little effect on the pure black and white tones in the bar pattern.
For 24/8-bit image files where pixel levels vary between 0 and 255, if print reflectance varies between 0 (pure black) and 1 (pure white) (it's actually more like 0.01 and 0.95), the simplified equation for print reflectance is,
reflectance = (pixel level/255)gamma
For properly calibrated Windows systems (and sRGB and Adobe RGB color spaces), gamma is 2.2. For older Macintosh systems, gamma is 1.8 (I believe 2.2 is now the standard). Small differences in gamma are barely visible. The Epson 1270 and 2200 printer allows you to select gamma of 1.5, 1.8 or 2.2.

At high spatial frequencies, where the MTF of lenses, film, and sensors is declining, an ideal black and white bar pattern (1) gradually merges into 50% gray (halfway between black and white). The actual gray level is affected by ink spread (dot gain) in the printed chart. The average reflectivity of the reference patterns depends on printer gamma. To facilitate visual comparison, it should be close to the gray level of the merged bar pattern. Because many variables affect this match, two sets of charts are available, illustrated below.

Gamma = 1.5
Gamma = 2.0
The charts are designed so the average reflectivity of the reference patterns is 0.5 when printed at the specified gamma, 1.5 or 2. Ideally you would only need the Gamma = 2 charts, which are close to the Windows and Macintosh standards. But printers and printer drivers deviate from ideal, especially for sine patterns at high spatial frequencies. Sometimes the Gamma = 1.5 charts simply look better. Use the chart (gamma = 1.5 or 2) that looks best on your printer.
The charts are written so that 50% gray has a normalized pixel level (pixel value/255) of 0.51/gamma (0.707 for gamma = 2). When they are printed at the specified gamma (2 is close enough to 1.8 or 2.2), 50% gray should be printed at the correct level. But because reality can be a bit messy— the actual levels are affected by ink spread, printer drivers, and other factors, the gamma = 1.5 chart may look better printed. If needs be, you can adjust gamma in your image editor by using a gamma or curves
For best accuracy, you may want to adjust gamma in the digitized result to minimize gamma distortion, which is plainly visible in the readback charts below, where the sine waves are somewhat rounded on top and sharp on the bottom (dot gain distortion is also present). I find that a modest amount of  gamma distortion doesn't degrade the results severely.

Pixel length: The 7086 pixel (length) charts are best for printing 25 cm (9.8425 inch) long charts with printers that operate at multiples of 720 dpi (Epson). At least 1440 dpi is recommended. The 5906x1798 pixel charts are best for printing 25 cm long charts with printers that operate at multiples of 600 dpi (Canon and HP). At least 1200 dpi is recommended.

Ink spread (also called dot gain), present in most inkjet printers, affects the printed appearance of the bar pattern at the highest spatial frequencies. The overall tonal effects of ink spreading is compensated in software (by ICC profiles, etc.), but fine line patterns can't be compensated. In charts with ink spread = 0, black and white bars have the same width; they aren't compensated for ink spread. In charts with inkspread = 0.25, black bars are narrowed by a fixed amount, equal to a factor of 0.25 at the highest spatial frequency.

Download the chart

Charts can be downloaded by right-clicking on the appropriate file name in the table below. The 7086 pixel charts (15.3 MB image size; best for Epson printers) are approximately 200 kB in PNG format, which has efficient lossless compression and is recognized by virtually all browsers and editors. It deserves to be better known. The 5906 pixel charts (10.6 MB image size; best for Canon/HP printers) are approximately 170 kB in PNG format. Recommended printed length for all charts is 25 cm = 9.84 inches.
 
Chart length
on film or sensor
(note 1)
Gamma
(note 3)
Ink
spread
(note 4)
Pixel
length
(note 5)
File name
2.5 mm

M = 100
(note 2)

1.5 0 7086
5906
Lenstarg_25_7086p_15g_0is.png
Lenstarg_25_5906p_15g_0is.png
1.5 0.25 7086
5906
Lenstarg_25_7086p_15g_25is.png
Lenstarg_25_5906p_15g_25is.png
2 0 7086
5906
Lenstarg_25_7086p_20g_0is.png
Lenstarg_25_5906p_20g_0is.png
2 0.25 7086
5906
Lenstarg_25_7086p_20g_25is.png
Lenstarg_25_5906p_20g_25is.png
5 mm

M = 50
(note 2)

1.5 0 7086
5906
Lenstarg_50_7086p_15g_0is.png
Lenstarg_50_5906p_15g_0is.png
1.5 0.25 7086
5906
Lenstarg_50_7086p_15g_25is.png
Lenstarg_50_5906p_15g_25is.png
2 0 7086
5906
Lenstarg_50_7086p_20g_0is.png
Lenstarg_50_5906p_20g_0is.png
2 0.25 7086
5906
Lenstarg_50_7086p_20g_25is.png
Lenstarg_50_5906p_20g_25is.png
Notes
  1. Use 2.5 mm charts for compact digital cameras (11 mm diagonal sensors or smaller). 5 mm charts require longer camera-to-target distance, d1.
  2. In practice you'll see little response above 100 lp/mm with film or digital SLRs. For this reason, you might want to choose a value of magnification M that's half the nominal value: 50 for the 2.5 mm charts or 25 for the 5 mm charts. The actual lp/mm will be half the lp/mm marked on the chart, i.e. spatial frequency will be 100 lp/mm where the chart indicates 200. This reduces the lens-to-target distance, d1, which can be inconveniently large for long lenses (large f ).
  3. Gamma = 1.5 is recommended for the first try. If the chart prints dark at high spatial frequencies, try Gamma = 2.0.
  4. Ink spread correction of 0.25 is recommended for inkjet printers. Affects only the bar pattern.
  5. 7086 pixel long charts are recommended for printers with multiples of 720 dpi (Epson); 5906 pixel long charts are recommended for printers with multiples of 600 dpi (Canon, HP).
Copyright notice: All lens test charts are copyright © 2001-2003 by Norman Koren. These charts may be reproduced without restriction for personal use. Permission is granted to publish test results using these charts providing you credit the author, including a link to this web page (if it's published on the Internet). Please inform the author via e-mail. Contact me if you are interested in publishing these charts with a high quality process that would allow the use of lower magnification.

Print the chart and Assemble the target

You will need to open the chart in your image editor and print several copies with you printer set to its highest resolution. Use glossy, semigloss, or luster paper for best detail. You may want to slit standard sheets of paper lengthwise: two 4.25x11 inch strips from an 8.5x11 sheet, etc. Check to make sure the average density of the gray tones in the 10% contrast reference band (5) is close to the average density at high spatial frequencies for the bar and sine patterns (viewed from a distance). You may have to make a curves or gamma adjustment if it isn't. I recommend examining the printed chart under a loupe (at least 10x) to be sure the sine and bar patterns are clear at high spatial frequencies.

Next, assemble the charts into a target. I recommend using 32x40 inch foam board (larger if convenient), which is available at any art supply store. Charts can be safely attached using stick glue. (One widely available brand, Ross Stik, claims to be acid free.) An example of a target, designed for the 22.7x15.1 mm sensor of the Canon EOS-10D,  is shown on the right. (The entire target isn't shown— there is more on the left and the bottom to accomodate the 24x36 mm 35mm format.) You may want to take advantage of available real estate and include a gray card and a color chart— you might as well test for lens attributes other than sharpness. Digital Dog's Printer test file, illustrated in Making fine prints in your digital darkroom, would be a good choice. Leave room for a Post-it, which you'll use for critical information (lens, focal length, f-stop). This isn't necessary with a modern digital camera like the EOS-10D, which records it all. You may also want to add some charts at an angle.

Draw a scale on the target to represent the distance from the center of the sensor in 1 mm increments. For the target in the illustration, which uses 5 cm charts intended for 50x magnification, the 1 mm marks were placed every 5 cm. The center of the target in the photograph (easy to locate in the viewfinder) is placed just below the number 0 on the scale, near the upper right of the target.

The scale is useful for setting camera-to-target distance. Since the distance from the center to the edge of the EOS-10D sensor is 22.7/2 = 11.35 mm, the left side of the image should be aligned with 11.3 on the scale. You would use 18 mm for a 24x36 mm frame with 35mm film. Since most viewfinders show less than the full image I aligned it at just under 11 to get close to 11.3. This technique is a lot easier than using a tape measure. With a little trial-and-error (and a tape measure for calibration) you'll get it just right.

Distance

For the target's lp/mm scale to be calibrated correctly it must be at the correct distance from the camera (though the distance doesn't have to be precise— small errors of 1 or 2 percent are not significant). The equation is,
d1+d2 =  film-to-target distance = (M+2) f ..(close approximation for M>>1)
Use M = 50 or 100, as indicated above. A measuring tape is more accurate than the distance scale on most lenses (particularly 35mm zooms), which indicates d1+d2. The easiest way to set distance is with a scale on the target, as described above.
.
Derivation The simplified lens equation is
1/d1 + 1/d2 = 1/f   where
d1 is the lens-to-object distance (target for those of us who aren't optics geeks); d2 is the lens-to-film distance;  f is the lens's focal length. The magnification (in this case, magnification of the object (the printed target) with respect to image on the film) is.
M = d1/d2
Using 1/d2 = M/d1, we can solve for d1: 1/d1 + M/d1 = 1/f = (1 + M)/d1 ;   d1 = (M+1) f .

ExampleSuppose you are testing a 200 mm telephoto lens. With the 5 mm targets the nominal magnification (the magnification where the lp/mm scale reads correctly) is 50. The lens-to-target distance is d1 =(M+1) f = 51*200 mm = 10.2 meters = 401.6 inches = 33.46 feet. That's quite large— impractical for most indoor locations. (Don't even think of using a 2.5 mm target, which has M = 100, for long lenses.) You may want to use half the nominal magnification for this target: M = 25. If you do this the actual lp/mm reading will be half the reading on the chart, i.e., the maximum lp/mm becomes 100 instead of 200. That's sufficient in most realistic cases. d1 =(M+1) f = 26*200 mm = 5.2 meters = 204.7 inches = 17.06 feet. Better.
.
Other distances and magnifications  You may not know the precise focal length of the lens (zooms are often poorly marked), or you may find distance d1 to be inconvenient, especially for long lenses (large f ). You may want to use a magnification Mactual lower than the nominal magnification M (50 or 100), for example, Mactual = M/2.  In these cases you can apply a correction factor to the lp/mm spatial frequency. This isn't difficult in practice, particularly for digital cameras or scanned images, where you should know the pixel spacing. The key is to measure a length on the film or digital sensor and compare it with a specified length. The actual lp/mm is

lp/mm (actual) = (lp/mm on chart) * (specified length) / (measured length)

Length can refer to the chart or the entire target. If you are working with a digitized image, measured chart length is easy to find: it's the pixel spacing times the chart length in pixels. Specified chart length (2.5 or 5 mm) is given in the above table. For example, suppose the measured chart length for a 5 mm chart is 7.7 mm. The actual lp/mm would be 5/7.7 = 0.649 times the lp/mm indicated on the chart.

You can also use the scale on the target. If you place "0" at the center of the image, measured length is the value of the scale at the edge of the image. Specified length is half the width of the image sensor or frame, for example, 11.35 mm for the 22.7x15.1 mm sensor of the Canon EOS-10D or 18 mm for a 36x24mm frame on 35mm film.

Note that with Imatest Log frequency, distance is not critical because spatial frequencies are automatically detected.

Photographing the target

Now you are ready to photograph the target. A few tips:  

Interpreting the results

You can evaluate the results by observing film visually or scanning it (more accurate, but spatial frequencies will be limited by the scanner). Skip to Interpreting digitized results if you are using a digital image.

What to look for

Here is an example of how to use the chart— not a real lens test. The chart on the right has been softened using gaussian blur. Look for the frequency where the sine pattern contrast is similar to the contrast of the 50% or 10% contrast reference bands (2 and 5, above). The illustration on the right includes portions of the pattern and the 10% contrast band. The 10% MTF frequency is approximately 150 lp/mm. It is difficult to estimate this frequency with accuracy better than about ±15% because MTF rolls off slowly for gaussian blur.

MTF rolls off more rapidly for actual lenses; hence a better estimate of the 10% (and 50%) MTF frequency should be possible.

Whichever approach you choose, you'll want to compare the primary sine pattern, band 1 or 4, with the 50% and 10% contrast reference bands, 2 and 5, to determine the spatial frequency (lp/mm) for the corresponding MTF.

Remember that a number of factors can degrade the results: poor film flatness, camera shake, sloppy film development and focus error among them. When I obtained my Hasselblad 500C, the ground glass focusing screen was out of adjustment. I had to adjust it a jeweler's screwdriver using an image at infinity. Remember also that sharpness may be dominated by the film. According to Zeiss (Camera Lens News No. 10 article on film flatness), "more than 99% of all customer complaints about lacking sharpness in their photos can be attributed to misalignments of critical components in camera, viewfinder, or magazine, focus errors, camera shake and vibrations, film curvature, and other reasons."

You'll want to compare your test results with calculated results in Parts 1 and 2. Don't expect grandiose numbers, over 100 lp/mm. For Fujichrome Velvia with an excellent lens, the 50% and 10% MTF frequencies (f50 and f10) are 37 and 67 lp/mm— limited mostly by the film. 4000 dpi scanning drops these numbers 10 to 15%, but you can recover a lot— actually achieve better  f50 than the unscanned image— by sharpening. You'll learn to appreciate careful technique. Images that actually achieve this sharpness can be quite impressive: I've frequently fooled people into thinking I was using the next larger format.

Interpreting digitized results with ImageJ and PixelProfile

See www.imatest.com  for a more acccurate and convenient approach to testing sharpness in digital cameras and digitized film images.
Imatest: affordable software for measuring sharpness and image quality

Although the most accurate and convenient way to analyze digitized images is with Imatest Log frequency, there are some free alternatives.

ImageJ is a standalone public domain image analysis program, written in Java. You can learn about ImageJ in the Documentation (the Plot Profile command is of particular interest), and download the appropriate version (Macintosh, Windows, Linux, etc.) by clicking here. Installation is utter simplicity— just unzip the file and copy the ImageJ shortcut to a convenient location. Double-click (in Windows) to run. The screen on the right comes up.

Open the scanned or digital camera image, with File, Open. Select the line tool (shown) and use the mouse to draw a line along the portion of the image you wish to analyze. You should know the spatial frequency at the start and end of the line. Here is an example, using a cropped image— cropping is preferable but not necessary. You can draw the line wherever you like. Note that the spatial frequency increases logarithmically (2 to 200 lp/mm (or other arbitrary units) in this illustration).


5 mm chart on the Canon EOS-10D, 24-85mm f/3.5-4.5 (consumer grade) lens, center, f/11,
50mm focal length. RAW format with default sharpening. JPEG is high quality to minimize artifacts.
Sharpening artifacts (halos near edges) are visible.
Sensor size is 22.7x15.1 mm. Pixel spacing is 0.0074 mm.

After you've drawn the line, click on Analyze, Set Scale... The nonzero Distance in Pixels: (length) of the line should be shown. Set Known Distance: to 1 (or 100 if you like percent) or to a known length (I chose 5 mm for the target). Unit of Length: can be anything as long as it's not blank. Click OK. Then click Analyze, Plot Profile. The window below appears. Pretty cool.


Sine wave response for above chart
.
Spatial frequency vs. normalized distance
for 2-200 lp/mm charts
.
X and Y (to the right of the Copy... button) give the position of the cursor as you move it over the ImageJ window (the cursor itself is not shown). X is in units of Distance; Y is in pixels (0-255). With a little math (easiest if Known Distance is 1), you can use the normalized cursor X-position (X* = X/Xmax = 2.86/5 = 0.572, above), to find the corresponding spatial frequency. You can use the chart on the right, but it isn't as accurate.

On my charts, frequency increases logarithmically. Let f1 be the lowest spatial frequency, on the left of the chart, corresponding to X* = X/Xmax = 0. Let f2 be the highest spatial frequency, on the right of the chart, corresponding to X* = 1. The spatial frequency f at X* is,

f = f1 ( f2 / f1 )X*Using ax = exp(x ln(a)), we calculate the inverse,
X* = ln( f / f1 ) / ln( f2 / f1 )
In this example, the approximate 50% MTF frequency corresponds to the vertical yellow line (which I added in ImageJ) at X* = 0.572. This is a rough guess— perhaps high— because of gamma and dot gain distortion. For  f1 = 2 lp/mm and  f2 = 200 lp/mm,  f50 = 2(100)0.572 = 27.9 lp/mm. The approximate 10% MTF is approximately X = 3.50; X* = 0.7.  f10= 2(100)0.70 = 50.2 lp/mm. (For reference, the Nyquist frequency for the EOS-10D is 67.6 lp/mm.) This is close to the estimates from DPreview.com's EOS-D60 review (which used the superb 50mm f/1.4 stopped down to f/9). The 10% MTF scale number, which is close to the absolute cutoff, is about 17. Using the technique described elsewhere, this is 17*50/15.1 = 56 lp/mm. List shows the values of the plot and Save saves an ASCII file with (point  value) on each line. This file can be used by separate programs such as Excel for further analysis.

PixelProfile is another simple program that can generate a plot of pixel values along a line. It's simpler to use and less versatile than ImageJ. It also outputs data points in Excel format. You can choose between plots of R, G, B, H, S, V, or Intensity. Image size is limited to 640x480 pixels. (Thanks to Chuck Varney, I discovered it in late March 2003.) I'm also exploring Dataplot, a free public domain scientific/visualization software package from NIST, and GNU Octave, both of which could be useful for analysis.

The PixelProfile plot is nice because it has grid lines, which make it easier to interpret the data. Because of the 640 pixel horizontal limit it doesn't plot the entire chart, but it goes far enough in this case. The X-scale is in pixels. To calculate spatial frequency f from the above equation, you'll need to calculate X* = X/Xmax, where Xmax is the length of the pattern in pixels. The best way to find Xmax is with an external editor. Xmax = 682 pixels for this chart.

Pixel Profile charts (cropped) for the Canon EOS-10D (same image as above):
Sine pattern (left), bar pattern (right). There is clear evidence of sharpening.

Finding MTF quantitatively

To determine MTF quantitatively, find following values.
 
V The average luminance for black areas— at low spatial frequencies.
V The average luminance for white areas— at low spatial frequencies.
Vmin  The minimum luminance for a pattern near a given frequency or scale value (a "valley" or "negative peak").
Vmax  The maximum luminance for a pattern near a given frequency or scale value (a "peak").

Use the following equations to find MTF.
 

C(0) = (VW-VB)/(VW+VB) is the low frequency (black-white) contrast.
C(f) = (Vmax-Vmin)/(Vmax+Vmin) is the contrast at spatial frequency f. Normalizing contrast in this way— dividing by Vmax+Vmin (VW+VB at low spatial frequencies)— minimizes errors due to nonlinearities in acquiring the pattern.
MTF(f) = 100%*C(f)/C(0),  for the sine pattern. Valid at all frequencies.
MTF(f) ~= 78.5%*C(f)/C(0),  for the bar pattern, valid where C(f) < 0.7*C(0)  The 78.5% factor is explained in the box below.

Example: Use the above PixelProfile plot to find MTF at 40 lp/mm (a spatial frequency often used in lens test charts). X* = ln(40/2)/ln(200/2) = 0.650. Since Xmax = 682 pixels, X = X* Xmax = 444 pixels. At this frequency, the envelope average is Vmin = 112 and Vmax =  198. C(40 lp/mm) = (198-112)/(198+112) = 0.277. At low frequencies, VB = 4 and VW = 234. C(0) = (234-4)/(234+4) = 0.966. MTF(40 lp/mm) = 0.410/0.966 = 0.287 = 28.7%. The excellent lens (the Canon 28-70 f/2.8 L) has MTF of about 70% at this frequency at the center. The 24-85 consumer zoom is quite good at f/5.6-f/11, but probably not quite as good as the 28-70 L. The remainder of the MTF loss is due to the sensor. The hand method is tedious and not as accurate as I'd like. So I developed something better.

sfrcalc .A Matlab program for calculating spatial frequency response (equivalent to MTF)


Thanks to Chuck Varney for prodding me into this.
.
I wrote sfrcalc, in Matlab, which is required to run it. I used Matlab because it's familiar. Ideally I'd like to make it standalone— perhaps as an ImageJ plugin, but the learning curve looks pretty serious. If anyone wants to try, the math is pretty simple. I use the equation for MTF(f) above. Most of the code is for the output. You can download sfrcalc by right-clicking here.

Sfrcalc displays spatial frequency response (SFR), which is essentially the same thing as MTF. SFR usually refers to a complete photographic system while MTF refers to individual components. I often use them interchangeably.

To run sfrcalc,

  • Run ImageJ, as indicated above. The only difference from the above example is that I drew the line on the sine pattern from 2 to 80 lp/mm to avoid wasting space in the plot— there is little output above 60 lp/mm.
  • Save the result of the analysis by clicking on the Save... button in the profile plot. The .txt file name should have no blanks— they would confuse the Matlab command.
  • Run Matlab with the following command line:

  • sfrcalc file.txt s1 s2 ph
         —where—
    file.txt is the input file name.
    s1 is the minimum scale value in lp/mm.
    s2 is the maximum scale value in lp/mm.
    ph is the picture height in mm (15.1 for the 10D, 24 for 35mm).
    Example: sfrcalc EOS2485.dat 2 80 15.1
The results of running sfrcalc are shown on the right for the EOS-10D with the 24-85 mm f/3.5-4.5 lens at 48 mm, f/11, using the same image as above. Output is divided into three sections. Top: a narrow strip illustrating the line image chosen for analysis. Middle: the pixel values of the line image— the same profile plot displayed by ImageJ. Bottom: the Spatial frequency response (SFR) plot. The x-axis is linear because my version of Matlab has a problem displaying logarithmic grid lines. It looks OK. Curiously, the MTF rolloff is close to linear.

The little bumps on the SFR plots aren't real. They're the result of sampling phase errors (significant in the 10D), grain (or noise; very low in the 10D), and imprefections in the printed chart. They aren't systematic— they average out. The true MTF would be a line that smooths them.

The upper SFR plot uses Line pairs per mm (lp/mm) on the horizontal axis. The lower SFR plot (with the top part cropped out) uses Line widths per picture height (lw/ph, where there are 2 line widths per line pair). This plot is valuable for comparing cameras with different formats (i.e., digital vs. 35mm), but with similar aspect ratios. See my EOS-10D page. For this lens, which I characterize as "pretty good" (it's not an L-series lens), the 50% MTF frequency (f50, closely related to perceived image sharpness) is about 22 lp/mm, or 700 lw/ph. The 10% MTF frequency (f10; closely related to traditional resolution measurements) is 49 lp/mm, or 1500 lw/ph. Note that 1000 lw/ph is equivalent to 10 on the Dpreview.com charts.
.

Approximating MTF from bar patterns
(the pi/4 discrepancy)

MTF is based on sine wave response, but we often work with bar charts. The contrast ratio obtained directly from a bar chart is called the contrast transfer function, CTF( f ) = 100% * C( f ) / C(0). CTF is rarely referred to in the literature. It is not the same as MTF.

A portion of a bar chart can be approximated by a periodic function called a square wave, illustrated above for period 2L (frequency = f = 1/2L). Fourier transform mathematics teaches us that any periodic function can be expressed as an infinite sum of sine functions, starting with the fundamental, sin(pi*x/L) = sin(2*pi*f ), and including harmonics, sin(n*pi*x/L) = sin(2*n*pi*f ) for n = 2, 3, 4, ... The equation for the square wave is shown above. It only has odd harmonics (n = 3, 5, 7,...). The amplitude of the fundamental frequency of the bar pattern is 4/pi = 1.273 times the amplitude of the bar pattern itself. To obtain MTF from CTF you must multiply by a factor of pi/4, hence,

MTF( f ) = 0.785*CTF ~= 78.5%*C(f)/C(0),  where C(f) < 0.7*C(0)
This equation is only accurate at relatively high frequencies where response is dropping— where the harmonics are strongly attenuated. These are the frequencies of interest.

The exact equation for relating MTF( f ) to CTF( f ) was given by Coltman (1954):
MTF( f ) = pi/4 * [CTF( f ) + CTF(3f )/3 - CTF(5f )/5 + CTF(7f )/7 ...]
The signs in this equation beyond n  = 7 are quite irregular. This equation is rarely of practical interest— pure geek stuff. I owe thanks to Chuck Varney for straightening me out on these issues.




Images and text copyright © 2000-2014 by Norman Koren.
Norman Koren lives in Boulder, Colorado, founded Imatest LLC in 2004, previously worked on magnetic recording technology. He has been involved with photography since 1964.