cv_exception.cpp 903 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * file: exception.cpp
  3. * author: Hilton Bristow
  4. * date: Wed, 19 Jun 2013 11:15:15
  5. *
  6. * See LICENCE for full modification and redistribution details.
  7. * Copyright 2013 The OpenCV Foundation
  8. */
  9. #include <exception>
  10. #include <opencv2/core.hpp>
  11. #include "mex.h"
  12. /*
  13. * exception
  14. * Gateway routine
  15. * nlhs - number of return arguments
  16. * plhs - pointers to return arguments
  17. * nrhs - number of input arguments
  18. * prhs - pointers to input arguments
  19. */
  20. void mexFunction(int nlhs, mxArray* plhs[],
  21. int nrhs, const mxArray* prhs[]) {
  22. // call the opencv function
  23. // [out =] namespace.fun(src1, ..., srcn, dst1, ..., dstn, opt1, ..., optn);
  24. try {
  25. throw cv::Exception(-1, "OpenCV exception thrown", __func__, __FILE__, __LINE__);
  26. } catch(const cv::Exception& e) {
  27. mexErrMsgTxt(e.what());
  28. } catch(...) {
  29. mexErrMsgTxt("Incorrect exception caught!");
  30. }
  31. }