Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Nearest neighbor interpolation does not give expected results #9096

@gerhardneuhold

Description

@gerhardneuhold
System information (version)
  • OpenCV => 2.4.9
  • Operating System / Platform => Ubuntu 16.04
  • Compiler => gcc 5.4.0
Detailed description

Nearest neighbor interpolation using cv2.resize does not give expected results.

Steps to reproduce
import cv2
import numpy as np

a = np.array([[0, 1, 2, 3, 4]], dtype=np.uint8)
print 'nearest', cv2.resize(a, dsize=(3, 1), interpolation=cv2.INTER_NEAREST)

gives

nearest [[0 1 3]]

expected

nearest [[0 2 4]]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions