Exemplo n.º 1
0
def test_resize_6(array):
    """
    provide only scale
    """
    scale = 2

    resize = Resize(scale=2)
    cooked_array = resize.cook(array)

    assert cooked_array.shape[0] == array.shape[0] * scale
    assert cooked_array.shape[1] == array.shape[1] * scale
Exemplo n.º 2
0
def test_resize_3(array):
    """
    provide height and width
    """
    width = 200
    height = 100

    resize = Resize(width=width, height=height)
    cooked_array = resize.cook(array)

    assert cooked_array.shape[0] == width
    assert cooked_array.shape[1] == height
Exemplo n.º 3
0
def test_resize_2(array):
    """
    provide only height
    """
    height = 100
    aspect = array.shape[0] / array.shape[1]

    resize = Resize(height=height)
    cooked_array = resize.cook(array)

    assert cooked_array.shape[0] == int(aspect * height)
    assert cooked_array.shape[1] == height
Exemplo n.º 4
0
def test_resize_1(array):
    """
    provide only width
    """
    width = 100
    aspect = array.shape[0] / array.shape[1]

    resize = Resize(width=width)
    cooked_array = resize.cook(array)

    assert cooked_array.shape[0] == width
    assert cooked_array.shape[1] == int(width / aspect)
Exemplo n.º 5
0
def test_resize_5(array):
    """
    provide height and scale
    """
    height = 100
    scale = 2
    aspect = array.shape[0] / array.shape[1]

    resize = Resize(height=height, scale=scale)
    cooked_array = resize.cook(array)

    assert cooked_array.shape[0] == int(height * aspect * scale)
    assert cooked_array.shape[1] == height * scale
Exemplo n.º 6
0
def test_resize_4(array):
    """
    provide width and scale
    """
    width = 100
    scale = 2
    aspect = array.shape[0] / array.shape[1]

    resize = Resize(width=width, scale=scale)
    cooked_array = resize.cook(array)

    assert cooked_array.shape[0] == scale * width
    assert cooked_array.shape[1] == int(scale * width / aspect)
Exemplo n.º 7
0
def test_resize_7(array):
    """
    provide height, width, and scale
    """
    width = 100
    height = 200
    scale = 2

    resize = Resize(width=width, height=height, scale=scale)
    cooked_array = resize.cook(array)

    assert cooked_array.shape[0] == width * scale
    assert cooked_array.shape[1] == height * scale