Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

measureSharpness

Measure spatial frequency response using Imatest® eSFR chart

Syntax

sharpnessTable = measureSharpness(chart)
sharpnessTable = measureSharpness(chart,Name,Value)
[sharpnessTable,aggregateSharpnessTable] = measureSharpness(___)

Description

sharpnessTable = measureSharpness(chart) measures the spatial frequency response (SFR) at all slanted edge regions of interest (ROIs) of an Imatest® eSFR chart. sharpnessTable includes the frequency for each ROI at which the response drops to 50% of the intitial and peak values.

example

sharpnessTable = measureSharpness(chart,Name,Value) measures the SFR at all specified slanted edge ROIs, specifying additional parameters.

[sharpnessTable,aggregateSharpnessTable] = measureSharpness(___) also returns the average SFR of vertical and horizontal ROIs, using the input arguments of either of the previous syntaxes.

Examples

collapse all

Read an image of an eSFR chart into the workspace. Linearize the image.

I = imread('eSFRTestImage.jpg');
I_lin = rgb2lin(I);

Create an 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.

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.

plotSFR(sharpnessTable,'ROIIndex',26)

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.

Input Arguments

collapse all

eSFR chart, specified as an esfrChart object.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is 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 Name1,Value1,...,NameN,ValueN.

Example: measureSharpness(myChart,'ROIIndex',2) measures the sharpness only of ROI 2.

collapse all

ROI indices to include in measurements, specified as the comma-separated pair consisting of 'ROIIndex' and a scalar or vector of integers in the range [1, 60]. The indices match the ROI numbers displayed by displayChart.

Note

measureSharpness uses the intersection of ROIs specified by 'ROIIndex' and 'ROIOrientation'.

Example: 29:32

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32

ROI orientation, specified as the comma-separated pair consisting of 'ROIOrientation' and 'both', 'vertical', or 'horizontal'. The measureSharpness function performs measurements only on ROIs with the specified orientation.

Note

measureSharpness uses the intersection of ROIs specified by 'ROIIndex' and 'ROIOrientation'.

Example: 'vertical'

Data Types: char | string

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 the sharpnessTable and 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 MTF50 and MTF50P. These columns indicate the frequency at which the SFR drops to 50% of the initial value and peak value, respectively.

Example: 30

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | char | string

Output Arguments

collapse all

SFR measurements of edge, returned as an m-by-n table. m is the number of sampled ROIs. n changes values depending on PercentResponse. The first five columns are always present and represent these variables:

VariableDescription
ROIIndex of the sampled ROI. The value of ROI is an integer in the range [1, 60].
slopeAngleAngle 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 double.
confidenceFlag

Boolean flag that indicates whether the sharpness measurement is reliable. confidenceFlag is true when the measurement is reliable. confidenceFlag is false when the measurement is unreliable due to the following conditions:

  • slopeAngle is less than 3.5 degrees or more than 15 degrees.

  • The contrast within the ROI is less than 20%.

The contrast of a slanted edge ROI is defined as 100 * (IHigh - ILow)/(IHigh + ILow), where IHigh and ILow are the estimated average intensities of the high and low intensity regions across the edge. The contrast is computed for only the red channel.

SFR

Spatial frequency response of the edge in the ROI. SFR is an f-by-5 table. The five columns represent the frequency value and the red, green, blue, and luminance values corresponding to that frequency. f is the number of frequency samples of the MTF.

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

commentWhen confidenceFlag is false, then comment describes the reason the measurement is unreliable. When confidenceFlag is true, then comment is the empty vector, [].

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.

Average SFR measurements of vertical and horizontal edges, returned as a table with one or two rows. aggregateSharpnessTable has 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 sharpnessTable.

The first two columns of aggregateSharpnessTable are always present and represent these variables:

VariableDescription
OrientationOrientation of the averaged SFRs. The value of Orientation is either 'horizontal' or 'vertical'.
SFR

Averaged spatial frequency response of all edges in included ROIs with the orientation specified by Orientation.

SFR is an s-by-5 table. The five columns represent the frequency value, and the averaged red, green, blue, and luminance values corresponding to that frequency. s is the number of frequency samples of the MTF.

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 orientation.

Tips

  • 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.

Algorithms

The SFR measurement algorithm is based on work by Peter Burns [1] [2]. First, 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 derivative.

References

[1] 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.

[2] Burns, Peter. "sfrmat3: SFR evaluation for digital cameras and scanners." URL: http://losburns.com/imaging/software/SFRedge/sfrmat3_post/index.html.

Introduced in R2017b

Was this topic helpful?