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. Linearize the image.
I = imread('eSFRTestImage.jpg'); I_lin = rgb2lin(I);
esfrChart object using the linearized chart image, then display the chart with ROI annotations. The 60 slanted edge ROIs are labeled with green numbers.
chart = esfrChart(I_lin); displayChart(chart,'displayColorROIs',false,... 'displayGrayROIs',false,'displayRegistrationPoints',false)
Measure the edge sharpness in ROIs 25-28, and return the measurement in
sharpnessTable = measureSharpness(chart,'ROIIndex',25:28,'PercentResponse',[60 20])
sharpnessTable=4x9 table ROI slopeAngle confidenceFlag SFR comment MTF60 MTF60P MTF20 MTF20P ___ __________ ______________ ____________ _______ ____________________________________________ ____________________________________________ ________________________________________ ________________________________________ 25 4.2353 true [88x5 table]  0.080586 0.084315 0.073215 0.083181 0.080586 0.084315 0.073215 0.083181 0.27917 0.26978 0.26086 0.28095 0.27917 0.26978 0.26086 0.28095 26 4.9905 true [88x5 table]  0.20879 0.207 0.20591 0.20952 0.20879 0.207 0.20591 0.20952 0.32941 0.32327 0.30475 0.32596 0.32941 0.32327 0.30475 0.32596 27 4.6696 true [88x5 table]  0.081098 0.078266 0.080847 0.078953 0.081098 0.078266 0.080847 0.078953 0.22223 0.22371 0.22517 0.22358 0.22223 0.22371 0.22517 0.22358 28 4.9859 true [88x5 table]  0.24123 0.2447 0.24137 0.24426 0.24123 0.24411 0.23807 0.24391 0.34031 0.34642 0.33149 0.34381 0.34031 0.34594 0.32987 0.34351
Examine the SFR measurements in one ROI. First, display the SFR plot of the ROI.
Print the MTF60 and MTF20 measurements of the ROI. Compare the measurements against the plot.
mtf60_roi26 = sharpnessTable.MTF60(2,:)
mtf60_roi26 = 0.2088 0.2070 0.2059 0.2095
The MTF60 measurement of each color channel is slightly larger than 0.2. This measurement agrees with a visual inspection of the SFR plot, on which an SFR value of 0.6 occurs at a spatial frequency slightly larger than 0.2 line pairs per pixel.
mtf20_roi26 = sharpnessTable.MTF20(2,:)
mtf20_roi26 = 0.3294 0.3233 0.3048 0.3260
The MTF20 measurement of the blue color channel is noticeably smaller than the MTF20 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.
comma-separated pairs of
the argument name and
Value is the corresponding value.
Name must appear inside single 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.
Perform sharpness measurements on linearized data. Use
rgb2lin to linearize sRGB images.
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.