我在Java中实现了一个面部识别器,所以我需要OpenCV的API和Javacv的包装器(我使用0.9版本)。按照Javacv / Javacpp开发人员的指示,我只是链接到我的eclipse / java项目:javacv.jar,javacpp.jar和opencv-macosx-x86_64.jar。 Eclipse告诉我一切都很好,但当我试图让它运行时,我得到:
Init, please wait...
Creating detector...
Exception in thread "main" java.lang.UnsatisfiedLinkError: /Users/*/Desktop/javacv-bin/opencv-macosx-x86_64/org/bytedeco/javacpp/macosx-x86_64/libjniopencv_core.dylib: dlopen(/Users/*/Desktop/javacv-bin/opencv-macosx-x86_64/org/bytedeco/javacpp/macosx-x86_64/libjniopencv_core.dylib, 1): Library not loaded: @rpath/libopencv_core.2.4.dylib
Referenced from: /Users/*/Desktop/javacv-bin/opencv-macosx-x86_64/org/bytedeco/javacpp/macosx-x86_64/libjniopencv_core.dylib
Reason: no suitable image found. Did find:
/Users/*/Desktop/javacv-bin/opencv-macosx-x86_64/org/bytedeco/javacpp/macosx-x86_64/./libopencv_core.2.4.dylib: malformed mach-o image: load command #12 length (0) too small in /Users/*/Desktop/javacv-bin/opencv-macosx-x86_64/org/bytedeco/javacpp/macosx-x86_64/./libopencv_core.2.4.dylib
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1847)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
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.opencv_core.<clinit>(opencv_core.java:10)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:340)
at org.bytedeco.javacpp.Loader.load(Loader.java:385)
at org.bytedeco.javacpp.Loader.load(Loader.java:353)
at org.bytedeco.javacpp.opencv_objdetect$CascadeClassifier.<clinit>(opencv_objdetect.java:618)
at javacvOpenCvCaptureFrames.Detector.<init>(Detector.java:22)
at javacvOpenCvCaptureFrames.CaptureFrame.main(CaptureFrame.java:52)
Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/1h/39dk7v3n4ng0phg9ldwnccsh0000gn/T/javacpp8317818567016/libjniopencv_core.dylib: dlopen(/private/var/folders/1h/39dk7v3n4ng0phg9ldwnccsh0000gn/T/javacpp8317818567016/libjniopencv_core.dylib, 1): Library not loaded: @rpath/libopencv_core.2.4.dylib
Referenced from: /private/var/folders/1h/39dk7v3n4ng0phg9ldwnccsh0000gn/T/javacpp8317818567016/libjniopencv_core.dylib
Reason: no suitable image found. Did find:
/private/var/folders/1h/39dk7v3n4ng0phg9ldwnccsh0000gn/T/javacpp8317818567016/./libopencv_core.2.4.dylib: malformed mach-o image: load command #12 length (0) too small in /private/var/folders/1h/39dk7v3n4ng0phg9ldwnccsh0000gn/T/javacpp8317818567016/./libopencv_core.2.4.dylib
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:524)
... 10 more
对我来说听起来很奇怪的是&#34;格式错误的机器图像:加载命令#12长度(0)太小&#34; .... 这是什么意思?我已多次重新下载javacv软件包,但它总是一样的。
任何帮助都会有用,谢谢!
凯文:)