예제 #1
0
def test_centre_of_gravity_value():
    img = numpy.zeros((1, 5, 5))
    img[0, 1:3, 2:4] = 1.
    centroid = image_processing.centre_of_gravity(img)
    numpy.testing.assert_almost_equal(centroid, numpy.array([[2.5], [1.5]]))
예제 #2
0
def test_centre_of_gravity_single():
    img = numpy.random.random((10, 10))
    com = image_processing.centre_of_gravity(img, 0.1)
    assert (com.shape[0]) == 2
예제 #3
0
def test_centre_of_gravity_many():
    img = numpy.random.random((5, 10, 10))
    com = image_processing.centre_of_gravity(img, 0.1)
    assert (com.shape[0] == 2)
    assert (com.shape[1] == 5)