Measure spatial frequency response using Imatest® eSFR chart
sharpnessTable = measureSharpness(chart)
sharpnessTable = measureSharpness(chart,Name,Value)
[sharpnessTable,aggregateSharpnessTable] = measureSharpness(___)
Read an image of an eSFR chart into the workspace.
I = imread('eSFRTestImage.jpg');
esfrChart object, then display the chart with ROI annotations. The 60 slanted edge ROIs are labeled with green numbers.
chart = esfrChart(I); displayChart(chart,'displayColorROIs',false,... 'displayGrayROIs',false,'displayRegistrationPoints',false)
Measure the edge sharpness in ROIs 25-28, and return the measurements in
sharpnessTable. Include measurements of the MTF70 and MTF30 by specifying the
'percentResponse' name-value pair argument.
sharpnessTable = measureSharpness(chart,'ROIIndex',25:28,'PercentResponse',[70 30])
sharpnessTable=4×9 table ROI slopeAngle confidenceFlag SFR comment MTF70 MTF70P MTF30 MTF30P ___ __________ ______________ ____________ _______ ____________________________________________ ____________________________________________ ________________________________________ ________________________________________ 25 4.2391 true [88x5 table]  0.060224 0.058884 0.051757 0.058482 0.060224 0.058884 0.051757 0.058482 0.10732 0.11267 0.11185 0.11178 0.10732 0.11267 0.11185 0.11178 26 5.0254 true [88x5 table]  0.18561 0.18597 0.18667 0.18597 0.18561 0.18597 0.18667 0.18597 0.26028 0.26236 0.26224 0.26241 0.26028 0.26236 0.26224 0.26241 27 4.7131 true [88x5 table]  0.070042 0.069599 0.066239 0.06951 0.070042 0.069599 0.066239 0.06951 0.2169 0.21863 0.22086 0.21904 0.2169 0.21863 0.22086 0.21904 28 4.8996 true [88x5 table]  0.19485 0.20418 0.19669 0.20168 0.19485 0.20418 0.19658 0.20168 0.26447 0.27531 0.26004 0.27188 0.26447 0.27531 0.25998 0.27188
Select the fourth row in the sharpness table, which corresponds to ROI 28. Display the SFR plot of the ROI.
idx = 4; plotSFR(sharpnessTable(idx,:))
Print the MTF70 and MTF30 measurements of the ROI. Compare the measurements against the plot.
The MTF70 measurement of the red and blue color channels are slightly smaller than 0.2, while the MTF70 measurement of the green and luminance channels are slightly larger than 0.2. These measurements agree with a visual inspection of the SFR plot, on which an SFR value of 0.7 occurs at spatial frequencies around 0.2 line pairs per pixel.
mtf70 = sharpnessTable.MTF70(idx,:)
mtf70 = 1×4 0.1949 0.2042 0.1967 0.2017
The MTF30 measurement of the blue color channel is noticeably smaller than the MTF30 measurement of the other color channels. This measurement agrees with a visual inspection of the SFR plot, on which the SFR curve of the blue channel drops off more quickly than the other channels.
mtf30 = sharpnessTable.MTF30(idx,:)
mtf30 = 1×4 0.2645 0.2753 0.2600 0.2719
comma-separated pairs of
the argument name and
Value is the corresponding value.
Name must appear inside quotes. You can specify several name and value
pair arguments in any order as
measureSharpness(myChart,'ROIIndex',2)measures the sharpness only of ROI 2.
'PercentResponse'— Value of frequency response
50(default) | scalar | vector
Value of frequency response at which to report the corresponding
spatial frequency, specified as the comma-separated pair consisting of
'PercentResponse' and a scalar or vector of
integers in the range [1, 100].
Each value of
PercentResponse adds two columns to
aggregateSharpnessTable output arguments. The
columns indicate the frequency at which the SFR drops to the specified
percent of the initial and peak values. For example, when
PercentResponse has the value 50, both output
tables have the columns
MTF50P. These columns indicate the frequency at
which the SFR drops to 50% of the initial value and peak value,
sharpnessTable— SFR measurements of edge
SFR measurements of edge, returned as an
m-by-n table. m
is the number of sampled ROIs. n changes values depending
PercentResponse. The first five columns are always
present and represent these variables:
|Index of the sampled ROI. The value of
|Angle between the slanted edge and pure vertical or
horizontal, depending on the ROI orientation. The angle
is measured in degrees, and it is returned as a scalar
of type |
Boolean flag that indicates whether the sharpness
measurement is reliable.
The contrast of a slanted edge
ROI is defined as
Spatial frequency response of the edge in the ROI.
Luminance (Y) is a linear combination of the red (R), green (G), and blue (B) channels according to:
Y = 0.213R + 0.715G + 0.072B
Each value of
PercentResponse adds two
columns that indicate the frequency at which the SFR drops to the specified
percent of the initial and peak value. The format of each entry in the
column is a 1-by-4 vector. The four elements correspond to the red, green,
blue, and luminance channels, respectively.
aggregateSharpnessTable— Average SFR measurements of vertical and horizontal edges
Average SFR measurements of vertical and horizontal edges, returned as a
table with one or two rows.
one row when all sampled ROIs have the same orientation. It has two rows
when the sampled ROIs have mixed orientation.
aggregateSharpnessTable has three fewer columns than
The first two columns of
always present and represent these variables:
|Orientation of the averaged SFRs. The value of
Averaged spatial frequency response of all edges
in included ROIs with the orientation specified by
Luminance (Y) is computed as a linear combination of the red (R), green (G), and blue (B) channels according to:
Y = 0.213R + 0.715G + 0.072B
Each value of
PercentResponse adds two columns that
indicate the frequency at which the SFR drops to the specified percent of
the initial and peak value. The format of each entry in the column is a
1-by-4 vector. The four elements correspond to the red, green, blue, and
luminance channels, averaged among all sampled ROIs with the same
Slanted edges on a properly oriented chart are at an angle of 5 degrees from the horizontal or vertical. Sharpness measurements are not accurate when the edge orientation deviates significantly from 5 degrees.
Sharpness is higher toward the center of the imaged region and decreases toward the periphery. Horizontal sharpness is usually higher than vertical sharpness.
The SFR measurement algorithm is based on work by Peter Burns 
measureSharpness determines the edge position with sub-pixel
resolution for each scan line, or row or column of pixels
perpendicular to the edge, in the ROI. For example, each row of pixels is a scan line
for a near-vertical edge. Next,
measureSharpness aligns and averages
the scan lines to create an oversampled edge intensity profile. The function takes the
derivative of the intensity profile and applies a windowing function. The returned SFR
measurement is the absolute value of the Fourier transform of the windowed
 Burns, Peter. "Slanted-Edge MTF for Digital Camera and Scanner Analysis." Society for Imaging Science and Technology; Proceedings of the Image Processing, Image Quality, Image Capture Systems Conference. Portland, Oregon, March 2000. pp 135–138.
 Burns, Peter. "sfrmat3: SFR evaluation for digital cameras and scanners." URL: http://losburns.com/imaging/software/SFRedge/sfrmat3_post/index.html.