Gabor Filter

3 views (last 30 days)
C N N
C N N on 14 Sep 2011
I am trying to execute gabor filter on images.
{%%Read clear all;
close all;
clc;
I=imread('test.png');
imshow(I);
%%Crop I2 = imcrop(I);
figure, imshow(I2)
m=size(I2,1);
n=size(I2,2);
%%Gabor
phi = 7*pi/8;
theta = 2;
sigma = 0.65*theta;
for i=1:3
for j=1:3
xprime= j*cos(phi);
yprime= i*sin(phi);
K = exp(2*pi*theta*i(xprime+ yprime));
G= exp(-(i.^2+j.^2)/(sigma^2)).*abs(K);
end
end
%%Convolve
for i=1:m
for j=1:n
J(i,j)=conv2(I2,G);
end
end
imshow(uint8(J))
I am getting this error always.
??? Subscript indices must either be real positive integers or logicals.
Not sure how to solve this...

Answers (1)

Walter Roberson
Walter Roberson on 14 Sep 2011
You have
K = exp(2*pi*theta*i(xprime+ yprime));
which attempts to subscript your variable "i" at the index "xprime + yprime". Perhaps you wanted i*(xprime + yprime) ?
  1 Comment
C N N
C N N on 14 Sep 2011
thanks. but after i corrected that i had another error.
??? Subscripted assignment dimension mismatch.
Any idea?

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!