Пример #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]
Пример #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]
Пример #3
0
def test_crop_location_on_rect():
    res  = crop(rect)
    assert res[1]==[50,120,50,130]
Пример #4
0
def test_crop_size_on_rect_with_padding():
    res  = crop(rect,4)
    assert sum(res[0])==1264
Пример #5
0
def test_crop_size_on_circle():
    res  = crop(circle)
    assert sum(res[0])==2029
Пример #6
0
def test_crop_size_on_rect():
    res  = crop(rect)
    assert sum(res[0])==0
Пример #7
0
def test_crop_location_on_rect():
    res = crop(rect)
    assert res[1] == [50, 120, 50, 130]
Пример #8
0
def test_crop_size_on_rect_with_padding():
    res = crop(rect, 4)
    assert sum(res[0]) == 1264
Пример #9
0
def test_crop_size_on_circle():
    res = crop(circle)
    assert sum(res[0]) == 2029
Пример #10
0
def test_crop_size_on_rect():
    res = crop(rect)
    assert sum(res[0]) == 0