CMT (CppMT) is very slow in android

asked 2017-04-20 01:50:16 -0600

updated 2017-04-20 01:53:28 -0600

I wrote an application using CMT. I wrote JNI wrapper to wrap the two APIs in CMP, initialize and processFrame (the gnebehay/CppMT).

void JNICALL Java_com_cmt_demo_MyActivity_initialize(JNIEnv *env, jobject obj, jlong matAddr, jint x, jint y, jint width, jint height) {cmtObj->initialize(mGr, rect);}

void JNICALL Java_com_cmt_demo_MyActivity_processFrame(JNIEnv*, jobject, jlong addrGray) {
        Mat& im_gray  = *(Mat*)addrGray;
        cmtObj->processFrame(im_gray); }

The above methods are called in the public Mat onCameraFrame(CvCameraViewFrame inputFrame) callback. However, these two JNI calls are very very slow, the fps dropped to 1 fps from 30 fps. I did some profiling, one of the method in initialize descriptor = cv::BRISK::create();takes 500ms.

I don't see any logic of the problem in the code. I wrote another JNI call, the performance seems to be fine. Any advise on what I have done was wrong?

edit retag flag offensive close merge delete