在opencv中加载时出现分段错误

时间:2019-07-12 10:19:40

标签: java linux opencv debian

我的代码使用opencv在Java中的Linux debian Stretch上运行。 我已经编译了opencv 411,并将.jar和.so放到正确的位置。 加载opencv库时应用程序崩溃。

public class ObjectTracking {
    public static void main(String[] args) {    
        System.out.println("ObjectTracking::main");     
        try {
            ObjectTracking ot = new ObjectTracking();
            ot.run();
        } catch( Exception ex1) {
            System.out.println("ObjectTracking::main > exception > " + ex1.getMessage());
        }
    }

    /**/
    public ObjectTracking() {               
        System.out.println("ObjectTracking::constructor...");       
        try {
            System.out.println("ObjectTracking::constructor > opencv lib to load is <" + Core.NATIVE_LIBRARY_NAME + "> ...");
            System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
            System.out.println("ObjectTracking::constructor > lib loaded...");
        } catch( Exception ex1) {
            System.out.println("System.loadLibrary fails > " + ex1.getMessage());
            return;
        }
    ...

因此,日志为:

[Loaded java.lang.Void from /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/jre/lib/rt.jar]
ObjectTracking::main
ObjectTracking::constructor...
[Loaded org.opencv.core.Core from file:/root/java/ObjectTracking/libs/opencv/opencv-411.jar]
[Loaded org.opencv.core.MatOfDouble from file:/root/java/ObjectTracking/libs/opencv/opencv-411.jar]
[Loaded org.opencv.core.MatOfInt from file:/root/java/ObjectTracking/libs/opencv/opencv-411.jar]
ObjectTracking::constructor > opencv lib to load is <opencv_java411> ...
[Loaded java.lang.ClassLoaderHelper from /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/jre/lib/rt.jar]
Segmentation fault
root@NEXO-ROAD-1602-0F64FF:~/java/ObjectTracking#

有什么想法吗?

最诚挚的问候。

0 个答案:

没有答案