Hello, I'm trying to write the Gabor ternary pattern, Please help me with this!
古いコメントを表示
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 件のコメント
Geoff Hayes
2014 年 10 月 22 日
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
2014 年 10 月 25 日
採用された回答
その他の回答 (1 件)
Hello, have u apply this algorithm in any areas ?how the result and which paper your refer to code this algorithm?thanks.
カテゴリ
ヘルプ センター および File Exchange で Image Arithmetic についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!