Python scipy.signal 模块,correlate2d() 实例源码

我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用scipy.signal.correlate2d()

项目:DenoiseAverage    作者:Pella86    | 项目源码 | 文件源码
def correlate(self, image):
        ''' scipy correlate function. veri slow, based on convolution'''
        corr = signal.correlate2d(image.data, self.data, boundary='symm', mode='same')
        return Corr(corr)
项目:sprocket    作者:k2kobayashi    | 项目源码 | 文件源码
def _search_minimum_distance(self, ref, buff):
        if len(ref) < self.fl:
            ref = np.r_[ref, np.zeros(self.fl - len(ref))]

        # slicing and windowing one sample by one
        buffmat = view_as_windows(buff, self.fl) * self.win
        refwin = np.array(ref * self.win).reshape(1, self.fl)
        corr = correlate2d(buffmat, refwin, mode='valid')

        return np.argmax(corr) - self.sl
项目:tutorials    作者:pytorch    | 项目源码 | 文件源码
def forward(self, input, filter):
        result = correlate2d(input.numpy(), filter.numpy(), mode='valid')
        self.save_for_backward(input, filter)
        return torch.FloatTensor(result)
项目:CV-lecture-quizzes-python    作者:pdvelez    | 项目源码 | 文件源码
def find_template_1D(t, s):
    c = sp.correlate2d(s, t, mode='valid')
    raw_index = np.argmax(c)
    return raw_index
项目:CV-lecture-quizzes-python    作者:pdvelez    | 项目源码 | 文件源码
def find_template_2D(template, img):
    c = sp.correlate2d(img, template, mode='same')

    # These y, x coordinates represent the peak. This point needs to be
    # translated to be the top-left corner as the quiz suggests
    y, x = np.unravel_index(np.argmax(c), c.shape)
    return y - template.shape[0] // 2, x - template.shape[1] // 2
项目:extract    作者:dblalock    | 项目源码 | 文件源码
def _dotProdsWithAllWindows(x, X):
    """Slide x along the columns of X and compute the dot product"""
    return sig.correlate2d(X, x, mode='valid').flatten()
项目:extract    作者:dblalock    | 项目源码 | 文件源码
def dotProdsWithAllWindows(x, X):
    """Slide x along the columns of X and compute the dot product

    >>> x = np.array([[1, 1], [2, 2]])
    >>> X = np.arange(12).reshape((2, -1))
    >>> dotProdsWithAllWindows(x, X) # doctest: +NORMALIZE_WHITESPACE
    array([27, 33, 39, 45, 51])
    """
    return sig.correlate2d(X, x, mode='valid').flatten()
项目:extract    作者:dblalock    | 项目源码 | 文件源码
def _dotProdsWithAllWindows(x, X):
    """Slide x along the columns of X and compute the dot product"""
    return sig.correlate2d(X, x, mode='valid').flatten()