1

我已经尽一切可能解决这个错误,我能够在 Windows x86 中运行,但我无法在我的 MacOSX x64 中编译任何东西。

我已经使用 Xcode 和 port -v opencv +python27 选项安装了 OpenCV,所有链接路径都是正确的。我发现不同的一件事是在代码内部

public static final String genericIncludepath    = "/opt/local/include/";
public static final String genericLinkpath       = "/opt/local/lib/:/opt/local/lib64/:/usr/local/lib/:/usr/local/lib64/";

MacOSX 的 genericLinkpath 不包含 lib64。

哪些步骤将重现该问题?1. 尝试运行 HoughLines 或任何示例

什么是预期的输出?你看到了什么呢?

线程“主”java.lang.UnsatisfiedLinkError 中的异常:/private/var/folders/qr/j3rwh4h15fncfqgff8__qvcw0000gn/T/libjniopencv_core2612287037709553365.dylib:库未加载:lib/libopencv_core.2.4.dylib 引用自:/private/var/folders/ qr/j3rwh4h15fncfqgff8__qvcw0000gn/T/libjniopencv_core2612287037709553365.dylib 原因:在 java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1827) at java.lang.ClassLoader 找不到图像。 loadLibrary(ClassLoader.java:1703) 在 java.lang.Runtime.load0(Runtime.java:770) 在 java.lang.System.load(System.java:1020) 在 com.googlecode.javacpp.Loader.loadLibrary(Loader .java:403) 在 com.googlecode.javacpp.Loader.load(Loader.java:342) 在 com.googlecode.javacpp.Loader.load(Loader.java:316) 在 com.googlecode。javacv.cpp.opencv_core.(opencv_core.java:131) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at com.googlecode.javacpp.Loader.load (Loader.java:335) 在 com.googlecode.javacv.cpp.opencv_imgproc.(opencv_imgproc.java:96) 在 java.lang.Class.forName0(Native Method) 在 java.lang.Class.forName(Class.java: 247) 在 com.googlecode.javacpp.Loader.load(Loader.java:335) 在 com.googlecode.javacv.cpp.opencv_highgui.(opencv_highgui.java:91) 在 com.javacv.HoughLines.main(HoughLines.java: 32)forName0(Native Method) at java.lang.Class.forName(Class.java:247) at com.googlecode.javacpp.Loader.load(Loader.java:335) at com.googlecode.javacv.cpp.opencv_highgui.(opencv_highgui .java:91) 在 com.javacv.HoughLines.main(HoughLines.java:32)forName0(Native Method) at java.lang.Class.forName(Class.java:247) at com.googlecode.javacpp.Loader.load(Loader.java:335) at com.googlecode.javacv.cpp.opencv_highgui.(opencv_highgui .java:91) 在 com.javacv.HoughLines.main(HoughLines.java:32)

您使用的是什么版本的产品?在什么操作系统上?macOS X 10.7.4

$ java -version java version "1.6.0_31" Java(TM) SE Runtime Environment (build 1.6.0_31-b04-415-11M3646) Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01-415, 混合模式) )

JAVACV——javacv-bin-20120512

echo $PATH /opt/local/include:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/ X11/箱

$ ls | grep opencv opencv_createsamples opencv_haartraining opencv_performance opencv_traincascade

$ ls | grep opencv libopencv_calib3d.2.4.0.dylib libopencv_calib3d.2.4.dylib libopencv_calib3d.dylib libopencv_contrib.2.4.0.dylib libopencv_contrib.2.4.dylib libopencv_contrib.dylib libopencv_core.2.4.0.dylib libopencv_core.2.4.dylib libopencv_core.dylib libopencv_features2d .0.dylib libopencv_features2d.2.4.dylib libopencv_features2d.dylib libopencv_flann.2.4.0.dylib libopencv_flann.2.4.dylib libopencv_flann.dylib libopencv_gpu.2.4.0.dylib libopencv_gpu.2.4.dylib libopencv_gpu.dylib libopencv_highgui.2.4.0.dylib libopencv_high .2.4.dylib libopencv_highgui.dylib libopencv_imgproc.2.4.0.dylib libopencv_imgproc.2.4.dylib libopencv_imgproc.dylib libopencv_legacy.2.4.0.dylib libopencv_legacy.2.4.dylib libopencv_legacy.dylib libopencv_ml.2.4.0.dylib libopencv_ml.2.4.dylib libopencv_ml .dylib libopencv_nonfree.2.4.0.dylib libopencv_nonfree.2.4。

    System.out.println(System.getProperty("os.arch"));  x86_64
System.out.println(System.getProperty("sun.arch.data.model")); 64
4

0 回答 0