Open targos opened 3 months ago
Current result:
diff --git a/src/geometry/__tests__/resize.test.ts b/src/geometry/__tests__/resize.test.ts
index df8c0e21..d95281d8 100644
--- a/src/geometry/__tests__/resize.test.ts
+++ b/src/geometry/__tests__/resize.test.ts
@@ -1,6 +1,6 @@
-import { encodePng } from '../../save';
+import { encodePng, writeSync } from '../../save';
-test.skip('compare result of resize with opencv (nearest)', () => {
+test('compare result of resize with opencv (nearest)', () => {
const img = testUtils.load('opencv/test.png');
const resized = img.resize({
@@ -9,6 +9,8 @@ test.skip('compare result of resize with opencv (nearest)', () => {
interpolationType: 'nearest',
});
+ writeSync('test.png', resized);
+
expect(resized).toMatchImage('opencv/testResizeNearest.png');
});
For further improvements, we should probably look at: https://github.com/opencv/opencv/blob/26a5730f0d36f547a6eaf39b1e15786ea3f0d039/modules/imgproc/src/opencl/resize.cl
It somehow "zooms" in the image. This is especially visible on the nearest-neighbor version of the test.
There's probably a bug in how we iterate on the pixels. Implementation: https://github.com/image-js/image-js-typescript/blob/main/src/geometry/resize.ts#L55-L86
We need to fix it so these tests can be enabled: https://github.com/image-js/image-js-typescript/blob/8d81c2b4094c25522b9c40aec4b6469837123352/src/geometry/__tests__/resize.test.ts#L3-L21
Reference created by https://github.com/image-js/image-js-typescript/blob/8d81c2b4094c25522b9c40aec4b6469837123352/test/img/opencv/generate.py#L15-L19