Skip to content

Commit 8d81c2b

Browse files
authored
test: add simpler resize test with nearest interpolation (#451)
1 parent 6267d8a commit 8d81c2b

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

Diff for: src/geometry/__tests__/resize.test.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
import { encodePng } from '../../save';
22

3-
test.skip('compares result of resize with opencv', () => {
3+
test.skip('compare result of resize with opencv (nearest)', () => {
4+
const img = testUtils.load('opencv/test.png');
5+
6+
const resized = img.resize({
7+
xFactor: 10,
8+
yFactor: 10,
9+
interpolationType: 'nearest',
10+
});
11+
12+
expect(resized).toMatchImage('opencv/testResizeNearest.png');
13+
});
14+
15+
test.skip('compare result of resize with opencv (bilinear)', () => {
416
const img = testUtils.load('opencv/test.png');
517

618
const resized = img.resize({

Diff for: test/TestImagePath.ts

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export type TestImagePath =
3636
| 'opencv/testRotateBilinear.png'
3737
| 'opencv/testTranslate.png'
3838
| 'opencv/testResizeBilinear.png'
39+
| 'opencv/testResizeNearest.png'
3940
| 'opencv/testAntiClockwiseRot90.png'
4041
| 'opencv/testClockwiseRot90.png'
4142
| 'opencv/testScale.png'

Diff for: test/img/opencv/generate.py

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
cv.imwrite('testScale.png', dst)
1414

1515
# Image resizing by 10.
16+
dst = cv.resize(img, (80, 100), interpolation=cv.INTER_NEAREST)
17+
cv.imwrite('testResizeNearest.png', dst)
1618
dst = cv.resize(img, (80, 100), interpolation=cv.INTER_LINEAR)
1719
cv.imwrite('testResizeBilinear.png', dst)
1820

Diff for: test/img/opencv/testResizeNearest.png

737 Bytes
Loading

0 commit comments

Comments
 (0)