Contenido principal

frequencyAtContrast

R2026b

Compute spatial frequency at MTF contrast level

Since R2026b

Description

Add-On Required: This feature requires the Optical Design and Simulation Library for Image Processing Toolbox add-on.

frequency = frequencyAtContrast(mtfr,thresholds) returns the spatial frequency at which the modulation transfer function (MTF) first drops to each contrast threshold in thresholds. The function returns sagittal and tangential frequencies for each MTF object, wavelength, and threshold.

example

Examples

collapse all

Load the sample Double Gauss lens system using zmximport. Compute the geometric MTF up to a maximum spatial frequency of 200 cycles per millimeter by setting the MaximumFrequency name-value argument.

opsys = zmximport("DoubleGaussLens.zmx");
mtfr = mtf(opsys, MaximumFrequency=200);

Use the frequencyAtContrast function to compute MTF50, the spatial frequency where the MTF first drops to 50% contrast. Then, use the contrastAtFrequency function to determine the exact sagittal and tangential contrast values at spatial frequencies of 30, 60, and 100 cycles per millimeter.

By default, these functions evaluate the entire optical system simultaneously and return multi-dimensional arrays. The dimensions map to [Fields, Wavelengths, Configurations, Planes] for the MTF50 output, and [Fields, Wavelengths, Frequencies, Planes] for the contrast output, where the rows represent field points and the columns represent wavelengths.

MTF50 = frequencyAtContrast(mtfr, 0.5)
MTF50 = 
MTF50(:,:,1,1) =

   22.2302   48.5808   37.1994
   30.4516   44.1749   35.1107
   26.2930   20.7316   19.6589


MTF50(:,:,1,2) =

   22.2300   48.5906   37.2039
   31.2080   43.8519   27.4440
   52.5096   33.6761   18.1949

contrast = contrastAtFrequency(mtfr, [30; 60; 100])
contrast = 
contrast(:,:,1,1) =

    0.4014    0.7605    0.6261
    0.5084    0.6298    0.5519
    0.4752    0.3834    0.3539


contrast(:,:,2,1) =

    0.2572    0.3637    0.2569
    0.1174    0.3793    0.2909
    0.3216    0.2569    0.2353


contrast(:,:,3,1) =

    0.1793    0.0742    0.2620
    0.0475    0.1648    0.0820
    0.2108    0.1898    0.1699


contrast(:,:,1,2) =

    0.4014    0.7606    0.6262
    0.5081    0.6205    0.4417
    0.7480    0.5750    0.3493


contrast(:,:,2,2) =

    0.2572    0.3639    0.2569
    0.2959    0.3558    0.1313
    0.4327    0.2412    0.2650


contrast(:,:,3,2) =

    0.1793    0.0742    0.2618
    0.0944    0.1362    0.1943
    0.0866    0.2809    0.2394

Input Arguments

collapse all

Modulation transfer function results, specified as a GeometricMTF object, a HuygensMTF object, or an array of MTF result objects. Create these objects by using the mtf object function.

When you specify an array of MTF result objects, all objects in the array must use the same wavelengths.

MTF contrast thresholds, specified as a real scalar or row vector of real values in the range [0, 1]. For example, specify 0.5 to compute the MTF50 spatial frequency.

Data Types: double

Output Arguments

collapse all

Spatial frequencies at specified contrast thresholds, returned as an N-by-M-by-K-by-2 numeric array. N is the number of MTF objects in mtfr, M is the number of wavelengths, K is the number of thresholds in thresholds, and the fourth dimension stores the sagittal and tangential directions. Units are in cycles per millimeter.

The first page in the fourth dimension, frequency(:,:,:,1), contains sagittal spatial frequencies. The second page, frequency(:,:,:,2), contains tangential spatial frequencies.

If an MTF curve does not cross a requested threshold within the stored frequency range, the corresponding frequency value is NaN. If an MTF object contains empty MTF data, the corresponding frequency values are NaN.

Data Types: double

Version History

Introduced in R2026b