opencv-python
opencv-python copied to clipboard
PYTHON cv2.resize Error “(-215:Assertion failed) !dsize.empty()”
I am trying to resize an image with cv2.resize function in PYTHON3 and I get the following error:
error: OpenCV(4.5.1) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-oduouqig\opencv\modules\imgproc\src\resize.cpp:3688: error: (-215:Assertion failed) !dsize.empty() in function 'cv::hal::resize'
My images are uint16 arrays:
img_ms.shape (4, 57, 62)
img_pan.shape (1, 1140, 1240)
The sample function I am using inside an image pansharpening script is:
downsampled_img_pan = cv2.resize(img_pan, (img_ms.shape[2], img_ms.shape[1]), interpolation = cv2.INTER_AREA)[:, :, np.newaxis]
Thanks!
I dont think will work since you cannot convert a 4D img into 1D like this.
last dim must be lower than 512. but 1240 > 512