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

created at 10-27-2021 views: 22

error

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_

reason and solution

The reason for this error is mostly because the picture to be saved is not suffixed

Because the image name is not added to the save address I set...

os.path.basename() can get the individual file name

created at:10-27-2021
edited at: 10-27-2021: