opencv / opencv/opencv-python

PYTHON cv2.resize Error “(-215:Assertion failed) !dsize.empty()”

Open
#450 2 comments 1 reaction 1 assignee View on GitHub

@AleksandrPanov is already working on this.

Since Oct 21, 2021.

Dominant language
Python
Stars
5.4k
Forks
1k
Avg merge
22h 17m
Merged PRs (30d)
3

Description

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!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.