MCPcopy Create free account
hub / github.com/KAlO2/PerfectShow / getJavaMat

Function getJavaMat

jni/platform/jni_bridge.cpp:96–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94// **************** C++ to Java **************** //
95
96jobject getJavaMat(JNIEnv *env, const cv::Mat& mat)
97{
98 jclass class_Mat = env->FindClass("org/opencv/core/Mat");
99 jmethodID method_Mat = env->GetMethodID(class_Mat, "<init>", "()V");
100 assert(class_Mat != nullptr && method_Mat != nullptr);
101
102 jobject Mat_result = env->NewObject(class_Mat, method_Mat);
103 jmethodID method_getNativeObjAddr = env->GetMethodID(class_Mat, "getNativeObjAddr", "()J");
104 cv::Mat* ptr_result = reinterpret_cast<cv::Mat*>(env->CallLongMethod(Mat_result, method_getNativeObjAddr));
105 assert(method_getNativeObjAddr != nullptr && ptr_result != nullptr);
106
107 *ptr_result = mat;
108 return Mat_result;
109}
110
111jobject getJavaPoint(JNIEnv *env, const cv::Point2f& point)
112{

Calls

no outgoing calls

Tested by

no test coverage detected