How to determine the radius of gaussian smoothing?
4 views (last 30 days)
Show older comments
Hi everyone, can anyone explain how I would like to determine the radius smoothing by using imgaussfilt function matlab.
Let say, in my coding, I try imgaussfilt function with 6 sigma. Since the default filter size is 2*ceil(2*sigma)+1.
Thus, the filter size for 6sigma is 2*2*6+1 = 25 . So, would the smoothing radius is half of the filter size? correct me I'm wrong. Below is my coding. Thank you.
clc;clear all; close all;
file = 'Example.txt';
name = 'Testing Smoothing';
Data = textread(file);
y = Data(:,1);
x = Data(:,2);
z = Data(:,3);
ymin = 0.5 ; ymax = 3.5;
xmin = 96 ; xmax = 123;
xlim = [xmin xmax];
ylim = [ymin ymax];
m2 = 0.033333333333;
dx =xmin:m2:xmax; % set the min,max y and interval
dy = ymin:m2:ymax; % set the min,max x and interval
[Xi,Yi] = meshgrid(dx,dy);
[Zi] = griddata(x,y,z,Xi,Yi,'cubic');
Zi = imgaussfilt(Zi,6,'FilterDomain','spatial');
GrdXYZ = [Yi(:) Xi(:) Zi(:)];
nGrd = sortrows(GrdXYZ,1);
2 Comments
Steve Eddins
on 4 Dec 2020
What is your definition of smoothing radius for a Gaussian filter? Theoretically speaking, the Gaussian function has infinite extent. Practically, it decays to zero quickly so that a finite-extent window is sufficient. But it's not clear to me whether smoothing radius is clearly defined for it.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!