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_

出现这种错误的原因大部分是因为要保存的图片没有加后缀

*.jpg
/
*.png

OpenCV Error: Unspecified error (could not find a writer for the specified extension) in imwrite_第1张图片
类似这种情况的!
这是我写的一个qt-opencv的程序报的错
在这里插入图片描述

你可能感兴趣的:(开发语言-c++,QT相关学习,计算机视觉-opencv,计算机视觉)