EB97
EB97

Reputation: 89

cv2.error: OpenCV(4.5.2) C:\Users\ ... \modules\imgproc\src\resize.cpp:3929: error: (-215:Assertion failed) func != 0 in function 'cv::hal::resize'

I tried to run the following code:

a = np.array([[1,0],[0,0]])
a = cv2.resize(a , (400,400))
cv2.imshow('Image', a)
cv2.waitKey(0)
cv2.destroyAllWindows

and got this error:

cv2.error: OpenCV(4.5.2) C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-_8k9tw8n\opencv\modules\imgproc\src\resize.cpp:3929: error: (-215:Assertion failed) func != 0 in function 'cv::hal::resize'

couldn't find any similar question

Upvotes: 1

Views: 11663

Answers (2)

Ludo Schmidt
Ludo Schmidt

Reputation: 1423

Changing the type of you array a to float fix the issue.

a = cv2.resize(a.astype(float) , (400,400))

enter image description here

Upvotes: 0

jeff style
jeff style

Reputation: 81

the error is from the resize function, it needs to be a dtype=uint8 type array. there is a pretty solid answer here

update me if it worked :)

Upvotes: 5

Related Questions