最近因工作需求在java-web服务中调用人脸识别离线sdk,主要通过JNA及JNI技术,但均未调试通过,JNA调用时出现以下异常,一直未解决,求大佬指点,导常信息如下:
in BaiduFaceApi::sdk_init
deviceId is:XXXXXXXXXXXXXXXXXXXXXXXXXXX
resource path is:\?E: runkXXXcodeserviceXXXIBH-DM~2IBH-DM~4NATIVE~1face-resource
resource path is:\?E: runkXXXcodeserviceXXXIBH-DM~2IBH-DM~4NATIVE~1face-resource
deme.exe basedir:xxxx sign:xxxx devices:xxxx facesize:xxxx
conf facecount : 1
conf feature_type : 1
license file path is:\?E: runkXXXcodeserviceXXXIBH-DM~2IBH-DM~4NATIVE~1x64license.key
Failed to open device! :1.list
cameras init failed !!!
authorize(): 7029907 OK OK successfully
is-live: 0
is-quality: 0
thr-not-face: 0.5
min-face-size: 100
thr-illum: 40
thr-blur: 0.7
thr-occlu: 0.5
thr-pitch: 15
thr-yaw: 15
thr-roll: 15
facecount: 1
detect-intv: 0
tracking-intv: 1000
is-crop: 0
crop-size: 256
enlarge-ratio: 3
score model init ... ..face-resource//assets/score.binary
dection model init..
detect modle path: ..face-resource//assets/facedetect.binary
Exception in thread "main" java.lang.Error: Invalid memory access
at com.sun.jna.Native.invokePointer(Native Method)
at com.sun.jna.Function.invokePointer(Function.java:470)
at com.sun.jna.Function.invokeString(Function.java:651)
at com.sun.jna.Function.invoke(Function.java:395)
at com.sun.jna.Function.invoke(Function.java:315)
at com.sun.jna.Library$Handler.invoke(Library.java:212)
at com.sun.proxy.$Proxy0.match(Unknown Source)
at cn.dataenergy.ibh.controller.TestJNA2.main(TestJNA2.java:27)
异常信息图片为:
C++函数代码为:
Java调用代码为:
根据异常信息可以看出函数是可以调到的,但是在sdk_init()初始化时,初始化到facedetect.binary时报错,目前尚不清楚原因,求大神指点!!!!
另外:离线sdk示例工程在vs下调试,所有函数均可以调通。