Skip to content

nearest_aligned is not aligned #62

@awused

Description

@awused

When using nearest_aligned the output is noticeably shifted down and to the right. This affects my models severely and causes noticeable warping in their output.

I used this code in augmentations.py to produce the output images:

if __name__ == '__main__':
    img = cv2.imread('test.png')
    img_A, _ = Scale(img=img, scale=4, algo=997, ds_kernel=None, img_type='cv2')
    cv2.imwrite('output.png', img_A)

original image

Output from nearest_aligned as per the above code:
output

Output from convert test.png -interpolate Average -filter point -resize 25% magick-nearest.png:
magick-nearest

Explicitly sampling the top left corner closely matches the offset from nearest_aligned:
convert test.png -define sample:offset=0%x0% -sample 25% magick-sampled-top-left.png
magick-sampled-top-left

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions