本文主要是介绍cv2.error: (-215:Assertion failed) encoder->isFormatSupported(CV_8U) in function ‘imwrite_‘,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
OpenCV报错
cv2.error: OpenCV(4.5.1) /private/var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/pip-req-build-39p1qqfs/opencv/modules/imgcodecs/src/loadsave.cpp:694: error: (-215:Assertion failed) encoder->isFormatSupported(CV_8U) in function ‘imwrite_’
- 首先检查路径是否有误
- 检查图片类型,如,对于exr后缀的图片,float64无法保存
解决方案:
img = img.astype(np.float32)
这篇关于cv2.error: (-215:Assertion failed) encoder->isFormatSupported(CV_8U) in function ‘imwrite_‘的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!