Hello, I'm trying to write the Gabor ternary pattern, Please help me with this!
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Geoff Hayes
il 22 Ott 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?
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!