File: test_resize.py

package info (click to toggle)
python-imgviz 1.2.4%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 9,268 kB
  • sloc: python: 3,032; makefile: 15
file content (23 lines) | stat: -rw-r--r-- 574 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import numpy as np

import imgviz


def test_resize():
    img = np.random.uniform(0, 255, size=(15, 25, 3)).round().astype(np.uint8)

    dst = imgviz.resize(img, height=12)
    assert dst.shape == (12, 20, 3)
    assert dst.dtype == np.uint8

    dst = imgviz.resize(img, width=20)
    assert dst.shape == (12, 20, 3)
    assert dst.dtype == np.uint8

    dst = imgviz.resize(img, height=0.8)
    assert dst.shape == (12, 20, 3)
    assert dst.dtype == np.uint8

    dst = imgviz.resize(img, width=0.8)
    assert dst.shape == (12, 20, 3)
    assert dst.dtype == np.uint8