Skip to content

resize method doesn't work properly #452

Open
@targos

Description

@targos

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:

test.skip('compare result of resize with opencv (nearest)', () => {
const img = testUtils.load('opencv/test.png');
const resized = img.resize({
xFactor: 10,
yFactor: 10,
interpolationType: 'nearest',
});
expect(resized).toMatchImage('opencv/testResizeNearest.png');
});
test.skip('compare result of resize with opencv (bilinear)', () => {
const img = testUtils.load('opencv/test.png');
const resized = img.resize({
xFactor: 10,
yFactor: 10,
});

Reference created by

# Image resizing by 10.
dst = cv.resize(img, (80, 100), interpolation=cv.INTER_NEAREST)
cv.imwrite('testResizeNearest.png', dst)
dst = cv.resize(img, (80, 100), interpolation=cv.INTER_LINEAR)
cv.imwrite('testResizeBilinear.png', dst)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions