【发布时间】:2017-09-01 07:27:07
【问题描述】:
我已经安装了 opencv 1.0.1 版,当我使用 cv2.imwrite() 方法时,它会抛出以下错误
OpenCV Error: Unspecified error (could not find a writer for the
specified extension) in imwrite_, file
/io/opencv/modules/imgcodecs/src/loadsave.cpp, line 604 Traceback
(most recent call last): File "scan.py", line 78, in <module>
findContours(image,screenCnt,orig,ratio,outputPath) File /home/Verchaska/dev/aneesh/contours.py", line 26, in findContours
cv2.imwrite(filename,warped) cv2.error: /io/opencv/modules/imgcodecs/src/loadsave.cpp:604: error: (-2) could
not find a writer for the specified extension in function imwrite_
【问题讨论】:
-
在
cv2.imwrite()之前使用print filename,看看你是否传递了一个有效的extension -
是的,我检查过了,我正在传递“.jpg”扩展名
-
使用
.png扩展名或其他可能的扩展名尝试一次。 -
版本 1.0.1?真的吗?为什么要使用这个过时的版本?
-
请分享您正在使用的示例代码