示例#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