c++ - OUTDATED - Error modes for OpenCV -
I am using OpenCV 1 to perform some image processing, and the cvSetErrMode function (which is part of CxCore) Is confused about.
OpenCV has three error modes
- Address: The error is called the handler after the program is terminated.
- Parent: The program is not terminated, but the error handler is called.
- Silence: Similar to the original mode, but no error handler is called
At the beginning of my code, I switch to the default cvSetErrMode (CV_ErrModeParent) Calling 'Leaf Mode' in parent mode 'My application has not been terminated with an exception / claim pop up Unfortunately' parent 'mode is not working. I still get the message dialog pop up, and my application still ends.
If I call cvSetErrMode (CV_ErrModeSilent) then it actually gets silent, and now leaves the application or throws a dialogue ... but this also means that I do not I know there was an error. In this situation, I think the method is being set correctly.
Can anyone else suggest any solutions before this behavior?
Reference:
I am going to answer my own question, because what has happened to me after being negligible around me.
When you switch to 'Parent' mode instead of the Leaf mode, there is an error handler called cvGuiBoxReport () which is the default error handler. It seems that even in the original mode, CvGuiBoxReport () still ends your application! Oh, is that so.
So, to move around you can write your own error handler, and you can redirect to handle the error and not end the application.
Example error handler:
int MyErrorHandler (int position, const char * func_name, const char * err_msg, const char * file_name, int line, zero *) {std :: cerr & lt; & Lt; "Wow, my own custom error handler" & lt; & Lt; Std :: endl; Return 0; }
You can set the original mode and redirect your error this way:
cvSetErrMode (CV_ErrModeParent); CvRedirectError (MyErrorHandler);
Comments
Post a Comment