what value should i give for hsize and sigma in fspecial (gaussian) function???
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
h=fspecial('gaussian',?,?)
0 Commenti
Risposte (2)
Wayne King
il 29 Mar 2014
That really depends on your filtering application. Obviously the bigger hsize, the larger the neighborhood you are filtering over, and the larger sigma, the larger the spread of the filter in that neighborhood.
How much are you trying to smooth out your data?
0 Commenti
DGM
il 8 Mar 2022
Modificato: DGM
il 8 Mar 2022
Unless you have other needs, just pick a sigma value and then calculate hsize like so:
sigma = 20; % this depends on your needs
kw = 2; % typical might be 2-3
fk = fspecial('gaussian',2*ceil(kw*sigma)+1,sigma);
Changing the hsize parameter only changes the support area. For example, these are filters for sigma = 20 and kw = 1-4

Note that the gaussians are all the same. Hsize just specifies where it gets truncated. A smaller filter is faster to apply, but the harder edges sacrifice some of the benefits of using a gaussian. Picking a size is just a matter of compromise between speed and quality.
I should note that fspecial() does support asymmetric hsize. That said, making hsize asymmetric doesn't change the symmetry of the underlying gaussian. With that in mind and considering the fact that fspecial() doesn't accept vector sigma, I don't see much purpose for using asymmetric hsize.
0 Commenti
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!