To obtain the Point Spread Function (PSF) in Matlab, you can use the fspecial
function to generate a predefined filter such as a Gaussian, or you can create an arbitrary PSF. After defining the PSF, you can use the conv2
function to perform the 2D convolution of the PSF with an input image. The Fourier transform can also be used to obtain the PSF of an imaging system.
Here is an example code snippet that generates a Gaussian PSF with a standard deviation of 2 pixels and convolves it with a grayscale image:
main.m367 chars15 lines
Note that the conv2
function is used with the 'same'
option to ensure that the output has the same size as the input image.
gistlibby LogSnag