Example #1
0
def normalizedXcorr(a, b):
    std = N.std(a) * N.std(b)
    a_ = (a - N.mean(a)) / std
    b_ = (b - N.mean(b)) / std

    c = F.convolve(a_, b_, conj=1)  # / a.size

    return c
Example #2
0
def normalizedXcorr(a, b):
    std = N.std(a) * N.std(b)
    a_ = (a - N.mean(a)) / std
    b_ = (b - N.mean(b)) / std

    c = F.convolve(a_, b_, conj=1)# / a.size
    
    return c
Example #3
0
def arr_edgeFilter(img, sigma=1.5):
    """
    average-deviation with a gaussian prefilter
    img must be in an even shape
    """
    if sigma:
        g = gaussianArrND(img.shape, sigma)
        g = F.shift(g)
        img = F.convolve(img.astype(N.float32), g)
    gr = N.gradient(img.astype(N.float32))
    ff = N.sum(N.power(gr, 2), 0)
    return ff 
Example #4
0
def arr_edgeFilter(img, sigma=1.5):
    """
    average-deviation with a gaussian prefilter
    img must be in an even shape
    """
    if sigma:
        g = gaussianArrND(img.shape, sigma)
        g = F.shift(g)
        img = F.convolve(img.astype(N.float32), g)
    gr = N.gradient(img.astype(N.float32))
    ff = N.sum(N.power(gr, 2), 0)
    return ff