使用OpenCV 2.4.10和Python 2.7.10进行大小调整错误

ang*_*ela 5 python opencv image-processing

我正在尝试使用OpenCV 2.4.10和Python 2.7.10调整图像的大小。

这有效:

resized_patch = cv2.resize(patch, (3, 50, 50))
Run Code Online (Sandbox Code Playgroud)

但是,我对使用INTER_AREA插值感兴趣。按照Python文档,我尝试了:

dst = numpy.zeros((3, 50, 50))
resized_patch = cv2.resize(patch, (3, 50, 50), dst=dst, fx=0, fy=0, interpolation=cv2.INTER_AREA)
Run Code Online (Sandbox Code Playgroud)

但是,我从cv2.resize行中得到的错误是:

TypeError: 'function takes exactly 2 arguments (3 given)'
Run Code Online (Sandbox Code Playgroud)

有什么线索吗?

Kas*_*mvd 6

您需要使用 2D 尺寸而dst.size()不是 3D :

resized_patch = cv2.resize(patch, (3, 50, 50), dst=dst, fx=0, fy=0, interpolation=cv2.INTER_AREA)
                                      ^^^ #here 
Run Code Online (Sandbox Code Playgroud)