scripts/FilterBank.py
def fil_kernel(paras, n_stds=3):
    '''
    Complex values of 2D Gabor filter, for use in convolution.
    When applied to images, this is typically called
    The linear size of the filter is determined as a multiple
    of the standard deviation of the Gaussian envelope, and the
    values passed to the filter are symmetric about zero.
    
    USAGE: pass the parameters only; the size of the grid of
    response values generated depends on these.
    '''
    
    pixnum = 2*math.ceil(n_stds*paras["sdev"])
    
    y0 = pixnum/2
    x0 = pixnum/2
    y, x = np.mgrid[-y0:(y0+1), -x0:(x0+1)]
    
    # Spatial frequency in polar coordinates.
    u = paras["freqs"] * math.cos(paras["dir"])
    v = paras["freqs"] * math.sin(paras["dir"])
    # Computations.
    envelope = G2_envelope(x=x, y=y,
                           amp=paras["amp"]/(2*math.pi*paras["sdev"]**2),
                           sdev=paras["sdev"])
    out = {"real": None, "imag": None}
    out["real"] = envelope * G2_carrier_real(x=x, y=y, freqx=u, freqy=v, phase=paras["phase"])
    out["imag"] = envelope * G2_carrier_imag(x=x, y=y, freqx=u, freqy=v, phase=paras["phase"])
    
    return out

    Complex values of 2D Gabor filter, for use in convolution.
    When applied to images, this is typically called
    The linear size of the filter is determined as a multiple
    of the standard deviation of the Gaussian envelope, and the
    values passed to the filter are symmetric about zero.
    
    USAGE: pass the parameters only; the size of the grid of
    response values generated depends on these.
    
Complex values of 2D Gabor filter, for use in convolution.
When applied to images, this is typically called
The linear size of the filter is determined as a multiple
of the standard deviation of the Gaussian envelope, and the
values passed to the filter are symmetric about zero.

pass the parameters only; the size of the grid of
response values generated depends on these.
Complex values of 2D Gabor filter for use in convolution . When applied to images this is typically called The linear size of the filter is determined as a multiple of the standard deviation of the Gaussian envelope and the values passed to the filter are symmetric about zero . pass the parameters only ; the size of the grid of response values generated depends on these .
def fil_kernel(paras, n_stds=3):
    pixnum = 2*math.ceil(n_stds*paras["sdev"])
    y0 = pixnum/2
    x0 = pixnum/2
    y, x = np.mgrid[-y0:(y0+1), -x0:(x0+1)]
    u = paras["freqs"] * math.cos(paras["dir"])
    v = paras["freqs"] * math.sin(paras["dir"])
    envelope = G2_envelope(x=x, y=y,
                           amp=paras["amp"]/(2*math.pi*paras["sdev"]**2),
                           sdev=paras["sdev"])
    out = {"real": None, "imag": None}
    out["real"] = envelope * G2_carrier_real(x=x, y=y, freqx=u, freqy=v, phase=paras["phase"])
    out["imag"] = envelope * G2_carrier_imag(x=x, y=y, freqx=u, freqy=v, phase=paras["phase"])
    return out
def fil_kernel ( paras , n_stds = 3 ) : pixnum = 2 * math . ceil ( n_stds * paras [ "sdev" ] ) y0 = pixnum / 2 x0 = pixnum / 2 y , x = np . mgrid [ - y0 : ( y0 + 1 ) , - x0 : ( x0 + 1 ) ] u = paras [ "freqs" ] * math . cos ( paras [ "dir" ] ) v = paras [ "freqs" ] * math . sin ( paras [ "dir" ] ) envelope = G2_envelope ( x = x , y = y , amp = paras [ "amp" ] / ( 2 * math . pi * paras [ "sdev" ] ** 2 ) , sdev = paras [ "sdev" ] ) out = { "real" : None , "imag" : None } out [ "real" ] = envelope * G2_carrier_real ( x = x , y = y , freqx = u , freqy = v , phase = paras [ "phase" ] ) out [ "imag" ] = envelope * G2_carrier_imag ( x = x , y = y , freqx = u , freqy = v , phase = paras [ "phase" ] ) return out
Complex values of 2D Gabor filter, for use in convolution.
Complex values of 2D Gabor filter for use in convolution .
'''
    Complex values of 2D Gabor filter, for use in convolution.
    When applied to images, this is typically called
    The linear size of the filter is determined as a multiple
    of the standard deviation of the Gaussian envelope, and the
    values passed to the filter are symmetric about zero.
    
    USAGE: pass the parameters only; the size of the grid of
    response values generated depends on these.
    ''' # Spatial frequency in polar coordinates. # Computations.
paras
n_stds