How to fit a Gaussian curve to the profile obtained from "improfile"?

1 次查看(过去 30 天)
Hi,
I have generated an intensity profile across a line section for my image using improfile. How do I get MATLAB to fit a Gaussian curve to this "noisy" profile?
The main aim is to fit a 2D Gaussian to the pixel values at each position across a 2D image, and to display the result visually in real time.
If this is not possible, then please advise me on other methods.
Thank you!

回答(1 个)

Bruno Pop-Stefanov
Bruno Pop-Stefanov 2014-1-22
编辑:Bruno Pop-Stefanov 2014-1-22
You can fit a mixture of Gaussian models to your profile interactively using the Curve Fitting Toolbox. Here is a tutorial:
Execute cftool to open the Curve Fitting tool. Select your profile as y-data then select "Gaussian" in the model list. You can visualize the profile and see how changing the number of Gaussian models affects the fit.
I suggest you blur your profile to smooth it before trying to fit a Gaussian to it. Use fspecial to create a filter and imfilter to blur the profile:
h = fspecial('gaussian', [1 7]);
smooth_profile = imfilter(profile, h, 'replicate');

类别

Help CenterFile Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by