Define Gaussian point spread function

6 views (last 30 days)
LM
LM on 10 Nov 2021
Answered: Abhaya on 4 Dec 2024 at 5:50
I want to define a point spread function as a Gaussian. I know the amplitude, sigma and mu for the Gaussian. How do I generate a PSF from those parameters? I would then like to use the PSF in the Lucy-Richardson deblurring algorithm.
I am thinking to define: PSF = imgaussfilt(Image, sigma), but this only allows me to define sigma.
Is there a MATLAB function that allows me to define the amplitude, sigma and mu for the Gaussian function?
Thank you.

Answers (1)

Abhaya
Abhaya on 4 Dec 2024 at 5:50
Hi LM,
Based on my understanding, you want to define a Gaussian point spread function (PSF) using the amplitude, sigma, and mean (mu) as parameters.
To achieve this, you can use one of the following methods:
  • You can create a custom function to generate a Gaussian PSF using the given parameters. Below is a sample function:
function psf = createGaussianPSF(amplitude, sigma, mu, size)
%create a grid of points
[x, y] = meshgrid(-(size(2)-1)/2:(size(2)-1)/2, -(size(1)-1)/2:(size(1)-1)/2);
mu_x = mu(1);
mu_y = mu(2);
%create custom PSF
PSF = amplitude * exp(-((x - mu_x).^2 + (y - mu_y).^2) / (2 * sigma^2));
PSF = circshift(PSF, [mu_y, mu_x]);
end
  • You can create a Gaussian PSF using MATLAB 'fspecial' function and adjust it according to your parameters:
PSF = fspecial('gaussian', hsize, sigma);
PSF = amplitude * PSF;
shift_x = mu(1);
shift_y = mu(2);
PSF = circshift(PSF, [shift_y, shift_x]);
To apply Lucy-Richardson deblurring algorithm, you can use MATLAB 'deconvlucy' function.
For more information, please refer to the following MATLAB documentations for ‘circshift’, ‘fspecial’ and ‘deconvlucy’ functions, respectively.
Hope this solves your query.

Community Treasure Hunt

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

Start Hunting!