how to get MTF from PSF
Ältere Kommentare anzeigen
Hi guys,
Can you please tell me how can I get MTF from the PSF. PSF is the matrix of 400X400 taken from the camera. Please see attached mat file.
Thank you very much.
Antworten (4)
Bjorn Gustavsson
am 14 Mai 2020
The MTF is simply the absolute of the Fourier-transform of the PSF. That is:
MTF = abs(fftshift(fft2(psf)));
Just a couple of question. If you have the PSF why do you want the MTF? What are you going to use the MTF for that you couldn't do with the PSF?
HTH
2 Kommentare
Rik
am 14 Mai 2020
Comment posted as answer by Dimani4:
I know that, what about the matlab function of psf2otf (https://www.mathworks.com/help/images/ref/psf2otf.html)? I try to use this function (psf2otf) but what I get is the 2D intensity picture. I dont understand what that function means... MTF should be the graph normalized to 1 and the units should be 1/cm. Should I do profile to this picture? But the profile I get it in pixels units?
I just dont understand how can I approach to such a task...
Just a couple of question. If you have the PSF why do you want the MTF? What are you going to use the MTF for that you couldn't do with the PSF?
I'm just curious about what else I can learn about the point source.
Thank you.
Bjorn Gustavsson
am 14 Mai 2020
Yes, that OTF would be in 1/pixels units, it has to be since the function is goven no information about how large your PSF-image is in the real world. You'll have to convert to wave-numbers in 1/cm yorself, since you know about the image.
In my opinion they are nothing but a Fourier-pair, and I've nver been able to extract additional information from the OTF/MTF than from the PSF. When looking at my PSFs I typically plot row and column-cuts through the centre, I try to look at the PSF at different locations in the image - since the OTF-concept requires a shift-invariant PSF in the first place.
(Since I work with aberration-limited optical systems I cannot use OTF/MTF, and dislike them...)
My pleasure
Dimani4
am 14 Mai 2020
0 Stimmen
8 Kommentare
Bjorn Gustavsson
am 14 Mai 2020
You should simply use the example for time-frequency conversion from here (but adapt to change to spatial sampling-distance (pixel-size in m) to spatial sampling-frequency in 1/m): fft-documentation
HTH
Dimani4
am 15 Mai 2020
Bjorn Gustavsson
am 15 Mai 2020
No, (well I would to get away from the MTF and back to the PSF, but I've made my opinion on the MTF clear I think.) you should look at how to create the frequencies. This is one time-frequency example:
N = 256; % Length of time-series
delta_t = 0.1; % Samplin-rate seconds
delta_f = 1/(N*delta_t); % Frequency-spacing
f = (-fix(N/2):1:fix((N-1)/2))*delta_f; % Frequency-array
This should ensure that the DC-component end up at f==0 but that you better inspect!
You would have to modify this from time-frequency to wavenumber, by changing N to your image-size, delta_t, to your pixel-size, delta_f to dk and f to k. But then you would have an array for the wavenumbers of your MTF.
(But why not plot cuts through the PSF instead?)
HTH
Dimani4
am 15 Mai 2020
Bjorn Gustavsson
am 15 Mai 2020
Looks sensible. You could modify the plotting to use pcolor instead of surf, something like this would look OK:
subplot(3,3,[1 2 4 5])
pcolor(kx,ky,MTF),shading flat
subplo(3,3,[7 8])
plot(kx(:,1),MTF(201,:)), % maybe row-index should be 200?
subplot(3,3,[3 6])
plot(MTF(:,201),ky(:,1)) % same as above
I'd still prefer looking at the PSF:
[x,y] = meshgrid(1:400);
x = (x-mean(x(:)))*delta_pix;
y = (y-mean(y(:)))*delta_pix;
subplot(3,3,[1 2 4 5])
pcolor(x,y,psf),shading flat,
subplo(3,3,[7 8])
plot(x(:,1),psf(201,:)), % maybe row-index should be 200?
subplot(3,3,[3 6])
plot(psf(:,201),y(:,1)) % same as above
Dimani4
am 15 Mai 2020
Bjorn Gustavsson
am 15 Mai 2020
Glad to have helped. Hope you pay it on forwards.
Hi all,
i saw all your comments and thought that maybe you can help me too.
i have the 3D MTF as in the attached image.if i understand correctly its in [1/pixel] units .
i want to convert this 3D MTF to the common 2D MTF as in the image attached.
Does anybody knows how to do it?
thanks in advance

10 Kommentare
Bjorn Gustavsson
am 5 Nov. 2020
My advice is to stop faffing about with the MTF - work with the point-spread-function.
adi
am 5 Nov. 2020
its a part of a project in my masters degree..they asked to present the MTF, i have no choice ..
Bjorn Gustavsson
am 5 Nov. 2020
Then you first have to show that the point-spread-function is proprely shift-invariant (i.e. it is equal over the entire image area, once you've done that we can start to work, also ask your supervisor to contact me with an explanation of what it is going to be used for that doesn't implicitly contain a conversion back to a PSF or can be achived directly by using the PSF.)
Bjorn Gustavsson
am 6 Nov. 2020
Well just take a cut through the peak of that 2-D MTF (for that matter take both the row-wise and column-wise cuts), take that to your supervisors and ask them if that's what they want, and also ask them if they know for sure that their optical system gives a shift-invariant PSF.
ylcnt
am 14 Feb. 2021
Do you have any idea about how to get PSF from MTF. I have the MTF value as MTF=0.56, spatial cutoff frequency as 6.67x10^3 cycle/rad, and spatial frequency as 20.000 cycle/rad. How can I get PSF, then create a blurring filter and then apply the image?
Bjorn Gustavsson
am 15 Feb. 2021
@ylcnt: The psf-OTF (MTF is only the magnitude of the OTF) are a Fourier-transform pair. As far as I can judge you don't have enough information to sketch-up an MTF from your information. Therefore you cannot calculate a 2-D FT of something you dont know what it looks like. If it is something as simple as a "perfect" filter with that cut-off you'll get a product of sinc in the horizontal and vertical direction - which would be nonsense for an imaging system, or you get the corresponding for circular appertures.
ylcnt
am 16 Feb. 2021
Actually my MTF is not only the receiver optics MTF. I have MTF=MTFoptic*MTFatmosphere. My problem is I couldn't create a filter with h = fspecial('gaussian',hsize,sigma). What will be the sigma and its relation with sampling rate, cut-off frequency and MTF (It should be amplitude)? And then I think I need to use B = imfilter(A,h,options,...). But I couldn't relate them with MTF. Thank you.
Bjorn Gustavsson
am 17 Feb. 2021
If you have images of the night-sky you can simply fit a 2-D Gaussian to each (or as many you can muster) star in the image. Then you get the PSF from the avergage Gaussian - provided that your imaging system is shift-invariant.
onur cicek
am 5 Aug. 2021
Could you help me ? I have simple MTF and i want to get PSF from it .My is MTF DiffLim (2,1)= (2/pi)* (acos (FNo CenterWL Freq/1000)-((FNo CenterWL/1000) Freqsqrt (1-((FNo*CenterWL Freq)/1000)^2))) . Okey i need take ifft but i don't understand how can i get it in nanometer.
Anjan JB
am 30 Mai 2024
@adi did you get the answer of these questions, you asked ? i have the 3D MTF as in the attached image.if i understand correctly its in [1/pixel] units .
i want to convert this 3D MTF to the common 2D MTF as in the image attached.
Does anybody knows how to do it?
If yes please help me, I am also struggling to solve same problem.
Mustela
am 26 Aug. 2021
0 Stimmen
@Bjorn Gustavsson, you keep going on about favoring PSF analysis over MTF analysis. I'm really curious what your reasoning is. What exactly do you do with your PSFs? You can't get spatial frequency information (i.e. contrast vs freq.) by looking at slices of a PSF for example, hence the need for MTF analysis. You are clearly correct that analyzing the MTF from a single PSF of an optical system is only valid if the PSF is shift invariant (i.e. typically requires diffraction-limited over the FOV), but what's stopping me from analyzing the MTF at various field angles (which is one thing I do in my analyses), thus getting around the shift-invariance assumption?
1 Kommentar
Bjorn Gustavsson
am 26 Aug. 2021
@Mustela, yes I do rant on that. By looking at the PSF (or cuts through it) I can easily judge how small structures my imaging system can resolve and how large separations need to be, typically varying between different parts of my images. The images I analyse I never extract information of interest from certain Fourier-components, therefore it is more natural for me to think about how the PSF in a region blur an ideal image than look at how the contrast varies with spatial frequencies. What you mention as "contrast vs frequency" as something that cannot be achieved from the PSF I would instantly gather from the sum of PSFs from gradually separated pixels except this approach can be rigorously done without worries. When you look at the MTF for sub-regions of the image you would still make the assumption/approximation that the PSF is shift-invariant over that regionn (between you and me, I'd say that you implicitly admitt that it is not, and I'll have to admitt that it still most likely is a good enough assumption).
My main "attitude problem" might be that since I seek the information about object in the spatial domain it is more striahgt-forward to look at the PSF-blurring as a convolution-type operation than a multiplication in the Fourier-domain.
Kategorien
Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

