Java Kazemi Landmarks

asked 2019-03-26 10:45:00 -0500

Scalaire gravatar image

updated 2019-04-03 09:54:08 -0500

I'm trying to make an application with opencv that is able to recognize a person's face in an image, so I'm trying to use the FacemarkKazemi function of opencv. My problem is that as soon as I switch to class initialization, my application crashes instantly.

You can find the code I'm trying to run here :

https://github.com/opencv/opencv_cont...

The application crashes at line 29 here :

Facemark fm = Face.createFacemarkKazemi();

And i have this error :

java.lang.UnsatisfiedLinkError: No implementation found for long org.opencv.face.Face.createFacemarkKazemi_0() (tried Java_org_opencv_face_Face_createFacemarkKazemi_10 and Java_org_opencv_face_Face_createFacemarkKazemi_10__) org.opencv.face.Face.createFacemarkKazemi_0 (Face.java) org.opencv.face.Face.createFacemarkKazemi (Face.java:42) com.opencv.RNOpenCvLibraryModule$1.onManagerConnected (RNOpenCvLibraryModule.java:65) com.opencv.RNOpenCvLibraryModule.<init> (RNOpenCvLibraryModule.java:52) com.opencv.RNOpenCvLibraryPackage.createNativeModules (RNOpenCvLibraryPackage.java:15) com.facebook.react.NativeModuleRegistryBuilder.processPackage (NativeModuleRegistryBuilder.java:85) com.facebook.react.ReactInstanceManager.processPackage (ReactInstanceManager.java:1171) com.facebook.react.ReactInstanceManager.processPackages (ReactInstanceManager.java:1141) com.facebook.react.ReactInstanceManager.createReactContext (ReactInstanceManager.java:1083) com.facebook.react.ReactInstanceManager.access$900 (ReactInstanceManager.java:116) com.facebook.react.ReactInstanceManager$5.run (ReactInstanceManager.java:913) java.lang.Thread.run (Thread.java:784)

Also, if you know a better way to make FacialMarks, I would be happy to know it.

I added this line to my gradle to import opencv contrib, do you think the error could be due to this?

implementation 'com.quickbirdstudios:opencv:3.4.4-contrib'
edit retag flag offensive close merge delete

Comments

Im sorry but I don't think it's a problem with my IDE, the error is when calling the function at runtime on my application. I think the problem is that he can't make the link between java and c++ functions. Can you tell me how you imported the repo from opencv-contrib into your project? I think my concern should come from my import of the gradle.

Scalaire gravatar imageScalaire ( 2019-03-28 07:01:29 -0500 )edit

yea, sorry, replace "IDE" with "toolchain".

I think the problem is that he can't make the link between java and c++ functions.

i think so, too. unfortunately not using gradle at all, so i don't know.

berak gravatar imageberak ( 2019-03-28 08:28:00 -0500 )edit

I'm going to ask another question here to avoid opening another topic, but so I try to compile Opencv with contribution thanks to MinGW by following the following tutorial:

https://zami0xzami.wordpress.com/2016...

But it happens that after the execution of the build I can't execute the mingw32-make command I have the following error:

mingw32-make: * No targets specified and no makefile found. Stop.

I specify that when I put the option CMAKE_TOOLCHAIN_FILE my compilation does not work.

Scalaire gravatar imageScalaire ( 2019-03-28 11:19:05 -0500 )edit

oh, you never mentioned android explicitly before ;(

berak gravatar imageberak ( 2019-03-28 13:47:54 -0500 )edit

Ow sorry, I thought I said it. :(

Scalaire gravatar imageScalaire ( 2019-03-28 13:59:21 -0500 )edit

well, anyway, the error says, that the java part has something about kazemi, but the c++ so's have no match for it. can you check your build / install pipeline again ?

berak gravatar imageberak ( 2019-03-28 14:04:30 -0500 )edit

I have tested with other functions and it has not only to do with Kazemi, it happens that when I try other functions like LBF there is the same kind of crash / errors. When I go back to where the error goes, in the code there are lines of code without implementation like the following:

    // C++:  Ptr_Facemark cv::face::createFacemarkLBF()
private static native long createFacemarkLBF_0();

During the installation on my android I have absolutely no errors and during the build of the gradle I have no errors either a priori. That's why I question the functionality of the gradle link and try to build opencv myself.

Scalaire gravatar imageScalaire ( 2019-03-29 05:32:22 -0500 )edit

After compiling opencv myself I find myself with the same error. I'm a little desperate.

Scalaire gravatar imageScalaire ( 2019-04-04 05:16:27 -0500 )edit

com.facebook.react -- seriously ? no wonder you are in trouble with native libs. (i think, what you're trying is too complicated)

berak gravatar imageberak ( 2019-04-04 05:50:24 -0500 )edit

Yes I know, but for the moment I really don't have a choice. I have to use native react but I need some features that I have to do natively (like facial landmarks for example). A priori I never really had any problems except at this level with opencv-contrib ( it was good with opencv ).

Scalaire gravatar imageScalaire ( 2019-04-04 06:04:38 -0500 )edit