Skip to content

Instantly share code, notes, and snippets.

@jason9075
Created June 12, 2022 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jason9075/9fdd241fc8da0e0c882a80fa1a3bc2e3 to your computer and use it in GitHub Desktop.
Save jason9075/9fdd241fc8da0e0c882a80fa1a3bc2e3 to your computer and use it in GitHub Desktop.
extern "C"
JNIEXPORT jobject JNICALL
Java_com_jason9075_myopencv_NativeLib_getInfo(JNIEnv *env, jobject thiz, jobject bitmap) {
Mat src;
bitmapToMat(env, bitmap, src, false);
int width = src.cols;
int height = src.rows;
// return java object
const char *clsPath = "com/jason9075/myopencv/ImageInfo";
jclass cls = env->FindClass(clsPath);
jmethodID constructor = env->GetMethodID(cls, "<init>", "(II)V");
return env->NewObject(cls, constructor, width, height);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment