mirror of
https://github.com/opencv/opencv.git
synced 2026-09-29 04:09:43 +03:00
refactored throwJavaException() and removed useless returns
This commit is contained in:
1 parent
925e4eec98
commit
70930a30a1
1 file changed
+327
-486
@@ -7,61 +7,28 @@
|
||||
|
||||
using namespace cv;
|
||||
|
||||
/// throw java exception from std::exception, no logging
|
||||
static const char *throwJavaException(JNIEnv *env, const std::exception &e);
|
||||
static const char *throwJavaException(JNIEnv *env, const std::exception &e) {
|
||||
const char *exception_str = "std::exception";
|
||||
/// throw java exception
|
||||
static void throwJavaException(JNIEnv *env, const std::exception *e, const char *method);
|
||||
static void throwJavaException(JNIEnv *env, const std::exception *e, const char *method) {
|
||||
std::string what = "unknown exception";
|
||||
jclass je = 0;
|
||||
|
||||
if(dynamic_cast<const cv::Exception*>(&e)) {
|
||||
exception_str = "cv::Exception";
|
||||
je = env->FindClass("org/opencv/core/CvException");
|
||||
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, e.what());
|
||||
return exception_str;
|
||||
}
|
||||
|
||||
/// throw java exception from unknown exception, no logging
|
||||
static void throwJavaException(JNIEnv *env);
|
||||
static void throwJavaException(JNIEnv *env) {
|
||||
jclass je = env->FindClass("java/lang/Exception");
|
||||
env->ThrowNew(je, "unknown exception");
|
||||
}
|
||||
|
||||
/// throw java exception from std::exception, use LOGD
|
||||
static void throwJavaExceptionD(JNIEnv *env, const std::exception &e, const char *method);
|
||||
static void throwJavaExceptionD(JNIEnv *env, const std::exception &e, const char *method) {
|
||||
const char *exception_str = throwJavaException(env, e);
|
||||
LOGD("%s caught %s: %s", method, exception_str, e.what());
|
||||
env->ThrowNew(je, what.c_str());
|
||||
|
||||
LOGE("%s caught %s", method, what.c_str());
|
||||
(void)method; // avoid "unused" warning
|
||||
(void)exception_str; // avoid "unused" warning
|
||||
}
|
||||
|
||||
/// throw java exception from unknown exception, use LOGD
|
||||
static void throwJavaExceptionD(JNIEnv *env, const char *method);
|
||||
static void throwJavaExceptionD(JNIEnv *env, const char *method) {
|
||||
throwJavaException(env);
|
||||
LOGD("%s caught unknown exception (...)", method);
|
||||
(void)method; // avoid "unused" warning
|
||||
}
|
||||
|
||||
/// throw java exception from std::exception, use LOGE
|
||||
static void throwJavaExceptionE(JNIEnv *env, const std::exception &e, const char *method);
|
||||
static void throwJavaExceptionE(JNIEnv *env, const std::exception &e, const char *method) {
|
||||
const char *exception_str = throwJavaException(env, e);
|
||||
LOGE("%s caught %s: %s", method, exception_str, e.what());
|
||||
(void)method; // avoid "unused" warning
|
||||
(void)exception_str; // avoid "unused" warning
|
||||
}
|
||||
|
||||
/// throw java exception from unknown exception, use LOGE
|
||||
static void throwJavaExceptionE(JNIEnv *env, const char *method);
|
||||
static void throwJavaExceptionE(JNIEnv *env, const char *method) {
|
||||
throwJavaException(env);
|
||||
LOGE("%s caught unknown exception (...)", method);
|
||||
(void)method; // avoid "unused" warning
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
@@ -97,17 +64,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__III
|
||||
static const char method_name[] = "Mat::n_1Mat__III()";
|
||||
try {
|
||||
LOGD(method_name);
|
||||
|
||||
Mat* _retval_ = new Mat( rows, cols, type );
|
||||
|
||||
return (jlong) _retval_;
|
||||
return (jlong) new Mat( rows, cols, type );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -126,16 +90,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__DDI
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Size size((int)size_width, (int)size_height);
|
||||
Mat* _retval_ = new Mat( size, type );
|
||||
|
||||
return (jlong) _retval_;
|
||||
return (jlong) new Mat( size, type );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -155,16 +117,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__IIIDDDD
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Scalar s(s_val0, s_val1, s_val2, s_val3);
|
||||
Mat* _retval_ = new Mat( rows, cols, type, s );
|
||||
|
||||
return (jlong) _retval_;
|
||||
return (jlong) new Mat( rows, cols, type, s );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -184,16 +144,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__DDIDDDD
|
||||
LOGD(method_name);
|
||||
Size size((int)size_width, (int)size_height);
|
||||
Scalar s(s_val0, s_val1, s_val2, s_val3);
|
||||
Mat* _retval_ = new Mat( size, type, s );
|
||||
|
||||
return (jlong) _retval_;
|
||||
return (jlong) new Mat( size, type, s );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -213,16 +171,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__JIIII
|
||||
LOGD(method_name);
|
||||
Range rowRange(rowRange_start, rowRange_end);
|
||||
Range colRange(colRange_start, colRange_end);
|
||||
Mat* _retval_ = new Mat( (*(Mat*)m_nativeObj), rowRange, colRange );
|
||||
|
||||
return (jlong) _retval_;
|
||||
return (jlong) new Mat( (*(Mat*)m_nativeObj), rowRange, colRange );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -237,16 +193,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__JII
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Range rowRange(rowRange_start, rowRange_end);
|
||||
Mat* _retval_ = new Mat( (*(Mat*)m_nativeObj), rowRange );
|
||||
|
||||
return (jlong) _retval_;
|
||||
return (jlong) new Mat( (*(Mat*)m_nativeObj), rowRange );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -265,15 +219,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1adjustROI
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat _retval_ = me->adjustROI( dtop, dbottom, dleft, dright );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -293,14 +246,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1assignTo__JJI
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
me->assignTo( (*(Mat*)m_nativeObj), type );
|
||||
|
||||
return;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,14 +265,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1assignTo__JJ
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
me->assignTo( (*(Mat*)m_nativeObj) );
|
||||
|
||||
return;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,16 +288,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1channels
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
int _retval_ = me->channels( );
|
||||
|
||||
return _retval_;
|
||||
return me->channels( );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -371,16 +314,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JIIZ
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
int _retval_ = me->checkVector( elemChannels, depth, requireContinuous );
|
||||
|
||||
return _retval_;
|
||||
return me->checkVector( elemChannels, depth, requireContinuous );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -395,16 +336,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JII
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
int _retval_ = me->checkVector( elemChannels, depth );
|
||||
|
||||
return _retval_;
|
||||
return me->checkVector( elemChannels, depth );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -419,16 +358,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JI
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
int _retval_ = me->checkVector( elemChannels );
|
||||
|
||||
return _retval_;
|
||||
return me->checkVector( elemChannels );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -449,15 +386,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1clone
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat _retval_ = me->clone( );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -477,15 +413,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1col
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat _retval_ = me->col( x );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -505,15 +440,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1colRange
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat _retval_ = me->colRange( startcol, endcol );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -532,16 +466,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1dims
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
int _retval_ = me->dims;
|
||||
|
||||
return _retval_;
|
||||
return me->dims;
|
||||
} catch(cv::Exception e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -560,16 +492,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1cols
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
int _retval_ = me->cols;
|
||||
|
||||
return _retval_;
|
||||
return me->cols;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -590,14 +520,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJIDD
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat& m = *((Mat*)m_nativeObj);
|
||||
me->convertTo( m, rtype, alpha, beta );
|
||||
|
||||
return;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -614,14 +540,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJID
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat& m = *((Mat*)m_nativeObj);
|
||||
me->convertTo( m, rtype, alpha );
|
||||
|
||||
return;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -638,14 +560,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJI
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat& m = *((Mat*)m_nativeObj);
|
||||
me->convertTo( m, rtype );
|
||||
|
||||
return;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -667,14 +585,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1copyTo__JJ
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat& m = *((Mat*)m_nativeObj);
|
||||
me->copyTo( m );
|
||||
|
||||
return;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -697,14 +611,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1copyTo__JJJ
|
||||
Mat& m = *((Mat*)m_nativeObj);
|
||||
Mat& mask = *((Mat*)mask_nativeObj);
|
||||
me->copyTo( m, mask );
|
||||
|
||||
return;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -725,14 +635,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1create__JIII
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
me->create( rows, cols, type );
|
||||
|
||||
return;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -754,14 +660,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1create__JDDI
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Size size((int)size_width, (int)size_height);
|
||||
me->create( size, type );
|
||||
|
||||
return;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -783,15 +685,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1cross
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat& m = *((Mat*)m_nativeObj);
|
||||
Mat _retval_ = me->cross( m );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -827,16 +728,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1depth
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
int _retval_ = me->depth( );
|
||||
|
||||
return _retval_;
|
||||
return me->depth( );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -856,15 +755,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1diag__JI
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat _retval_ = me->diag( d );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -883,17 +781,15 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1diag__J
|
||||
static const char method_name[] = "Mat::n_1diag__J()";
|
||||
try {
|
||||
LOGD(method_name);
|
||||
|
||||
Mat _retval_ = Mat::diag( (*(Mat*)d_nativeObj) );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -913,16 +809,14 @@ JNIEXPORT jdouble JNICALL Java_org_opencv_core_Mat_n_1dot
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat& m = *((Mat*)m_nativeObj);
|
||||
double _retval_ = me->dot( m );
|
||||
|
||||
return _retval_;
|
||||
return me->dot( m );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -941,16 +835,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1elemSize
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
size_t _retval_ = me->elemSize( );
|
||||
|
||||
return _retval_;
|
||||
return me->elemSize( );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -969,16 +861,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1elemSize1
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
size_t _retval_ = me->elemSize1( );
|
||||
|
||||
return _retval_;
|
||||
return me->elemSize1( );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -997,16 +887,14 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1empty
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
bool _retval_ = me->empty( );
|
||||
|
||||
return _retval_;
|
||||
return me->empty( );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1024,17 +912,15 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1eye__III
|
||||
static const char method_name[] = "Mat::n_1eye__III()";
|
||||
try {
|
||||
LOGD(method_name);
|
||||
|
||||
Mat _retval_ = Mat::eye( rows, cols, type );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1054,15 +940,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1eye__DDI
|
||||
LOGD(method_name);
|
||||
Size size((int)size_width, (int)size_height);
|
||||
Mat _retval_ = Mat::eye( size, type );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1082,15 +967,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1inv__JI
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat _retval_ = me->inv( method );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1105,15 +989,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1inv__J
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat _retval_ = me->inv( );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1132,16 +1015,14 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1isContinuous
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
bool _retval_ = me->isContinuous( );
|
||||
|
||||
return _retval_;
|
||||
return me->isContinuous( );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1160,16 +1041,14 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1isSubmatrix
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
bool _retval_ = me->isSubmatrix( );
|
||||
|
||||
return _retval_;
|
||||
return me->isSubmatrix( );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1192,13 +1071,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_locateROI_10
|
||||
Point ofs;
|
||||
me->locateROI( wholeSize, ofs );
|
||||
jdouble tmp_wholeSize[2] = {wholeSize.width, wholeSize.height}; env->SetDoubleArrayRegion(wholeSize_out, 0, 2, tmp_wholeSize); jdouble tmp_ofs[2] = {ofs.x, ofs.y}; env->SetDoubleArrayRegion(ofs_out, 0, 2, tmp_ofs);
|
||||
return;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1220,15 +1096,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1mul__JJD
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat& m = *((Mat*)m_nativeObj);
|
||||
Mat _retval_ = me->mul( m, scale );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1245,15 +1120,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1mul__JJ
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat& m = *((Mat*)m_nativeObj);
|
||||
Mat _retval_ = me->mul( m );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1271,17 +1145,15 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1ones__III
|
||||
static const char method_name[] = "Mat::n_1ones__III()";
|
||||
try {
|
||||
LOGD(method_name);
|
||||
|
||||
Mat _retval_ = Mat::ones( rows, cols, type );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1301,15 +1173,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1ones__DDI
|
||||
LOGD(method_name);
|
||||
Size size((int)size_width, (int)size_height);
|
||||
Mat _retval_ = Mat::ones( size, type );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1329,14 +1200,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1push_1back
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
me->push_back( (*(Mat*)m_nativeObj) );
|
||||
|
||||
return;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1357,14 +1224,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1release
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
me->release( );
|
||||
|
||||
return;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1385,15 +1248,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1reshape__JII
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat _retval_ = me->reshape( cn, rows );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1409,15 +1271,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1reshape__JI
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat _retval_ = me->reshape( cn );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1437,15 +1298,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1row
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat _retval_ = me->row( y );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1465,15 +1325,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1rowRange
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat _retval_ = me->rowRange( startrow, endrow );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1492,16 +1351,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1rows
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
int _retval_ = me->rows;
|
||||
|
||||
return _retval_;
|
||||
return me->rows;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1522,15 +1379,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JDDDD
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Scalar s(s_val0, s_val1, s_val2, s_val3);
|
||||
Mat _retval_ = me->operator =( s );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1552,15 +1408,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JDDDDJ
|
||||
Scalar s(s_val0, s_val1, s_val2, s_val3);
|
||||
Mat& mask = *((Mat*)mask_nativeObj);
|
||||
Mat _retval_ = me->setTo( s, mask );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1582,15 +1437,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JJJ
|
||||
Mat& value = *((Mat*)value_nativeObj);
|
||||
Mat& mask = *((Mat*)mask_nativeObj);
|
||||
Mat _retval_ = me->setTo( value, mask );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1607,15 +1461,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JJ
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat& value = *((Mat*)value_nativeObj);
|
||||
Mat _retval_ = me->setTo( value );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1635,15 +1488,17 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_n_1size
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Size _retval_ = me->size( );
|
||||
jdoubleArray _da_retval_ = env->NewDoubleArray(2); jdouble _tmp_retval_[2] = {_retval_.width, _retval_.height}; env->SetDoubleArrayRegion(_da_retval_, 0, 2, _tmp_retval_);
|
||||
jdoubleArray _da_retval_ = env->NewDoubleArray(2);
|
||||
jdouble _tmp_retval_[2] = {_retval_.width, _retval_.height};
|
||||
env->SetDoubleArrayRegion(_da_retval_, 0, 2, _tmp_retval_);
|
||||
return _da_retval_;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1662,16 +1517,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1step1__JI
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
size_t _retval_ = me->step1( i );
|
||||
|
||||
return _retval_;
|
||||
return me->step1( i );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1686,16 +1539,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1step1__J
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
size_t _retval_ = me->step1( );
|
||||
|
||||
return _retval_;
|
||||
return me->step1( );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1715,15 +1566,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1submat_1rr
|
||||
Range rowRange(rowRange_start, rowRange_end);
|
||||
Range colRange(colRange_start, colRange_end);
|
||||
Mat _retval_ = me->operator()( rowRange, colRange );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1744,15 +1594,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1submat
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Rect roi(roi_x, roi_y, roi_width, roi_height);
|
||||
Mat _retval_ = me->operator()( roi );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1772,15 +1621,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1t
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
Mat _retval_ = me->t( );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1799,16 +1647,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1total
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
size_t _retval_ = me->total( );
|
||||
|
||||
return _retval_;
|
||||
return me->total( );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1827,16 +1673,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1type
|
||||
try {
|
||||
LOGD(method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
int _retval_ = me->type( );
|
||||
|
||||
return _retval_;
|
||||
return me->type( );
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1854,17 +1698,15 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1zeros__III
|
||||
static const char method_name[] = "Mat::n_1zeros__III()";
|
||||
try {
|
||||
LOGD(method_name);
|
||||
|
||||
Mat _retval_ = Mat::zeros( rows, cols, type );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1884,15 +1726,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1zeros__DDI
|
||||
LOGD(method_name);
|
||||
Size size((int)size_width, (int)size_height);
|
||||
Mat _retval_ = Mat::zeros( size, type );
|
||||
|
||||
return (jlong) new Mat(_retval_);
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1963,12 +1804,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutD
|
||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||
return res;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2026,12 +1867,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutB
|
||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||
return res;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutS
|
||||
@@ -2053,12 +1894,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutS
|
||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||
return res;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutI
|
||||
@@ -2080,12 +1921,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutI
|
||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||
return res;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutF
|
||||
@@ -2107,12 +1948,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutF
|
||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||
return res;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2169,12 +2010,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetB
|
||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||
return res;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetS
|
||||
@@ -2196,12 +2037,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetS
|
||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||
return res;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetI
|
||||
@@ -2223,12 +2064,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetI
|
||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||
return res;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetF
|
||||
@@ -2250,12 +2091,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetF
|
||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||
return res;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetD
|
||||
@@ -2277,12 +2118,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetD
|
||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||
return res;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nGet
|
||||
@@ -2315,12 +2156,12 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nGet
|
||||
}
|
||||
return res;
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionD(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionD(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_opencv_core_Mat_nDump
|
||||
@@ -2338,12 +2179,12 @@ JNIEXPORT jstring JNICALL Java_org_opencv_core_Mat_nDump
|
||||
std::string str = s.str();
|
||||
return env->NewStringUTF(str.c_str());
|
||||
} catch(const std::exception &e) {
|
||||
throwJavaExceptionE(env, e, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaExceptionE(env, method_name);
|
||||
return 0;
|
||||
throwJavaException(env, 0, method_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user