Ejemplo n.º 1
0
def test_crop_location_on_rectangle():
    random_rect = ones([300,200])
    random_rect = random_rect>0
    a = int(rand()*300)
    b = int(rand()*(300-(a+1)))+a+1

    c = int(rand()*200)
    d = int(rand()*(200-(c+1)))+c+1

    print [a,b,c,d]

    random_rect[a:b,c:d] = False
    res  = crop(random_rect)
    assert res[1]==[a,b,c,d]
Ejemplo n.º 2
0
def test_crop_location_on_rectangle():
    random_rect = ones([300, 200])
    random_rect = random_rect > 0
    a = int(rand() * 300)
    b = int(rand() * (300 - (a + 1))) + a + 1

    c = int(rand() * 200)
    d = int(rand() * (200 - (c + 1))) + c + 1

    print[a, b, c, d]

    random_rect[a:b, c:d] = False
    res = crop(random_rect)
    assert res[1] == [a, b, c, d]
Ejemplo n.º 3
0
def test_crop_location_on_rect():
    res  = crop(rect)
    assert res[1]==[50,120,50,130]
Ejemplo n.º 4
0
def test_crop_size_on_rect_with_padding():
    res  = crop(rect,4)
    assert sum(res[0])==1264
Ejemplo n.º 5
0
def test_crop_size_on_circle():
    res  = crop(circle)
    assert sum(res[0])==2029
Ejemplo n.º 6
0
def test_crop_size_on_rect():
    res  = crop(rect)
    assert sum(res[0])==0
Ejemplo n.º 7
0
def test_crop_location_on_rect():
    res = crop(rect)
    assert res[1] == [50, 120, 50, 130]
Ejemplo n.º 8
0
def test_crop_size_on_rect_with_padding():
    res = crop(rect, 4)
    assert sum(res[0]) == 1264
Ejemplo n.º 9
0
def test_crop_size_on_circle():
    res = crop(circle)
    assert sum(res[0]) == 2029
Ejemplo n.º 10
0
def test_crop_size_on_rect():
    res = crop(rect)
    assert sum(res[0]) == 0