mirror of https://github.com/opencv/opencv.git
Open Source Computer Vision Library
https://opencv.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.0 KiB
52 lines
1.0 KiB
// |
|
// This file is auto-generated. Please don't modify it! |
|
// |
|
|
|
#undef LOG_TAG |
|
|
|
#include "opencv2/opencv_modules.hpp" |
|
#ifdef HAVE_OPENCV_$M |
|
|
|
#include <string> |
|
|
|
#include "opencv2/$m.hpp" |
|
|
|
$includes |
|
|
|
#define LOG_TAG "org.opencv.$m" |
|
#include "common.h" |
|
|
|
using namespace cv; |
|
|
|
/// throw java exception |
|
#undef throwJavaException |
|
#define throwJavaException throwJavaException_$m |
|
static void throwJavaException(JNIEnv *env, const std::exception *e, const char *method) { |
|
std::string what = "unknown exception"; |
|
jclass je = 0; |
|
|
|
if(e) { |
|
std::string exception_type = "std::exception"; |
|
|
|
if(dynamic_cast<const cv::Exception*>(e)) { |
|
exception_type = "cv::Exception"; |
|
je = env->FindClass("org/opencv/core/CvException"); |
|
} |
|
|
|
what = exception_type + ": " + e->what(); |
|
} |
|
|
|
if(!je) je = env->FindClass("java/lang/Exception"); |
|
env->ThrowNew(je, what.c_str()); |
|
|
|
LOGE("%s caught %s", method, what.c_str()); |
|
(void)method; // avoid "unused" warning |
|
} |
|
|
|
extern "C" { |
|
|
|
$code |
|
|
|
} // extern "C" |
|
|
|
#endif // HAVE_OPENCV_$M
|
|
|