pixel by pixel comparison of images

hello I am working with gabor filter. I have 12 images with different orientations which is output by gabor filter.I want to perform pixel by pixel comparison of images and find the maximum response image. maximum response of image is the image which has the highest pixel value other than all the images .can anybody tell me how do i do it. I have a small piece of code.
for n=1:N
count = 1;
gb = gabor_fn(bw,gamma,psi(1),lambda,theta);%...
figure;
imshow(gb);
theta = theta + pi/N;
end

 Accepted Answer

Your lambda is too low or your bw is too low.

6 Comments

yes sir i am referring to same file ...sir my lamda is 8 and bw is 2 ....still i am getting error.I tried all possible things ..changed value too but still it gives me this error
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> gabor_fn at 23
x_theta=x*cos(theta)+y*sin(theta);
Error in ==> file1>GABOR_Callback at 764
gb = gabor_fn(bw,gamma,psi(1),lambda,theta)
What gamma are you using?
What is your GABOR_Callback routine? It is not part of the contribution I linked to above.
my gamma value is 0.5..and ya i am reffering to the same contribution.. my values are
lambda = 8;
theta = 0;
psi = [0 pi/2];
gamma = 0.5;
bw = 5;
N = 12;
sir. It works when i give the theta as theta = theta +pi/N where my N is 12 ..and this line is for next orientation. my orientation is 0,15,30,45,..165 total 12 orientations.am i doing nything wrong here sir
Sorry, my bed is calling me now. I have already shut down my system for the evening.
yes sir.!!! sorry for the disturbance..if possible reply me tomo sir!!..gud night :-)

Sign in to comment.

More Answers (1)

Something like this perhaps:
theMaxValues = zeros(1, N);
theta = 0; % whatever...
for n=1:N
gb = gabor_fn(bw,gamma,psi(1),lambda,theta(n));
theMaxValues(n) = max(gb(:));
figure;
imshow(gb);
theta(n+1) = theta(n) + pi/N;
end
[overallMax, index] = max(theMaxValues);
thetaOfMax = theta(index);
final_gb = gabor_fn(bw,gamma,psi(1),lambda,thetaOfMax);

5 Comments

thanks a lot sir.!!1I had tried a simpler method which took long time to run..sir the line theta(n+1) = theta(n) + pi/N; gives me error..saying ??? Error using ==> mtimes Inner matrix dimensions must agree.
Error in ==> gabor_fn at 23
x_theta=x*cos(theta)+y*sin(theta);
Error in ==> file1>GABOR_Callback at 764
gb = gabor_fn(bw,gamma,psi(1),lambda,theta)
i think this problem is because of the line theta(n+1) = theta(n) + pi/N; because i changed this line to theta= theta(n) + pi/N;
that gave me error
??? Error while evaluating uicontrol Callback
theta =
1.5708
??? Attempted to access theta(2); index out of bounds because numel(theta)=1.
Error in ==> file1>GABOR_Callback at 771
theta = theta(n)+pi/N
How do i solve it sir?
You passed in theta - the whole array - not the theta(n) like I told you to. Why? You will get an error, like you did, because evidently it wants a scalar, not a whole array.
sir i changed it now. i changed it as its specified theta(n+1)= theta(n)+pi/N but i get this error
Error using ==> mtimes Inner matrix dimensions must agree.
Error in ==> gabor_fn at 23
x_theta=x*cos(theta)+y*sin(theta);
Error in ==> file1>GABOR_Callback at 764
gb = gabor_fn(bw,gamma,psi(1),lambda,theta)
I don't have your code so I can't go much more. Even if I did, I probably wouldn't have time. Please review this: http://blogs.mathworks.com/videos/2012/07/03/debugging-in-matlab/ and you will be able to solve it yourself. Also please make yourself aware how dot operators work - when and why you use them. There is a difference between matrix multiplication of two matrices, and multiplication of those two matrices element-by-element. You can matrix multiply a n*m matrix by a m*n matrix, but you can't do an element by element multiplication if n is not equal to m. Similarly you can dot multiply element-by-element an m*n matrix by another n*m matrix, but you can't do a matrix multiplication of those matrices. Make very sure you understand those concepts and operators very well.
yes sir...thanks a lot for youa valuable solutions..i study and worked it out with the different method ..

Sign in to comment.

Asked:

on 10 Nov 2013

Commented:

on 13 Nov 2013

Community Treasure Hunt

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

Start Hunting!