use*_*974 5 python opencv downsampling
resize我对使用插值时OpenCV 函数的工作范围有疑问INTER_AREA。以下是三种不同的插值:
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'
Run Code Online (Sandbox Code Playgroud)
前两个工作正常,但最后一个失败。为什么会这样呢?什么样的输入/输出形状组合是可以接受的?
(请注意,该问题特定于INTER_AREA,因为其他插值方案似乎适用于所有三种情况)。
| 归档时间: |
|
| 查看次数: |
3205 次 |
| 最近记录: |