bananabreadbob
bananabreadbob

Reputation: 407

OpenCV could not load needed library (face detection)

I am using the face detection open cv for android sample.

There are no errors when building, however when deploying the sample I get runtime errors of

java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1940]: 150 could not load needed library 'libopencv_java3.so' for 'libdetection_based_tracker.so' (load_library[1095]: Library 'libopencv_java3.s0' not found)

I have added the ndk to the project, and linked the open cv library with the sample.

Upvotes: 0

Views: 2689

Answers (3)

user6628772
user6628772

Reputation:

After Doing these changes Working fine.

I got Image's faces are surrounded by rectangles

Note:- 1. In Android Studio, go to File > New > Import-Module and the choose /sdk and wait for the sync to finish. 2.Do not import /sdk/java as most tutorials suggest.

Upvotes: 1

Avinash
Avinash

Reputation: 264

You are getting this error because android couldn't find libdetection_based_tracker.so in /jniLibs folder

solution for it is

  1. copy native/libs folder from opencv-sdk in /jniLibs
  2. make Android.mk file and Application.mk file in jni folder
  3. Copy following line in your build.gradle

sourceSets.main {

jni.srcDirs = [] //disable automatic ndk-build call
jniLibs.srcDir 'src/main/jniLibs'

}

buildTypes { ... } and add

defaultConfig {...

ndk{
    moduleName "libdetection_based_tracker"
}

}

4.add libdetection_based_tracker.so to jniLibs

Upvotes: 0

Hans Araya
Hans Araya

Reputation: 345

Try to add System.loadLibrary("opencv_java3");. It worked good for me

Upvotes: 0

Related Questions