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?
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)
imwrite will overwrite existing files without outputting an error or asking for confirmation. Image of any format can be saved using this method.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With