Can I have the matlab code for gabor filteration that I can use for edge detection?I have to generate the block in simulink, I have made a code ,but i'm not sure if it gives the correct output.

1 view (last 30 days)
function [J] = gabor_fn2EDITED (I) clc; % I2 = imcrop(I,[]); m=size(I,1); n=size(I,2); %% Gabor phi = 7*pi/8; theta = 2; sigma = 0.65*theta; filterSize = 3;
G = zeros(filterSize);
for i=(0:filterSize-1)/filterSize for j=(0:filterSize-1)/filterSize xprime= j*cos(phi); yprime= i*sin(phi); K = exp(2*pi*theta*sqrt(-1)*(xprime+ yprime)); G(round((i+1)*filterSize),round((j+1)*filterSize)) = exp(-(i^2+j^2)/(sigma^2))*K; end end
%% Convolve
J = conv2(I,G); figure,imshow(imag(J));

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!