Ask Your Question

hendrik's profile - activity

2020-05-21 03:11:41 -0600 received badge  Notable Question (source)
2018-02-10 09:27:28 -0600 received badge  Popular Question (source)
2015-06-09 14:27:30 -0600 received badge  Student (source)
2014-09-17 12:23:48 -0600 received badge  Editor (source)
2014-09-17 11:52:08 -0600 asked a question No implementation found for long DetectionBasedTracker.nativeCreateObject(java.lang.String, int)

Hi,

I'm trying to compile and run the face detection demo from openCV-2.4.9-android-sdk. I have already configured the Appliation.mk and the Android.mk. As I have no idea how these files work I did trial and error and came out with the following:

Android.mk:

LOCAL_PATH := $(call my-dir)   
include $(CLEAR_VARS)
#OPENCV_CAMERA_MODULES:=off
#OPENCV_INSTALL_MODULES:=off
OPENCV_LIB_TYPE:=SHARED
include D:/OpenCV-2.4.9-android-sdk/sdk/native/jni/OpenCV.mk

LOCAL_SRC_FILES  := DetectionBasedTracker_jni.cpp
LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_LDLIBS     += -llog -ldl
LOCAL_MODULE     := detection_based_tracker

include $(BUILD_SHARED_LIBRARY)

Application.mk

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi armeabi-v7a
APP_PLATFORM := android-14

this builds the natives and copies it to the app dir. So far everything works fine. Problem is at runtime:

mNativeDetector = new DetectionBasedTracker(mCascadeFile.getAbsolutePath(), 0);

results in

java.lang.UnsatisfiedLinkError: No implementation found for long de.hendrik.test.opencv_facerecognition.DetectionBasedTracker.nativeCreateObject(java.lang.String, int) (tried Java_de_hendrik_test_opencv_1facerecognition_DetectionBasedTracker_nativeCreateObject and Java_de_hendrik_test_opencv_1facerecognition_DetectionBasedTracker_nativeCreateObject__Ljava_lang_String_2I) at de.hendrik.test.opencv_facerecognition.DetectionBasedTracker.nativeCreateObject(Native Method) at de.hendrik.test.opencv_facerecognition.DetectionBasedTracker.<init>(DetectionBasedTracker.java:9) at de.hendrik.test.opencv_facerecognition.MyActivity$1.onManagerConnected(MyActivity.java:90) at org.opencv.android.AsyncServiceHelper$3.onServiceConnected(AsyncServiceHelper.java:318) at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1202) at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1219) at android.os.Handler.handleCallback(Handler.java:738) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5070) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:836) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631)

I am using Android Studio (latest beta) and a Nexus 5 with Developer Preview (Android-L). Any ideas are appreciated.

thanks in advance Hendrik

edit: I found a mismatch between

DetectionBasedTracker_jni.cpp

JNIEXPORT jlong JNICALL Java_de_hendrik_test_opencv_1facerecognition_DetectionBasedTracker_nativeCreateObject
  (JNIEnv *, jclass, jstring, jint);

and DetectionBasedTracker.java

private static native long nativeCreateObject(String cascadeName, int minFaceSize);

as you can see the first two parameters are missing but i have no idea what to provide.