How to specify a custom output size in cv2.pyrDown() or cv2.pyrUp() method
I want to explicitly specify the output size of the image when applying cv2.pyrDown() on images.
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
But it is throwing an error something similar to this.
OpenCV Error: Assertion failed (ssize.width > 0 && ssize.height > 0 && std::abs(dsize.width*2 - ssize.width) <= 2 && std::abs(dsize.height*2 - ssize.height) <= 2) in pyrDown_, file /io/opencv/modules/imgproc/src/pyramids.cpp, line 873
Any idea how to specify the output size of the image as a method argument?