bytedeco / javacv-examples

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

FlyCapture2-demo not working: UnsatisfiedLinkError #17

Closed Sciss closed 6 years ago

Sciss commented 6 years ago

Hello. I'm getting this from cd FlyCapture2-demo & sbt example_ui/run:

[info] 0 [main] ERROR flycapture.examples.cpp.snap.FlyCaptureSnapApp$  - Default handler caught exception: Exception in Application start method
[info] java.lang.RuntimeException: Exception in Application start method
[info]  at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
[info]  at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$1(LauncherImpl.java:182)
[info]  at java.lang.Thread.run(Thread.java:748)
[info] Caused by: java.lang.UnsatisfiedLinkError: no jniFlyCapture2 in java.library.path
[info]  at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
[info]  at java.lang.Runtime.loadLibrary0(Runtime.java:870)
[info]  at java.lang.System.loadLibrary(System.java:1122)
[info]  at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:654)
[info]  at org.bytedeco.javacpp.Loader.load(Loader.java:492)
[info]  at org.bytedeco.javacpp.Loader.load(Loader.java:409)
[info]  at org.bytedeco.javacpp.FlyCapture2.<clinit>(FlyCapture2.java:10)
[info]  at java.lang.Class.forName0(Native Method)
[info]  at java.lang.Class.forName(Class.java:348)
[info]  at org.bytedeco.javacpp.Loader.load(Loader.java:464)
[info]  at org.bytedeco.javacpp.Loader.load(Loader.java:409)
[info]  at org.bytedeco.javacpp.FlyCapture2$FC2Version.<clinit>(FlyCapture2.java:709)
[info]  at flycapture.examples.cpp.snap.SnapModel.<init>(SnapModel.scala:73)
[info]  at flycapture.examples.cpp.snap.FlyCaptureSnapApp$.delayedEndpoint$flycapture$examples$cpp$snap$FlyCaptureSnapApp$1(FlyCaptureSnapApp.scala:41)
[info]  at flycapture.examples.cpp.snap.FlyCaptureSnapApp$delayedInit$body.apply(FlyCaptureSnapApp.scala:32)
[info]  at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
[info]  at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
[info]  at scalafx.application.JFXApp$$anonfun$init$1.apply(JFXApp.scala:297)
[info]  at scalafx.application.JFXApp$$anonfun$init$1.apply(JFXApp.scala:297)
[info]  at scala.collection.immutable.List.foreach(List.scala:381)
[info]  at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
[info]  at scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:45)
[info]  at scalafx.application.JFXApp$class.init(JFXApp.scala:297)
[info]  at flycapture.examples.cpp.snap.FlyCaptureSnapApp$.init(FlyCaptureSnapApp.scala:32)
[info]  at scalafx.application.AppHelper.start(AppHelper.scala:33)
[info]  at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
[info]  at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
[info]  at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
[info]  at java.security.AccessController.doPrivileged(Native Method)
[info]  at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
[info]  at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
[info]  at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
[info]  at com.sun.glass.ui.gtk.GtkApplication.lambda$null$5(GtkApplication.java:139)
[info]  ... 1 more
[info] Caused by: java.lang.UnsatisfiedLinkError: /tmp/javacpp1455675293976712/libjniFlyCapture2.so: libflycapture.so.2: cannot open shared object file: No such file or directory
[info]  at java.lang.ClassLoader$NativeLibrary.load(Native Method)
[info]  at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
[info]  at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
[info]  at java.lang.Runtime.load0(Runtime.java:809)
[info]  at java.lang.System.load(System.java:1086)
[info]  at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:637)
[info]  ... 30 more

Using OpenJDK 8 / OpenJFX 8 / Debian Stretch / amd64 (platform in the sbt build reports linux-x86_64, which is correct). Any ideas?

Sciss commented 6 years ago

I tried getting all the latest library versions: https://github.com/Sciss/javacv-examples/commit/899a64c3fb2748bd6b5c2bae8e8d8b36f4ea8f7d

This gives me other linker error:

[info] Running flycapture.examples.cpp.FlyCapture2Test 
[error] Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniFlyCapture2 in java.library.path
[error]     at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
[error]     at java.lang.Runtime.loadLibrary0(Runtime.java:870)
[error]     at java.lang.System.loadLibrary(System.java:1122)
[error]     at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1191)
[error]     at org.bytedeco.javacpp.Loader.load(Loader.java:953)
[error]     at org.bytedeco.javacpp.Loader.load(Loader.java:854)
[error]     at org.bytedeco.javacpp.FlyCapture2.<clinit>(FlyCapture2.java:10)
[error]     at java.lang.Class.forName0(Native Method)
[error]     at java.lang.Class.forName(Class.java:348)
[error]     at org.bytedeco.javacpp.Loader.load(Loader.java:913)
[error]     at org.bytedeco.javacpp.Loader.load(Loader.java:854)
[error]     at org.bytedeco.javacpp.FlyCapture2$FC2Version.<clinit>(FlyCapture2.java:725)
[error]     at flycapture.examples.cpp.package$.printBuildInfo(package.scala:20)
[error]     at flycapture.examples.cpp.FlyCapture2Test$.delayedEndpoint$flycapture$examples$cpp$FlyCapture2Test$1(FlyCapture2Test.scala:64)
[error]     at flycapture.examples.cpp.FlyCapture2Test$delayedInit$body.apply(FlyCapture2Test.scala:18)
[error]     at scala.Function0.apply$mcV$sp(Function0.scala:34)
[error]     at scala.Function0.apply$mcV$sp$(Function0.scala:34)
[error]     at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
[error]     at scala.App.$anonfun$main$1$adapted(App.scala:76)
[error]     at scala.collection.immutable.List.foreach(List.scala:389)
[error]     at scala.App.main(App.scala:76)
[error]     at scala.App.main$(App.scala:74)
[error]     at flycapture.examples.cpp.FlyCapture2Test$.main(FlyCapture2Test.scala:18)
[error]     at flycapture.examples.cpp.FlyCapture2Test.main(FlyCapture2Test.scala)
[error] Caused by: java.lang.UnsatisfiedLinkError: /home/hhrutz/.javacpp/cache/flycapture-2.11.3.121-1.4-linux-x86_64.jar/org/bytedeco/javacpp/linux-x86_64/libjniFlyCapture2.so: libmultisync.so.2: cannot open shared object file: No such file or directory
[error]     at java.lang.ClassLoader$NativeLibrary.load(Native Method)
[error]     at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
[error]     at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
[error]     at java.lang.Runtime.load0(Runtime.java:809)
[error]     at java.lang.System.load(System.java:1086)
[error]     at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1171)
[error]     ... 20 more
jpsacha commented 6 years ago

Do you have FlyCapture native binaries installed on your computer (https://www.ptgrey.com/support/downloads)? Which version?

Sciss commented 6 years ago

No - do I need to? I thought the whole point of javacpp is that the native libraries get pulled in for the appropriate platform through a maven jar artifact? At least it works that way for OpenCV.

Or am I misunderstanding something? I want to capture from a generic USB web cam. (I succeeded now with the webcam-capture project and OpenIMAJ, though).

jpsacha commented 6 years ago

FlyCapture is a commercial package (though free to use) for use with PointGrey cameras, not generic webcams. You need to get it from the maker (Flir/PointGrey). It is not open source. I did not try it on Linux, but on Windows you have to have native binaries installed separately.

This example (FlyCapture2-demo) is not intended for a generic webcams.

Sciss commented 6 years ago

Oh ok, sorry for the misunderstanding. Is there a way to capture from generic cameras using javacv?

jpsacha commented 6 years ago

There are some examples for Android in https://github.com/bytedeco/sample-projects For a desktop. I am not sure. I have some simple test code that can be turned into an example. Let me know if you need that.

jpsacha commented 6 years ago

Actually there is an example on the https://github.com/bytedeco/javacv front page, in the README.md. Look for FrameGrabber about half page down.