centos操作系统 ,opencv, java调用编译后的opencv动态链接库报错
时间: 2014-10-24来源:开源中国
前景提要
HDC调试需求开发(15万预算),能者速来!>>>
各位大牛好:
遇到一个棘手问题需要请教各位有opencv经验开发的大牛。
在centos6.5/opencv2.4.9/jdk1.7/cmake3.0环境下,编译opencv 并支持java模块,编译成功后,通过opencv编译后的build 生成的test jar文件测试。
cmake命令: cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_FAT_JAVA_LIB=ON ..
测试语句如下:
java -cp opencv-test.jar:../../lib/junit-4.11.jar -Djava.ext.dirs=/home/opencv/opencv_test/libs -Djava.library.path=/home/opencv/opencv-2.4.9/lib org.junit.runner.JUnitCore org.opencv.test.objdetect.CascadeClassifierTest
运行后,始终报异常,异常信息如下:
[root @localhost jar]# java -cp opencv-test.jar:../../lib/junit-4.11.jar -Djava.ext.dirs=/home/opencv/opencv_test/libs -Djava.library.path=/home/opencv/opencv-2.4.9/build2/lib org.junit.runner.JUnitCore org.opencv.test.objdetect.CascadeClassifierTest
JUnit version 4.11
.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E
Time: 0.034
There were 17 failures:
1) testDetectMultiScaleMatListOfRectListOfIntegerListOfDoubleDoubleIntIntSizeSize(org.opencv.test.objdetect.CascadeClassifierTest)
java.lang.UnsatisfiedLinkError: org.opencv.core.Core.setErrorVerbosity_0(Z)V
at org.opencv.core.Core.setErrorVerbosity_0(Native Method)
at org.opencv.core.Core.setErrorVerbosity(Core.java:6638)
at org.opencv.test.OpenCVTestCase.setUp(Unknown Source)
at org.opencv.test.objdetect.CascadeClassifierTest.setUp(Unknown Source)
at junit.framework.TestCase.runBare(TestCase.java:139)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:129)
at junit.framework.TestSuite.runTest(TestSuite.java:255)
at junit.framework.TestSuite.run(TestSuite.java:250)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
at org.junit.runners.Suite.runChild(Suite.java:127)
at org.junit.runners.Suite.runChild(Suite.java:26)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
at org.junit.runner.JUnitCore.run(JUnitCore.java:117)
at org.junit.runner.JUnitCore.runMain(JUnitCore.java:96)
at org.junit.runner.JUnitCore.runMainAndExit(JUnitCore.java:47)
at org.junit.runner.JUnitCore.main(JUnitCore.java:40)
并且自己编写代码调用链接库也是报错:
下面粘出部分代码和报错信息:
System.out.println("\nRunning DetectFaceDemo");
// 导入opencv的库
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

System.out.println("opencv version: "+Core.VERSION);

CascadeClassifier faceDetectorAll = new CascadeClassifier();
报错信息:
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.objdetect.CascadeClassifier.CascadeClassifier_0()J
at org.opencv.objdetect.CascadeClassifier.CascadeClassifier_0(Native Method)
at org.opencv.objdetect.CascadeClassifier.<init>(CascadeClassifier.java:38)
at com.tcl.uviewer.features.featuresImpl.Test.detectFace(Test.java:23)
at com.tcl.uviewer.features.featuresImpl.Test.main(Test.java:51)
以上是请求帮助详细信息,还请各位大牛指点迷津,万分感谢。

科技资讯:

科技学院:

科技百科:

科技书籍:

网站大全:

软件大全:

热门排行