Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image Gabor滤波器编码错误_Image_Matlab_Image Processing - Fatal编程技术网

Image Gabor滤波器编码错误

Image Gabor滤波器编码错误,image,matlab,image-processing,Image,Matlab,Image Processing,编辑:GABOR滤波器的描述 % gab2d: **2D Gabor filter** % The Gabor filter is basically a Gaussian, modulated by a complex sinusoid % G = gab2d(I,Sx,Sy,f,theta,FUN) % Input and output arguments ([]'s are optional): % I (matrix) of size NxM: Input Image of

编辑:GABOR滤波器的描述

% gab2d: **2D Gabor filter** % The Gabor filter is basically a Gaussian, modulated by a complex sinusoid % G = gab2d(I,Sx,Sy,f,theta,FUN) % Input and output arguments ([]'s are optional): % I (matrix) of size NxM: Input Image of size NxM. gamma (scalar): The spatial aspect ratio, x to y. lambda(scalar): The wavelength of the sinusoidal function. b (scalar): The spatial frequency band-width (in octaves) theta (scalar): The orientation of the gabor filter. % phi (scalar): The phase offset. 0 is real part of Gabor filter or % even-symmetric, pi/2 is imaginary part of Gabor filter or % odd-symmetric. % **Note**: sigma (scalar): The spread of Gabor filter or the standard % deviation of Gaussian is automatically computed from lambda and b. % [shape] (strings): Shape for conv2. See help conv2. Default is 'same'. % % GO (matrix) of size NxM: Output images which was applied Gabor % filters. This is the magnitude response. % [GF] (matrix) of size (2Sx+1)x(2Sy+1): Gabor filter. %gab2d:*2D Gabor滤波器** %Gabor滤波器基本上是高斯滤波器,由复正弦信号调制 %G=gab2d(I,Sx,Sy,f,θ,FUN) %输入和输出参数([]是可选的): %大小为NxM的I(矩阵):输入大小为NxM的图像。 gamma(标量):空间纵横比,x:y。 λ(标量):正弦函数的波长。 b(标量):空间频率带宽(以八度为单位) θ(标量):gabor滤波器的方向。 %φ(标量):相位偏移。0是Gabor滤波器的实部,或 %即使是对称的,pi/2是Gabor滤波器的虚部 %奇数对称。 %**注**: sigma(标量):Gabor滤波器或标准的扩展 %根据λ和b自动计算高斯偏差。 %[形状](字符串):conv2的形状。请参阅帮助2。默认值为“相同”。 %大小为NxM的%GO(矩阵):输出应用Gabor的图像 %过滤器。这是震级响应。 %大小为(2Sx+1)x(2Sy+1)的[GF](矩阵):Gabor滤波器。
function[GO,GF]=gab2d(I,gamma,lambda,b,θ,phi,shape)
I=imread('C:\Users\Vinay\Documents\MATLAB\textureflawimages\text9.png');
γ=1;b=1;θ=0:pi/6:pi/6;φ=0;形状='有效';λ=8;
如果nargin<7,则形状=‘相同’;结束;
如果isa(I,'double')~=1,I=double(I);结束
西格玛=(1/pi)*sqrt(对数(2)/2)*(2^b+1)/(2^b-1)*λ;
Sy=西格玛*伽马;
对于x=-fix(西格玛):fix(西格玛)
对于y=-fix(Sy):fix(Sy)
xp=x*cos(θ)+y*sin(θ);
yp=y*cos(θ)-x*sin(θ);
GF(fix(Sy)+y+1,fix(sigma)+x+1)=。。。
exp(-5*(xp^2+伽马^2*yp^2)/sigma^2)*cos(2*pi*xp/lambda+phi)。。。
; %/ (2*pi*(σ^2/γ));
%如果使用不同的西格玛(λ或b),则进行规范化
结束
结束
GO=conv2(I,双(GF),形状);
错误:

???使用==>mpower矩阵时出错必须为平方

36 GF时的误差==>gab2d(固定(Sy)+y+1,固定(sigma)+x+1)=

我不知怎的没法纠正这个问题


请帮助

θ
是一个数组。因此,例如
xp
也是一个数组。如果要对
xp
的每个元素进行平方运算,则需要使用元素级运算符,如
^
表示幂,或
*
表示乘法


为了更快地找出错误,请在命令行中键入
dbstop if error
,将调试器设置为在出现错误时停止。这允许您通过鼠标悬停在编辑器中的所有变量上来检查它们,并计算复杂表达式中的少量变量以缩小错误范围

那是什么语言?另外,是否可以整理格式以使其更具可读性?
function [GO, GF] = gab2d(I, gamma, lambda, b, theta, phi, shape)

I=imread('C:\Users\Vinay\Documents\MATLAB\textureflawimages\text9.png');

gamma = 1; b = 1; theta = 0:pi/6:pi-pi/6; phi = 0; shape = 'valid'; lambda=8;

if nargin < 7, shape = 'same'; end;

if isa(I, 'double') ~= 1, I = double(I); end

sigma = (1 / pi) * sqrt(log(2)/2) * (2^b+1) / (2^b-1) * lambda;

Sy = sigma * gamma;

for x = -fix(sigma):fix(sigma)

    for y = -fix(Sy):fix(Sy)

        xp = x * cos(theta) + y * sin(theta);

        yp = y * cos(theta) - x * sin(theta);

        GF(fix(Sy)+y+1,fix(sigma)+x+1) = ...

        exp(-.5*(xp^2+gamma^2*yp^2)/sigma^2) * cos(2*pi*xp/lambda+phi) ...

        ; %/ (2*pi*(sigma^2/gamma));

        % Normalize if you use different sigma (lambda or b)
    end
end
GO = conv2(I, double(GF), shape);