I have been programming a Java version of the FaceRecognizer library. I can successfully initialize a new FaceRecognizer (with Fisherface as default) in my Java OpenCV project. I used JNA to accomplish this. But recently, I found out that the "train" method has bugs so I decided to do the entire recognition in the DLL file and return a double value at last. But when I made a new FaceRecognizer like this:
Ptr<FaceRecognizer> model = Algorithm::create<FaceRecognizer>("FaceRecognizer.Fisherfaces");
or
Ptr<FaceRecognizer> model = createFisherFaceRecognizer();
it does compile and build successfully! But when I use them to train like this:
model->train(libList,idList);
(libList is vector and idList is vector)
the JVM (through JNA to my Java OpenCV project).
It says :
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]
I am guessing it is something to do with reference or pointer because even if I run
model->name();
it also crashes. Seems like it is a problem with "model". I truly appreciate all of your help! Thank you very much!
This is the logged file:
--------------- 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
I got it fixed! Yes, it is a problem with the " createFisherFaceRecognizer() " because it is derived from " cv.hpp". It shows up in the IntelliSnse of Visual Studio because it is from class Cv but I didn't import the correct libraries. I added a " d" to the end of each opencv.lib file and I also imported cvcore and cvcorex. Now it works. If you have problems like mine, it is probably such. I will happily share my code once I am done.