Ejemplo n.º 1
0
def test_centreOfGravity_value():
    img = numpy.zeros((1, 5, 5))
    img[0, 1:3, 2:4] = 1.
    centroid = image_processing.centreOfGravity(img)
    numpy.testing.assert_almost_equal(centroid, numpy.array([[2.5], [1.5]]))
Ejemplo n.º 2
0
def test_centreOfGravity_single():
    img = numpy.random.random((10, 10))
    com = image_processing.centreOfGravity(img, 0.1)
    assert(com.shape[0]) == 2
Ejemplo n.º 3
0
def test_centreOfGravity_many():
    img = numpy.random.random((5, 10, 10))
    com = image_processing.centreOfGravity(img, 0.1)
    assert(com.shape[0] == 2)
    assert(com.shape[1] == 5)