Hello, I'm trying to write the Gabor ternary pattern, Please help me with this!
Show older comments
Hello, I'm trying to write the GAbor ternary pattern:

The answer should be like below:

Please tell me where did I wrong in code!
MATLAB Code:
clc
close all
clear all
[fn fp]=uigetfile('*.*');
I=(rgb2gray(imread([fp,fn])));
[m n]=size(I);
kv=pi/2;
GTP=zeros(m,n);
for x=1:m
for y=1:n
for ii=0:3
phi=ii*pi/4;
z=[x y]';
k=kv*[cos(phi) sin(phi)]';
psi(x,y)=((norm(k))^2)*exp(-(((norm(k))^2)*((norm(z))^2))/2)*...
(exp(sqrt(-1)*k'*z)-exp(-1/2));
G(x,y)=imag(psi(x,y));
f(x,y)=conv(G(x,y),I(x,y));
if f(x,y)<-.03
pp=-1;
else pp=0;
end
GTP(x,y)=3^ii*(pp+2*(f(x,y)>.03))+GTP(x,y);
end
end
end
figure,imshow(GTP)
Thanks for your considration
2 Comments
Geoff Hayes
on 22 Oct 2014
Mehran - perhaps describe what problems you are having with your code. Is the problem that the output image is all zeros, or something else?
Mehran Kh
on 25 Oct 2014
Accepted Answer
More Answers (1)
Hello, have u apply this algorithm in any areas ?how the result and which paper your refer to code this algorithm?thanks.
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!