OpenCV Error: Unspecified error (could not find a writer for the specified extension) in imwrite


OpenCV(3.4.1) Error: Unspecified error (could not find a writer for the specified extension) in imwrite_, file /home/caros/Downloads/opencv-3.4.1/modules/imgcodecs/src/loadsave.cpp, line 678
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(3.4.1) /home/caros/Downloads/opencv-3.4.1/modules/imgcodecs/src/loadsave.cpp:678: error: (-2) could not find a writer for the specified extension in function imwrite_

出現這種錯誤的原因大部分是因為要保存的圖片沒有加后綴

因為我設置的保存地址中沒有加上圖片名稱...

os.path.basename()可以獲取單獨的文件名稱


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM