bytedeco / javacv-examples

Examples of using JavaCV / OpenCV library on Java Virtual Machine
337 stars 155 forks source link

Is very difficult execute flandmarks .dll + flandmark-demo #1

Closed henriquem closed 10 years ago

henriquem commented 10 years ago

I would like to propose an tips about the flandmark-demo.

I'm cannot to compile in C++ the flandmarks ( very difficult) to generates .dll to afterwards running bytedeco JNA/JNI from flandmarks

I think very difficulty to compile this framework, or at least you provide an .dll to use the demonstration (integrated JAVA with flandmarks .dll)

Thanks

saudet commented 10 years ago

There is a simpler example here: https://github.com/bytedeco/javacpp-presets/tree/master/flandmark Let us know if you run into any problems with that one, thanks!

henriquem commented 10 years ago

I see !

But Don't you agree that I need an file .dll to solve this exception ?

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniflandmark in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:535) at org.bytedeco.javacpp.Loader.load(Loader.java:410) at org.bytedeco.javacpp.Loader.load(Loader.java:353) at org.bytedeco.javacpp.flandmark.(flandmark.java:13)

This Exception ocurred when I tried to load the file model.dat in this simple line: org.bytedeco.javacpp.flandmark.FLANDMARK_Model model = org.bytedeco.javacpp.flandmark.flandmark_init.flandmark_init("C:/flandmark/data/model.dat");

I'm using the same library like your pom.xml: ...

org.bytedeco.javacpp-presets
      <artifactId>flandmark</artifactId>
      <version>1.07-0.9</version>

org.bytedeco.javacpp-presets opencv 2.4.9-0.9
<dependency>
  <groupId>org.bytedeco</groupId>
  <artifactId>javacpp</artifactId>
  <version>0.9</version>
</dependency>
org.bytedeco javacv 0.9
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>opencv-windows-x86.jar</artifactId>
<version>2.4.9</version>

...

I don't know what I can to do :'(

henriquem commented 10 years ago

Follow the complete Exception

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniflandmark in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:535) at org.bytedeco.javacpp.Loader.load(Loader.java:410) at org.bytedeco.javacpp.Loader.load(Loader.java:353) at org.bytedeco.javacpp.flandmark.(flandmark.java:13)

Caused by: java.lang.UnsatisfiedLinkError: no flandmark_static in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:535) at org.bytedeco.javacpp.Loader.load(Loader.java:401) ... 4 more

saudet commented 10 years ago

I follow the instructions, and it works just fine. To help you, I would need to reproduce the problem here on my machine. Please provide more details about what you are doing exactly.

henriquem commented 10 years ago

Ok. Thanks so much for your attention!

Firstly I did the download from http://cmp.felk.cvut.cz/~uricamic/flandmark/ I got the flandmark_v107.zip (latest zip from GitHub)

I Noticed that when I extracted the flandmark, The structure of folders is:

Project JAVA My libraries accorded as pom.xml :

M2_REPO/org/bytedeco/javacpp-presets/flandmark/1.07-0.9/flandmark-1.07-0.9.jar * not has .dll into this .jar, just has JNI class M2_REPO/org/bytedeco/javacpp-presets/opencv/2.4.9-0.9/opencv-2.4.9-0.9.jar M2_REPO/org/bytedeco/javacpp/0.9/javacpp-0.9.jar

The Simple Class I simple class is bellow is enough to see the exception public class SimpleExample { public static void main(String[] args) { org.bytedeco.javacpp.flandmark.FLANDMARK_Model model = org.bytedeco.javacpp.flandmark.flandmark_init("C:/flandmark/data/model.dat"); } }

When executed the method main : Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniflandmark in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:535) at org.bytedeco.javacpp.Loader.load(Loader.java:410) at org.bytedeco.javacpp.Loader.load(Loader.java:353) at org.bytedeco.javacpp.flandmark.(flandmark.java:13) at SimpleExample.main(SimpleExample.java:5) Caused by: java.lang.UnsatisfiedLinkError: no flandmark_static in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:535) at org.bytedeco.javacpp.Loader.load(Loader.java:401) ... 3 more

I suppose that We needs the .dll files from flandmarks, because when I downloaded flandmark, and came only source code in *.cpp

I struggled in generating files .dll from flandmarks_v107, But unsuccessful.

saudet commented 10 years ago

How do you execute the main() method?

henriquem commented 10 years ago

I use simple command: java SimpleExample.class But I'm running by eclipse. I know that I need to put the variable -Djava.library.path= ???

But My doubt is What the directory specific I need to put in this variable ?

I generated by Cmake-gui the c:/flandmark, And generated bellow is where build to binaries indicated by Cmake-gui, the results of generating is it: C:\flandmark-bin

Now, I dont know if I need to generate another compilation .dll files starting folders above, to After I can put something like variable java.library.path=C:/flandmark-bin/dlls ???

Could you clear my doubt, in detail ? Thanks for your attention and patience! I'm almost there !!!

Thks

saudet commented 10 years ago

Ok so instead of using Eclipse, use Maven as shown in the simple example here and it will work: https://github.com/bytedeco/javacpp-presets/tree/master/flandmark

henriquem commented 10 years ago

Thanks so much for your help !

I caught the jar flandmark-1.07-0.9-windows-x86.jar to solved the problem about JNI

Cheers