Merge pull request #10050 from floe/android-studio-3.3.1

Add Android Mat constructor with support for native buffer (#10050)
This commit is contained in:
Florian Echtler
2017-11-10 20:35:32 +01:00
committed by Alexander Alekhin
parent c6fb99357c
commit 2e772510ea
3 changed files with 56 additions and 0 deletions
+25
View File
@@ -51,6 +51,31 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__
//
// Mat::Mat(int rows, int cols, int type, void* data)
//
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__IIILjava_nio_ByteBuffer_2
(JNIEnv* env, jclass, jint rows, jint cols, jint type, jobject data);
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__IIILjava_nio_ByteBuffer_2
(JNIEnv* env, jclass, jint rows, jint cols, jint type, jobject data)
{
static const char method_name[] = "Mat::n_1Mat__IIILByteBuffer()";
try {
LOGD("%s", method_name);
return (jlong) new Mat( rows, cols, type, (void*)env->GetDirectBufferAddress(data) );
} catch(const std::exception &e) {
throwJavaException(env, &e, method_name);
} catch (...) {
throwJavaException(env, 0, method_name);
}
return 0;
}
//
// Mat::Mat(int rows, int cols, int type)
//