I believe that there is a bug in cv2.resize in conjunction with INTER_AREA interpolation, but I wanted to ask here first just in case I missed something in the docs. My question is: Is this a bug or where is this behavior documented?
Resizing a 3x1 image to 1x2 should produce two pixels where the value of both is equal to the average of the 3 pixels, but that does not seem to be the case.
3x1 input Image: [[0.1, 0.2, 0.3]]
Resized to 1x1: [[(0.1 + 0.2 + 0.3) / 3]] = [[0.2]] (works correctly as expected)
Expected result when resizing to 1x2:
Actual result when resizing to 1x2:
import numpy as np
src = np.float64([[0.1, 0.2, 0.3]])
print("Resized to 1x1:\n")
print(cv2.resize(src, (1, 1), interpolation=cv2.INTER_AREA))
print("\nResized to 1x2:\n")
print(cv2.resize(src, (1, 2), interpolation=cv2.INTER_AREA))