bytedeco / sbt-javacv Goto Github PK
View Code? Open in Web Editor NEWStart using OpenCV in your JVM project in just 1 line, no separate compiling, installing OpenCV, or fussing with your system required
License: MIT License
Start using OpenCV in your JVM project in just 1 line, no separate compiling, installing OpenCV, or fussing with your system required
License: MIT License
Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: putMemberOffset
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1814)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1083)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:637)
at org.bytedeco.javacpp.Loader.load(Loader.java:492)
at org.bytedeco.javacpp.Loader.load(Loader.java:409)
at org.bytedeco.javacpp.opencv_core.<clinit>(opencv_core.java:10)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:344)
at org.bytedeco.javacpp.Loader.load(Loader.java:464)
at org.bytedeco.javacpp.Loader.load(Loader.java:409)
at org.bytedeco.javacpp.opencv_imgcodecs.<clinit>(opencv_imgcodecs.java:13)
at opencv2_cookbook.chapter01.Ex2MyFirstGUIApp$.opencv2_cookbook$chapter01$Ex2MyFirstGUIApp$$openImage(Ex2MyFirstGUIApp.scala:130)
at opencv2_cookbook.chapter01.Ex2MyFirstGUIApp$$anon$2$$anonfun$1.apply$mcV$sp(Ex2MyFirstGUIApp.scala:55)
at scala.swing.Action$$anon$2.apply(Action.scala:65)
at scala.swing.Action$$anon$1.actionPerformed(Action.scala:83)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6525)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
at java.awt.Component.processEvent(Component.java:6290)
at java.awt.Container.processEvent(Container.java:2234)
at java.awt.Component.dispatchEventImpl(Component.java:4881)
at java.awt.Container.dispatchEventImpl(Container.java:2292)
at java.awt.Component.dispatchEvent(Component.java:4703)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
at java.awt.Container.dispatchEventImpl(Container.java:2278)
at java.awt.Window.dispatchEventImpl(Window.java:2739)
at java.awt.Component.dispatchEvent(Component.java:4703)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:746)
at java.awt.EventQueue.access$400(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:697)
at java.awt.EventQueue$3.run(EventQueue.java:691)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:719)
at java.awt.EventQueue$4.run(EventQueue.java:717)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:716)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
More details.
Its creating a directory at C:\Users\philip\AppData\Local\Temp\javacpp105687008440412
It downloads these files
msvcp120.dll
msvcr120.dll
opencv_core300.dll
opencv_imgproc300.dll
jniopencv_core.dll
I think it fails on jniopencv_core.dll
The exception is thrown on this line
tempFile.deleteOnExit();
In file Loader.java
when I add this line to my build.sbt
javaCppPresetLibs ++= Seq("ffmpeg" -> "2.8.1")
I get this error refreshing the sbt project:
error sbt.ResolveException: unresolved dependency: org.bytedeco.javacpp-presets#ffmpeg;2.8.1-1.2: not found
[error] Total time: 5 s, completed Sep 29, 2016 4:35:35 PM
See complete log in C:\Users\Dave.IntelliJIdea2016.2\system\log\sbt.last.log
With version 1.10 (sbt-opencv) w're getting (2 developer different machines) the following error regarding the including of the binaries.
com.google.inject.CreationException: Unable to create injector, see the following errors:
[info]
[info] 1) Error injecting constructor, java.lang.UnsatisfiedLinkError: no jniopencv_face in java.library.path
[info] at library.GenderRecognition.<init>(GenderRecognition.scala:109)
[info] at Module.configure(Module.scala:21) (via modules: com.google.inject.util.Modules$OverrideModule -> Module)
[info] while locating library.GenderRecognition
[info]
[info] 1 error
[info] at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:466)
[info] at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:184)
[info] at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
[info] at com.google.inject.Guice.createInjector(Guice.java:96)
[info] at com.google.inject.Guice.createInjector(Guice.java:84)
[info] at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:181)
[info] at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:123)
[info] at org.scalatestplus.play.OneAppPerTest$class.newAppForTest(OneAppPerTest.scala:71)
[info] at FaceDetectionTest.newAppForTest(FaceDetectionTest.scala:11)
[info] at org.scalatestplus.play.OneAppPerTest$class.withFixture(OneAppPerTest.scala:88)
[info] ...
**[info] Cause: java.lang.UnsatisfiedLinkError: no jniopencv_face 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:727)
[info] at org.bytedeco.javacpp.Loader.load(Loader.java:502)
[info] at org.bytedeco.javacpp.Loader.load(Loader.java:419)
[info] at org.bytedeco.javacpp.opencv_face.<clinit>(opencv_face.java:13)
[info] at library.GenderRecognition.<init>(GenderRecognition.scala:21)
[info] at library.GenderRecognition$$FastClassByGuice$$53415250.newInstance(<generated>)
[info] at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
[info] ...
[info] Cause: java.lang.UnsatisfiedLinkError: /private/var/folders/td/9xc91ttn3bx5m0f0wr7bh9900000gn/T/javacpp45557842528326/libjniopencv_face.dylib: dlopen(/private/var/folders/td/9xc91ttn3bx5m0f0wr7bh9900000gn/T/javacpp45557842528326/libjniopencv_face.dylib, 1): Library not loaded: @rpath/libopencv_objdetect.3.1.dylib
[info] Referenced from: **/private/var/folders/td/9xc91ttn3bx5m0f0wr7bh9900000gn/T/javacpp45557842528326/./libopencv_face.3.1.dylib**
[info] Reason: image not found
[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:710)
[info] at org.bytedeco.javacpp.Loader.load(Loader.java:502)
[info] at org.bytedeco.javacpp.Loader.load(Loader.java:419)
[info] at org.bytedeco.javacpp.opencv_face.<clinit>(opencv_face.java:13)
[info] at library.GenderRecognition.<init>(GenderRecognition.scala:21)
Added the addSbtPlugin("org.bytedeco" % "sbt-javacv" % "1.17")
Got
Caused by: java.lang.UnsatisfiedLinkError: no opencv_java343 in java.library.path
when calling
System.loadLibrary(Core.NATIVE_LIBRARY_NAME)
An idea came up to look up the latest JavaCV version on Maven Central and use that as javaCVVersion
. This is possible, but should be a bit better thought out to help with the following assumptions:
Please, update preset loading to 1.2 (it is 1.1 right now)
Hi,
I'm running scala (compiled using sbt) app that uses several OpenCV's functionalities. Eventually I managed to run some of them, but I still encounter the following exception:
Name: java.lang.NoClassDefFoundError
Message: Could not initialize class org.bytedeco.javacpp.opencv_objdetect$CascadeClassifier
StackTrace:
Notes:
logLevel := Level.Warn
resolvers += Resolver.sonatypeRepo("releases")
addSbtPlugin("org.bytedeco" % "sbt-javacv" % "1.12")
name := "..."
version := "1.0"
scalaVersion := "2.11.8"
javaCppPresetLibs ++= Seq("opencv" -> "3.1.0", "ffmpeg" -> "3.1.2")
javaCppPlatform := Seq("linux-x86_64")
I'm coding+debugging on Windows machine where everything runs smoothly. Then I tried adding the linux-x86_64 platform to the build.sbt as in (2) and use sbt-assembly to package my linux-ready jar. I uploaded that jar into my linux cluster, then cloned the 3.1.0 version of opencv from https://github.com/Itseez/opencv and ran cmake, make and make install.
Finally, in scala, this piece of code works great (uses org.bytedeco.javacpp.opencv_imgcodecs & org.bytedeco.javacpp.opencv_imgproc):
import org.bytedeco.javacpp.BytePointer
import org.bytedeco.javacpp.opencv_core.{Mat, _}
import org.bytedeco.javacpp.opencv_imgcodecs._
import org.bytedeco.javacpp.opencv_imgproc._
import org.bytedeco.javacpp.opencv_objdetect.CascadeClassifier
val bytes = ByteBuffer.wrap( /* some Byte array */ )
val imgCvMat = cvDecodeImageM(cvMat(1, bytes .array().length, CV_8UC1, new BytePointer(bytes )))
val imgMat = cvarrToMat(imgCvMat)
while this code:
val faceCascade = new org.bytedeco.javacpp.opencv_objdetect.CascadeClassifier( /* path to xml of classifier configuration */ )
fails with the following exception:
java.lang.UnsatisfiedLinkError: no jniopencv_videoio in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:784)
at org.bytedeco.javacpp.Loader.load(Loader.java:586)
at org.bytedeco.javacpp.Loader.load(Loader.java:503)
at org.bytedeco.javacpp.opencv_videoio.(opencv_videoio.java:14)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.bytedeco.javacpp.Loader.load(Loader.java:558)
at org.bytedeco.javacpp.Loader.load(Loader.java:503)
at org.bytedeco.javacpp.opencv_objdetect$CascadeClassifier.(opencv_objdetect.java:566)
... 52 elided
Caused by: java.lang.UnsatisfiedLinkError: /home/hadoop/.javacpp/cache/mlageinf.jar/org/bytedeco/javacpp/linux-x86_64/libjniopencv_videoio.so: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:767)
... 60 more
Note that theeres a missing libgtk-x11-2.0.so.0 - and I can't figure out what to do here
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.