gpt4 book ai didi

java - Opencv JNA&C++ FaceRecognizer导致JVM崩溃

转载 作者:太空宇宙 更新时间:2023-11-04 13:54:29 24 4
gpt4 key购买 nike

我一直在编写 FaceRecognizer 库的 Java 版本。我可以在我的 Java OpenCV 项目中成功初始化一个新的 FaceRecognizer(默认使用 Fisherface)。我用 JNA 来完成这个。但是最近,我发现“train”方法有错误,所以我决定在DLL文件中进行整个识别,最后返回一个double值。但是当我像这样制作一个新的 FaceRecognizer 时:

Ptr<FaceRecognizer> model = Algorithm::create<FaceRecognizer>("FaceRecognizer.Fisherfaces");

Ptr<FaceRecognizer> model = createFisherFaceRecognizer();

它确实编译和构建成功!但是当我像这样使用它们进行训练时:

model->train(libList,idList);

(libList 是 vector ,idList 是 vector )

JVM(通过 JNA 到我的 Java OpenCV 项目)。

它说:

A fatal error has been detected by the Java Runtime Environment:

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x60b2510b, pid=31264, tid=13256

Problematic frame:
C [opencv_core248.dll+0x510b]

我猜这与引用或指针有关,因为即使我运行

model->name();

它也崩溃了。似乎这是“模型”的问题。非常感谢您的帮助!非常感谢!

这是记录的文件:

---------------  T H R E A D  ---------------

Current thread (0x0008bc00): JavaThread "main" [_thread_in_native, id=13256, stack(0x01070000,0x010c0000)]

siginfo: ExceptionCode=0xc0000005, reading address 0x00000000

Registers:
EAX=0x010bf098, EBX=0x00000000, ECX=0x00000000, EDX=0x08da0174
ESP=0x010bf08c, EBP=0x010bf0a4, ESI=0x010bf0b0, EDI=0x010bf3e4
EIP=0x60b2510b, EFLAGS=0x00010286

Top of Stack: (sp=0x010bf08c)
0x010bf08c: bdaf0099 010bf0b0 00000000 010bf3e4
0x010bf09c: 60c941e9 ffffffff 010bf3f0 61e42598
0x010bf0ac: 010bf198 bdac87d8 010bf490 00000000
0x010bf0bc: 00000000 010bf148 010bf148 010bf120
0x010bf0cc: 010bf120 cccccccc 00000000 cccccccc
0x010bf0dc: cccccccc 42ff0000 00000000 00000000
0x010bf0ec: 00000000 00000000 00000000 00000000
0x010bf0fc: 00000000 00000000 00000000 010bf0e8

Instructions: (pc=0x60b2510b)
0x60b250eb: a1 00 00 00 00 50 51 56 a1 e0 37 d1 60 33 c5 50
0x60b250fb: 8d 45 f4 64 a3 00 00 00 00 c7 45 f0 00 00 00 00
0x60b2510b: 8b 01 8b 75 08 8b 50 0c 56 ff d2 8b c8 e8 e3 f7
0x60b2511b: ff ff c7 45 fc 00 00 00 00 c7 45 f0 01 00 00 00


Register to memory mapping:

EAX=0x010bf098 is pointing into the stack for thread: 0x0008bc00
EBX=0x00000000 is an unknown value
ECX=0x00000000 is an unknown value
EDX=0x08da0174 is an unknown value
ESP=0x010bf08c is pointing into the stack for thread: 0x0008bc00
EBP=0x010bf0a4 is pointing into the stack for thread: 0x0008bc00
ESI=0x010bf0b0 is pointing into the stack for thread: 0x0008bc00
EDI=0x010bf3e4 is pointing into the stack for thread: 0x0008bc00

最佳答案

我修好了!是的,这是“createFisherFaceRecognizer()”的问题,因为它源自“cv.hpp”。它出现在 Visual Studio 的 IntelliSnse 中,因为它来自 Cv 类,但我没有导入正确的库。我在每个 opencv.lib 文件的末尾添加了一个“d”,并且还导入了 cvcore 和 cvcorex。现在可以了。如果你有像我这样的问题,那可能就是这样。完成后,我会很乐意分享我的代码。

关于java - Opencv JNA&C++ FaceRecognizer导致JVM崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22117353/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com