| 1 | import numpy as np |
| 2 | |
| 3 | import imgviz |
| 4 | |
| 5 | |
| 6 | def test_resize(): |
| 7 | img = np.random.uniform(0, 255, size=(15, 25, 3)).round().astype(np.uint8) |
| 8 | |
| 9 | dst = imgviz.resize(img, height=12) |
| 10 | assert dst.shape == (12, 20, 3) |
| 11 | assert dst.dtype == np.uint8 |
| 12 | |
| 13 | dst = imgviz.resize(img, width=20) |
| 14 | assert dst.shape == (12, 20, 3) |
| 15 | assert dst.dtype == np.uint8 |
| 16 | |
| 17 | dst = imgviz.resize(img, height=0.8) |
| 18 | assert dst.shape == (12, 20, 3) |
| 19 | assert dst.dtype == np.uint8 |
| 20 | |
| 21 | dst = imgviz.resize(img, width=0.8) |
| 22 | assert dst.shape == (12, 20, 3) |
| 23 | assert dst.dtype == np.uint8 |