Robotics StackExchange | Archived questions

Fix for - OpenCV Error:Unspeicifed Error -

error:

OpenCV Error: Unspecified error (could not find a writer for the specified extension) in imwrite_, file /temp/binarydeb/ros-kinetic-opencv3-3.2.0/modules/imgcodecs/src/loadsave.cpp, line 531
terminate called after throwing an instance of 'cv::Exception'

  what():  /temp/binarydeb/ros-kinetic-opencv3-3.2.0/modules/imgcodecs/src/loadsave.cpp, line 531: error: (-2) could not find a writer for the specified extension in function imwrite_

Aborted(core dumped)

while running my application i am facing openCE Error and my code is getting core dumped and halting my code execution , please provide fix for this issue asap.

Here is the code snippet.

           vector<int> compression_params; //vector that stores the compression parameters of the image

    compression_params.push_back(CV_IMWRITE_JPEG_QUALITY); //specify the compression technique

    compression_params.push_back(98); //specify the compression quality

    bool bSuccess = imwrite(jpegImage.c_str(), img, compression_params); //exception is received here

Below is the jpegImage name with .jpg extension .

string socket_server::jpegImage = "TestImage.jpg";

Regards Anjaneyulu

Asked by can-43811 on 2017-08-11 07:47:29 UTC

Comments

Answers

Sharing the source code where it gives an error will help to identify the problem.!

But from the error "could not find a writer for the specified extension in function imwrite_", I expect that you might not have given the type of image in the imwrite (for instance .png or .jpg) this tells imwrite how to save the image.

Asked by sumanth on 2017-08-11 13:47:44 UTC

Comments

I have updated the question with more info . kindly check

Asked by can-43811 on 2017-08-12 03:22:45 UTC