OpenCV imwrite 2.2 causes exception with message "OpenCV Error: Unspecified error (could not find a writer for the specified extension)" on Windows 7

Viewed 24894

I'm porting an OpenCV 2.2 app from Unix (that works) onto Windows 7 64-bit and I receive the following exception when cv::imwrite is called

"OpenCV Error: Unspecified error (could not find a writer for the specified extension) in unknown function, file highgui\src\loadsave.cpp"

The original unix app works fine on my Mac and Linux boxes.

Does anyone know what library or compiler config I could be missing that makes this work on Windows?

UPDATE:

I did the following things to get OpenCV running:

  • Downloaded the binaries for v2.2 from the OpenCV site for windows. I'm using 2.2 because the original app uses it and I don't want to complicate my build at this stage.
  • I am trying to imwrite to a .png file. I looked at the OpenCV code and noticed the necessity for external libs for Encoders such as Pngs or jpegs, so I tried writing to .ppm, .bmp which seems not to require deps, but I get the identical error.
  • An example of my usage is cv::imwrite("out.png", cv_scaled); where cv_scaled is of type cv::Mat with format CV_32FC1
  • Please remember the identical code works fine in unix

The fact .bmp or .ppm doesn't work this raises more questions:

  • Why don't these very simple formats work?
  • Is there a way to see a list of installed Encoders programmatically?

Thanks again for your kind assistance in helping me debug this problem.

3 Answers
Related