フィルターのクリア

Linear Spatial Filtering , How to create the filter?

1 回表示 (過去 30 日間)
Pradeep Sanjeewa
Pradeep Sanjeewa 2013 年 3 月 16 日
How can we create the filters? If you can, please provide the code.
h(x,y)=(1/(2*pi*σ*σ))*exp(-(x*x+y*y)/(2*σ*σ))
Here x ,y=5, σ=1

回答 (1 件)

Honglei Chen
Honglei Chen 2013 年 3 月 16 日
I assume you want a 5x5 Gaussian filter? Otherwise, if you set the above equation with x,y=5 and sigma = 1, it's just a number, not a filter.
If you do want a 5x5 Gaussian filter, you can look at fspecial if you have access to Image Processing Toolbox. You can get it by doing
h = 1/(2*pi)*fspecial('gauss',5,1)
If you want to write it yourself, you just need to follow the algorithm listed in the doc

Community Treasure Hunt

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

Start Hunting!

Translated by