How to apply directional gaussian filters to an image?

19 ビュー (過去 30 日間)
anastasia
anastasia 2017 年 3 月 3 日
コメント済み: PaulLe 2020 年 1 月 20 日
I have an image I(X,Y) and I wish to filter it using the difference of Gaussian filter for different directions. Since I do not know the direction of particular lines in the image, I want to implement a 12 directional filters each of them tuned to a specific orientation θi ∈ [−π/2, π/2], i = 1, . . . , 12. The output of the directional filter is then compared with the output of an omnidirectional filter. We will use Gaussian filters for this purpose. Considering both contributions, the filter impulse response is given by
hθ(x, y) = G1(x, y) G2(x, y)
This is the difference of gaussian filter which I wish to convolve with my image.
Ii(x, y) = hθi(x, y) I(x, y) for i=1 to 12
This is the code I have executed for difference of Gaussian filter.
My filter parameters are as given below:
N = 12 filters,
σx1 = 40, σy1 = 40, σx2 = 3, σy2 = 0.5
and the window size is 11x11
clc;
clear all;
close all;
hsize=[11, 11];
a=(imread('os.jpg'));
a1=rgb2gray(a);
figure();
imshow(a1);
h1=imgaussfilt(a1, [40, 40], 'filterSize', [11, 11]);
h2=imgaussfilt(a1, [3, 0.5], 'filterSize', [11,11]);
imshow(h2)
DoG=h1-h2;
imshow(DoG);
  1 件のコメント
Matteo Fadda
Matteo Fadda 2018 年 4 月 15 日
how can I extend this example for all 12 directions? thank you

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2017 年 3 月 4 日
Like it said, Gaussians are an omnidirectional filter. That's what it says: "The output of the directional filter is then compared with the output of an omnidirectional filter. We will use Gaussian filters for this purpose." It can be made non-rotationally symmetrix. But I don't know what the "directional" filter it mentions is.
Using gausfilt() or fspecial() will give you symmetric Gaussians, though you could resize them with imresize() though that just sizes along the x or y axes. If you want to rotate also, then call resize and then call imrotate().
  1 件のコメント
PaulLe
PaulLe 2020 年 1 月 20 日
Dear Image Analyst,
How can I extend this example for all 8 directions?
Thank you so much.

サインインしてコメントする。

その他の回答 (2 件)

Braiki Marwa
Braiki Marwa 2017 年 5 月 17 日
Hello,
I want to apply the gaussian filter .I write this code but it's not working
for i=1:nb1_iteration
Iblur1= imgaussfilt(im,0.5);
end
  3 件のコメント
Braiki Marwa
Braiki Marwa 2017 年 5 月 18 日
編集済み: Image Analyst 2017 年 5 月 18 日
I want to apply the process of filtering for different iterations and see the effect.
Image Analyst
Image Analyst 2017 年 5 月 18 日
OK, good luck.

サインインしてコメントする。


Gustavo Liñan
Gustavo Liñan 2017 年 11 月 21 日
編集済み: Gustavo Liñan 2017 年 11 月 21 日
I use this type of rotated filters many times when I create algorithms using the histogram of orientations. What I do, in these cases, is, First, I create the non-simetric filter (e.g. gaussian with \sigmaX != \sigmaY, or LoG...). Then I define the rotation vector (typically, Phi=0:pi/Step:pi) and for each rotation angle I create the rotated filter basically, I consider the filter an image, apply image rotation with the bicubic interpolation and 'loose' option. Finally, I take the filter out of its rotated image by cropping it to the correct size.

Community Treasure Hunt

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

Start Hunting!

Translated by