Esempio n. 1
0
def test_geometric_tform():
    tform = GeometricTransform()
    with testing.raises(NotImplementedError):
        tform(0)
    with testing.raises(NotImplementedError):
        tform.inverse(0)
    with testing.raises(NotImplementedError):
        tform.__add__(0)
Esempio n. 2
0
def test_geometric_tform():
    tform = GeometricTransform()
    with pytest.raises(NotImplementedError):
        tform(0)
    with pytest.raises(NotImplementedError):
        tform.inverse(0)
    with pytest.raises(NotImplementedError):
        tform.__add__(0)

    # See gh-3926 for discussion details
    for i in range(20):
        # Generate random Homography
        H = np.random.rand(3, 3) * 100
        H[2, H[2] == 0] += np.finfo(float).eps
        H /= H[2, 2]

        # Craft some src coords
        src = np.array([
            [(H[2, 1] + 1) / -H[2, 0], 1],
            [1, (H[2, 0] + 1) / -H[2, 1]],
            [1, 1],
        ])
        # Prior to gh-3926, under the above circumstances,
        # destination coordinates could be returned with nan/inf values.
        tform = ProjectiveTransform(H)  # Construct the transform
        dst = tform(src)  # Obtain the dst coords
        # Ensure dst coords are finite numeric values
        assert (np.isfinite(dst).all())
Esempio n. 3
0
def test_geometric_tform():
    tform = GeometricTransform()
    with testing.raises(NotImplementedError):
        tform(0)
    with testing.raises(NotImplementedError):
        tform.inverse(0)
    with testing.raises(NotImplementedError):
        tform.__add__(0)
Esempio n. 4
0
def test_geometric_tform():
    tform = GeometricTransform()
    assert_raises(NotImplementedError, tform, 0)
    assert_raises(NotImplementedError, tform.inverse, 0)
    assert_raises(NotImplementedError, tform.__add__, 0)