Gabor阶段?我的价值观太小了

时间:2011-05-15 17:19:13

标签: matlab matlab-compiler time-frequency

大家好>>>希望你们都做得很好

我想问你关于计算图像的相位值的问题,你看我用的是Gabor wavlet:

k = ( Kmax / ( f ^ v ) ) * exp( 1i * u * pi / 8 );% Wave Vector

kn2 = ( abs( k ) ) ^ 2;

GW = zeros ( R , C );

for m = -R/2 + 1 : R/2

       for n = -C/2 + 1 : C/2 

        GW(m+R/2,n+C/2) = ( kn2 / Delt2 ) * exp( -0.5 * kn2 * ( m ^ 2 + n ^ 2 ) / Delt2) * ( exp( 1i * ( real( k ) * m + imag ( k ) * n ) ) - exp ( -0.5 * Delt2 ) );

    end
end
I=imread('a.pgm');

Myimage=conv2(I,double(GW),'same');

然后我用不同的方向和比例调用图像和滤镜并将相位存储在P中然后我想用rang 4 i量化它:

close all;
clear all;
clc;

% Parameter Setting

R = 32;
C = 32;
Kmax = pi;
f = sqrt( 2 );
Delt = 2 * pi;
Delt2 = Delt * Delt;

% Show the Gabor Wavelets

for v=1:7 %v = 1 : 7
    for u = 1:5 % u= 1: 5

        [GW,Myimage]= GaborWavelet ( R, C, Kmax, f, u, v, Delt2 ); % Create the Gabor wavelets
       figure;
        subplot( 5, 8, v * 7 + u ),imshow ( real( GW ) ,[]); % Show the real part of Gabor wavelets

    end
   figure ;
    subplot( 1, 5, v + 1 ),imshow ( abs( GW ),[]); % Show the magnitude of Gabor wavelets
end


%clear I;
R=real(GW);

I=imag(GW);

M=abs(Myimage);

P=atan(imag(Myimage)/real(Myimage)); <<<< is this even right ??


%P=atan(I/R);

save P P;

[xx,yy] = size (P);

DATA =zeros(size(P));

for i=1:48
    for j=1:48
        for zz=1:3
           if (360* zz/4) <= abs(P(i,j))&& abs(P(i,j))<(360*(zz+1)/4) 
                 DATA(i,j)=zz ; end;


        end;
    end;
end;
save DATA DATA ;

但数据如此之小:-1.49279186693682 1.50990968797986 -1.39225915272978 0.966151874072431

导致量化值0>&gt;我哪里出错了

1 个答案:

答案 0 :(得分:0)

我认为价值看起来很小,因为它们以弧度给出,你期望它们以度为单位。至于获得复数的幅度和角度,请查看http://www.mathworks.fr/fr/help/matlab/ref/angle.html

我引用:

“对于复数Z,幅度R和相位角θ由

给出

R = abs(Z)

theta = angle(Z)“

Z 将是您的 GW

希望这有帮助!