我一直在编写FaceRecognizer库的Java版本。我可以在Java OpenCV项目中成功初始化一个新的FaceRecognizer(默认使用Fisherface)。我用JNA来完成这个。但最近,我发现了#34;火车"方法有bug,所以我决定在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();
它也崩溃了。好像它是&#34; model&#34;的问题。
我真的很感谢你的帮助!非常感谢你!
这是记录的文件:
--------------- 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
答案 0 :(得分:0)
我修好了!是的,这是“createFisherFaceRecognizer()”的一个问题,因为它来自“cv.hpp”。它出现在Visual Studio的IntelliSnse中,因为它来自Cv类,但我没有导入正确的库。我在每个opencv.lib文件的末尾添加了一个“d”,我还导入了cvcore和cvcorex。现在它有效。如果你有像我这样的问题,可能就是这样。一旦完成,我将很乐意分享我的代码。