我想在对图像应用cv2.pyrDown()时显式指定图像的输出大小。在
def gaussian_pyramid(image, scale=1.5, minSize=(30, 30)):
yield image
while True:
w = int(image.shape[1] / scale)
h = int(image.shape[0] / scale)
image = cv2.pyrDown(image, dstsize=(w, h))
if image.shape[0] < minSize[1] or image.shape[1] < minSize[0]:
break
yield image
但它抛出了一个与此类似的错误。在
^{pr2}$知道如何将图像的输出大小指定为方法参数吗。在
来自OpenCV 2.4教程:
这是从C++教程中获取的,但对于Python来说应该是一样的。在
对不起,我忘了给你正确的答案。在
pyrdown,pyrup的系数是2。因此,要计算奇数大小,我们必须调整
dstsize
是+1像素。在相关问题 更多 >
编程相关推荐