gd.m

来自「超声图像实时消噪实验程序」· M 代码 · 共 22 行

M
22
字号
    function g = gD( f, scale, ox, oy )
    % Gaussian (Derivative) Convolution
        K = ceil( 3 * scale );
        x = -K:K;
        Gs = exp( - x.^2 / (2*scale^2) );
        Gs = Gs / sum(Gs);
        Gsx = gDerivative( ox, x, Gs, scale );
        Gsy = gDerivative( oy, x, Gs, scale );
        g = convSepBrd( f, Gsx, Gsy );

    function r = gDerivative( order, x, Gs, scale )
    switch order
    case 0
        r = Gs;
    case 1
        r = -x/(scale^2) .* Gs;
    case 2
        r = (x.^2-scale^2)/(scale^4) .* Gs;
    otherwise
        error('only derivatives up to second order are supported');
    end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?