Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cv::imwrite could not find a writer for the specified extension

Tags:

opencv

The following command causes an exception.

cv::imwrite("test.jpg", diffImg); 

I also tried numerous variations on this, including absolute paths and PNG export. Here's the error:

Exception at 0x75abd36f, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) in opencv_core231!cv::error

C:\slave\WinInstallerMegaPack\src\opencv\modules\highgui\src\loadsave.cpp:276: error: (-2) could not find a writer for the specified extension

According to this related thread my current OpenCV installation doesn't support the image formats I tried. But I merely downloaded the precompiled Windows framework like their site suggested.

How can I get JPG export working?

like image 845
Pieter Avatar asked Mar 26 '12 08:03

Pieter


People also ask

What is Imwrite in OpenCV?

OpenCV-Python is a library of Python bindings designed to solve computer vision problems. cv2. imwrite() method is used to save an image to any storage device. This will save the image according to the specified format in current working directory. Syntax: cv2.imwrite(filename, image)

Does cv2 Imwrite overwrite Python?

imwrite will overwrite existing files without outputting an error or asking for confirmation. Image of any format can be saved using this method.


1 Answers

I have also faced this issue and I have observed that this issue will come when I use the image without any extension. like abc.jpg but I rename it abc only.

You must use an image name with extension.

like image 183
NIrav Modi Avatar answered Nov 13 '22 12:11

NIrav Modi