问题描述
我在运行这行代码时收到此错误:
I am recieving this error when running this line of code :
img=cv2.resize(img,(224,224))
OpenCV(4.1.2) C:\projects\opencv-python\opencv\modules\imgproc\src\resize.cpp:3720: error: (-215:Assertion failed) !ssize.empty() in function '简历::调整大小'
OpenCV(4.1.2) C:\projects\opencv-python\opencv\modules\imgproc\src\resize.cpp:3720: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'
推荐答案
您的 img
变量为空,您可能没有正确加载图像.加载图像后尝试打印 img.shape
.然后看看你指定的路径,它可能有问题.(要么拼写错误,要么该目录中不存在该文件)
Your img
variable is empty, you probably didn't load the image correctly. Try printing your img.shape
after you load your image. Then have a look at the path you specified, there is probably something wrong with it. (Either you misspelled something or the file doesn't exist in that directory)
这篇关于OpenCV(4.1.2) 错误:(-215:Assertion failed) !ssize.empty() in function 'cv::resize'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!