Discontinuities in imgaussfilt3 near integer values of sigma
2 views (last 30 days)
Show older comments
qfn on 9 Aug 2021
Commented: qfn on 10 Aug 2021
I've noticed some discontinuities in the way that imgaussfilt3 works when sigma nears (and passes) and integer value. This is readily reproducible, as shown below:
This gives the following plot, clearly showing issues at integer values. This is also visible if you increase the "resolution", that is something like X=linspace(2.98,3.02,1000) with the same loop, you readily see this issue.
What's happening here ? Why is this function not continuous as a function of inputted sigma ?
DGM on 10 Aug 2021
Edited: DGM on 10 Aug 2021
This also happens for imgaussfilt() and others (e.g. using MIMT fkgen() and imfilter()). If you take a closer look, you'll notice it's not strictly integer-values that are the problem areas. It's integers and half-integers.
These defects are an artifact of the kernel size calculation, which must be integer-valued.
bsig = linspace(.9,5.1,1000);
bsize = 2*ceil(2*bsig) + 1;
The significance of these sudden changes can be reduced by explicitly specifying a larger filter size.
bsize = 2*ceil(4*X(i)) + 1;
I tend to prefer a bit more filter support than the default provides, but as always, the defaults are a compromise between quality and speed.
More Answers (0)
Find more on Contrast Adjustment in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!