Relationship between Sigma and grid size in imgaussfilt3

3 次查看(过去 30 天)
Hello,
I am using the imgaussfilt3 function to smooth out my velocity fields in three dimensions. I understand that there are two variables to manipulate, i.e., Sigma and Filterwidth. I am manipulating only Sigma and leaving Filterwidth untouched (By default, the filter width is 4*Sigma + 1). What I am unable to find the documentation is the precise relationship between Sigma and the number of grid cells. My guess is that 1 Sigma is equal to 1 grid cell, but this most certainly need not be the case. Can a person with access to the source code please tell me the precise relationship between Sigma or Filterwidth to the grid dimensions?
Thank you!

回答(1 个)

Walter Roberson
Walter Roberson 2019-9-15
If "number of grid cells" refers to the size of the filter, then according to the documentation,
% 'FilterSize' - Scalar or 3-element vector, of positive, odd
% integers that specifies the size of the Gaussian
% filter. If a scalar Q is specified, then a square
% Gaussian filter of size [Q Q Q] is used.
%
% Default value is 2*ceil(2*SIGMA)+1.
  2 个评论
saipb
saipb 2019-9-15
Dear Walter,
Thank you for the response. The response does not completely answer my question though. It is true that if I specify Q, then the scalar Q refers to a filter width of QxQxQ grid cells. However, if I am using the default value, then the filter size is merely a function of Sigma. Now, theoretically, it is possible to have many number of grid cells for the same value of Sigma. This is why, I guess that Matlab must assume some correlation between Sigma and number of grid cells. I think it is 1 Sigma = 1 grid-cell. Could you please confirm if this is the case?
Walter Roberson
Walter Roberson 2019-9-15
No. The default is 2*ceil(2*SIGMA)+1 .
One possible interpretation of that is 2*Sigma relative to the center of the filter. But the choice could have been arbitrary. If you want to know why they choose 2*ceil(2*SIGMA)+1 then you will need to open a support case and ask for their reasoning.

请先登录,再进行评论。

产品

Community Treasure Hunt

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

Start Hunting!

Translated by