contrastAtFrequency
R2026bDescription
Add-On Required: This feature requires the Optical Design and Simulation Library for Image Processing Toolbox add-on.
returns the modulation transfer function (MTF) contrast at each spatial frequency in
contrast = contrastAtFrequency(mtfr,frequencies)frequencies. The function returns sagittal and tangential contrast
values for each MTF object, wavelength, and requested frequency.
Examples
Load the sample Double Gauss lens system using zmximport. Compute the geometric MTF up to a maximum evaluation frequency of 200 cycles/mm to ensure the generated spatial curves safely enclose all test frequencies of interest.
opsys = zmximport("DoubleGaussLens.zmx");
mtfr = mtf(opsys, MaximumFrequency=200);Define a vector of spatial frequencies representing standard imaging performance checkpoints (e.g., 30, 60, and 100 cycles/mm). Query the exact contrast values preserved by the lens system at these boundaries using the contrastAtFrequency method.
frequencies = [30; 60; 100]; contrast = contrastAtFrequency(mtfr, frequencies)
contrast =
contrast(:,:,1,1) =
0.4013 0.7605 0.6261
0.5085 0.6298 0.5518
0.4754 0.3834 0.3537
contrast(:,:,2,1) =
0.2571 0.3638 0.2569
0.1174 0.3794 0.2909
0.3216 0.2569 0.2353
contrast(:,:,3,1) =
0.1791 0.0741 0.2619
0.0474 0.1648 0.0822
0.2109 0.1898 0.1700
contrast(:,:,1,2) =
0.4014 0.7606 0.6262
0.5081 0.6204 0.4416
0.7480 0.5750 0.3491
contrast(:,:,2,2) =
0.2571 0.3639 0.2569
0.2959 0.3558 0.1312
0.4328 0.2413 0.2649
contrast(:,:,3,2) =
0.1792 0.0741 0.2618
0.0945 0.1361 0.1943
0.0867 0.2809 0.2393
The resulting array contains multi-dimensional data spanning field points, wavelengths, frequencies, and orientations. To analyze orientation-dependent performance (such as astigmatism), slice the 4th dimension to isolate the sagittal and tangential contrast matrices.
sagittalContrast = contrast(:, :, :, 1)
sagittalContrast =
sagittalContrast(:,:,1) =
0.4013 0.7605 0.6261
0.5085 0.6298 0.5518
0.4754 0.3834 0.3537
sagittalContrast(:,:,2) =
0.2571 0.3638 0.2569
0.1174 0.3794 0.2909
0.3216 0.2569 0.2353
sagittalContrast(:,:,3) =
0.1791 0.0741 0.2619
0.0474 0.1648 0.0822
0.2109 0.1898 0.1700
tangentialContrast = contrast(:, :, :, 2)
tangentialContrast =
tangentialContrast(:,:,1) =
0.4014 0.7606 0.6262
0.5081 0.6204 0.4416
0.7480 0.5750 0.3491
tangentialContrast(:,:,2) =
0.2571 0.3639 0.2569
0.2959 0.3558 0.1312
0.4328 0.2413 0.2649
tangentialContrast(:,:,3) =
0.1792 0.0741 0.2618
0.0945 0.1361 0.1943
0.0867 0.2809 0.2393
Input Arguments
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.
Spatial frequencies at which to compute MTF contrast, specified as a finite, nonnegative real scalar or column vector of finite, nonnegative real values. Units are in cycles per millimeter.
Data Types: double
Output Arguments
MTF contrast values, 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 frequencies in
frequencies, and the fourth dimension stores the sagittal and
tangential directions.
The first page in the fourth dimension,
contrast(:,:,:,1), contains sagittal contrast values. The second
page, contrast(:,:,:,2), contains tangential contrast values.
Values are contrast fractions from 0 to 1. A value of 1 indicates full contrast transfer, and a value of 0 indicates no contrast transfer at the corresponding spatial frequency.
For requested frequencies above the maximum stored frequency in the MTF data, the
corresponding contrast value is 0. If an MTF object contains empty MTF data, the
corresponding contrast values are NaN.
Data Types: double
Version History
Introduced in R2026b
See Also
mtf | frequencyAtContrast | GeometricMTF | HuygensMTF | MTFChart | psf
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)