File Exchange

image thumbnail


version (427 KB) by David Haefner
Calculate the MTF from a tilted edge or tilted slit


Updated 27 Apr 2018

View Version History

View License

MTFdh is a series of Matlab functions used for the calculation of the Modulation Transfer Function (MTF). The theory behind these functions is described in 2018 SPIE proceeding 10625-5 and forms the basis behind NVLabCap’s MTF imaging evaluation software.
Some example images and a few example calling scrips are also provided:
1. AngleVariation.m : examples of how MTFdh behaves with angle
2. NoiseTest.m : demonstration of confidence interval predictions for MTF
3. ColorImageExample.m : Through-the-Bayer pattern MTF, showing how defective pixels are used
4. LoadExampleMTF2dDataSet.m : Load and calculate data from 2018 SPIE proceeding 10625-20

Cite As

David Haefner (2021). MTFdh (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (6)

David Haefner

Thank you for going through the code with such detail. I will address the error mentioned by your first comment and reupload soon. The reprojection methods I use was just resampling with a specified interpolation kernel. I did not find that one kernel provided the least interpolation errors for all situations, so I left the kernel selection as an input. I typically look at the resampled ESF for interpolation errors. Wikipedia discusses the Lanczos resampling with decent deail: (

I apologize the codes sequence is not as obvious as I had hoped. I have other publications that may provide additional context:
“Best Practices for Imaging System MTF Measurement,” Electron. Imaging, vol. 2019, no. 10, pp. 319-1-319–6, 2019.
"MTF measurements, identifying bias, and estimating uncertainty", Proceedings of SPIE Vol. 10625, 1062506 (2018)
Full system measurements:
"Evaluating the performance of reflective band imaging systems: a tutorial", Proceedings of SPIE Vol. 11001, 1100103(2019)
"Evaluating the performance of an IR imaging system: a tutorial", Proceedings of SPIE Vol. 10625, 106250K (2018)

feel free to reach out for any additional questions or concerns

Konstantin Kudinov

great work! one of the most complete MTF data processing pipelines I've seen so far.
Few comments:
1. Seems like in the function FindEdgeDH(Im,ESFFitMethod,Dead,SlitFlag,SaveMTF,WBcoeff)
line 208-210 should be corrected as follows (transposing polyval result before making subtraction)

208 if SlitFlag==1
209 y=y-polyval(polyfit(x,y,1),x)';
210 end

2. Do you by chance have any notes on the actual reprojection algorithm and the pipeline in general. I'd like to go through the details of your code, and sometimes it is very difficult to understand what are exact operations are happening. I've read the SPIE publication you refer, but there are no details about the code.

David Haefner

@jeonghoon-hyun, I apologize for the confusion. The first popup allows for contrast adjustment, when satisfied, close the adjust contrast (Figure 121212) tool. After this, a region of interest (imrect) box will appear, when you are satisfied with the location, double click on the boundaries of the box. Let me know if you any other questions or issues

Jeonghoon Hyun

@David Haefner, when I run 'SelectROI_CalcMTF.m' and just close two figures w/o any adjustment, there is an error 'numel(pos1)=0'. Should I take some actions when figures are popped up?

David Haefner

@ xie sivan, thank you for your comment, I have corrected the issue

xie sivan

Hi, when I run NoiseTest.m,there are errors 'in line 142 there is no LBobs ' and ' in line 143 there is no UBobs '

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: IR Noise Evaluation

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!