I have a question about the working domain of OpenCV's resize
function when using the INTER_AREA
interpolation. Here are three different interpolations:
import cv2
import numpy as np
cv2.resize(np.zeros((17, 99, 99), dtype=np.uint8), (64, 32), interpolation=cv2.INTER_AREA)
# OK
cv2.resize(np.zeros((200, 64, 4), dtype=np.uint8), (64, 32), interpolation=cv2.INTER_AREA)
# OK
cv2.resize(np.zeros((200, 64, 64), dtype=np.uint8), (64, 32), interpolation=cv2.INTER_AREA)
# error: OpenCV(4.1.1) ..\modules\imgproc\src\resize.cpp:3557: error: (-215:Assertion failed) func != 0 && cn <= 4 in function 'cv::hal::resize'
The first two works OK, but the last one fails. Why would that be? What combination of input/output shape is acceptable?
(Note that the question is specific to INTER_AREA
, as other interpolation schemes seem to work in all three cases).