Gabor Filter

3 次查看(过去 30 天)
C N N
C N N 2011-9-14
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...

回答(1 个)

Walter Roberson
Walter Roberson 2011-9-14
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 个评论
C N N
C N N 2011-9-14
thanks. but after i corrected that i had another error.
??? Subscripted assignment dimension mismatch.
Any idea?

请先登录,再进行评论。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by