Please present a MRE that requires OpenCV to cause the issue. If this can be reproduced with any other library that throws exceptions (even a self-made dummy one), it’s not an OpenCV issue.
Otherwise, please take this to a C++ forum. This is the OpenCV forum.
I am asking a question about compiling openCV–this is related to open CV because I am able to use other OSS without issues. Are there any CMake settings that I need to use?
OpenCV(4.8.0) Error: Unspecified error (could not find encoder for the specified extension) in imencode, file /path/to/opencv/modules/imgcodecs/src/loadsave.cpp, line 985
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.8.0)
/path/to/opencv/modules/imgcodecs/src/loadsave.cpp:985: error: (-2:Unspecified error) could not find encoder for the specified extension in function 'imencode'
/usr/local/bin/runcmdfile[43]: .: line 76: 21316: Abort(coredump)
The main code is compiled with gcc 9.2 and linked statically with openCV.
Yes the I am calling it with invalid arguments and it should be caught with the try-catch. It seems like you don’t have the expertise to solve this issue. I will try elsewhere.
This is what you linked to in your first post, commenting “almost identical to”. It does not require OpenCV.
It does seem to involve an old version of GCC (why?) and the program being run under gcov, i.e. an instrumented build or debugging context. You didn’t suspect either of those so far.
I hope you’ll get your answer. I wouldn’t bet on it though.