Cv :: imwrite could not find an entry for the specified extension

The following command throws an exception.

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

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

Exception with 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 an entry for the specified extension

According to this related thread, my current OpenCV installation does not support the image formats I tried. But I just downloaded the pre-compiled Windows infrastructure , as expected on the site.

How can I get jpg export?

+6
source share
8 answers

it sounds as if you were using a different runtime than the one you are compiling. Can you try the following? Download the dependency host and navigate to the executable directory and drag and drop the .exe file through the dependency host (http://www.dependencywalker.com/). It will show you which runtime libraries it uses. Now make sure you call the program with the appropriate environment. If you can, use the command line interface to invoke the program, it will make you feel safer to find out where the code is being called from, so you can be sure that your copied .dlls are being called.

Regards, Daniel

+6
source

I also ran into this problem and I noticed that this problem will occur when I use an image without any extension. for example abc.jpg , but I will rename it only abc .

+10
source

You need to recompile OpenCV and add support for the "jpeg" format. Get the latest opencv code and run cmake:

 svn co http://code.opencv.org/svn/opencv/trunk/opencv myopencvdir.svn/ cd myopencvdir.svn/ mkdir release cd release/ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. 

And check if libjpeg, libpng, libtiff are supported. If not, you need to install them and restart cmake.

Example cmake output that shows Media I / O support:

 -- Media I/O: -- ZLib: TRUE -- JPEG: TRUE -- PNG: TRUE -- TIFF: TRUE -- JPEG 2000: TRUE -- OpenEXR: YES 
0
source

Before you try anything else, make sure that you configure OpenCV and the VS project according to this answer and be careful not to mix OpenCV release libraries with library debugging.

There are a few things you can try:

  • Go to this page , follow the instructions to configure opensv 2.3.1 to step 2. (Use 32-bit mode)

  • Download the latest TBB for Windows from here .

  • Extract the zip TBB file and copy all the DLL files inside / bin / ia 32 / vc10 and all the DLL files to / bin / ia 32 / vc10 / irml in C: \ OpenCV 2.3.1 \ build \ x86 \ vc10 \ bin

Let us know how you did it.

0
source

I encountered the same runtime error "opencv error unspecified (could not find a writer for the specified extension)". I used the same solution as Pieter, that is, in project setup -> linker -> Input -> Aditional Dependencies, I pointed out to use the debug version of opencv libs to configure MSVS debugging and to specify to use the release version of opencv libs to configure the MSVS release. Then there is no runtime error.

0
source

Yes, it works for me.
For debugging, simply remove thoes *.lib left *d.lib (Property Pages/Linker/Input/Additional Dependencies) , just copy these *d.lib :

0
source

Except for some of the solutions above, you should check the name of your images. for me, the solution to my problem is to enter the command parameters incorrectly in Debug. I intended to output an image named 1.png, and this is the second parameter in main (), and the third parameter main () is a hexadecimal number such as 0x3f, and I mixed these two parameters, which means that I intend to output the image with the name 0x3f. That is why it is said that "the writer could not be found." screenshot of the wrong part of my problem, sorry for the Chinese, but there is a property → Configure Property → Debug → Command Parameters. :)

0
source

Just specify the format in which you want to save the image, for example image.jpg, image.jpeg

cv2.imwrite ('Image.jpg', image)

-2
source

Source: https://habr.com/ru/post/911652/


All Articles