Пример #1
0
 def func(image, kernel):
     ref = scipy.signal.fftconvolve(image, kernel, mode='same')
     convol = ConvolutionOperator(kernel, image.shape)
     con = convol(image)
     assert np.allclose(ref, con, atol=1.e-15)
     assert np.allclose(convol.todense().T.conjugate(),
                        convol.H.todense(), atol=1.e-15)
Пример #2
0
def test_convolution_rules_homothety():
    h = HomothetyOperator(2)
    c = ConvolutionOperator(np.ones((3, 3)), (5, 5))
    ref = c.todense() * h.data
    lambda_id = lambda x, y: (x, y)
    lambda_sw = lambda x, y: (y, x)

    def func(ops, r):
        op = CompositionOperator(ops)
        assert_same(op.todense(), r, atol=5)
    for op, r in zip((c, c.T), (ref, ref.T)):
        for l in (lambda_id, lambda_sw):
            ops = l(op, h)
            yield func, ops, r