facerec.dll for windows 8 x64, for EigenFaceRecognizer
Hey,
I need to write a face recognition program in java but I can't seem to succesfully create the facerec.dll.
I already wrote the Java class:
public class EigenFaceRecognizer extends FaceRecognizer { static { System.loadLibrary("facerec"); }
private static native long createEigenFaceRecognizer_0();
private static native long createEigenFaceRecognizer_1(int num_components);
private static native long createEigenFaceRecognizer_2(int num_components, double threshold);
public EigenFaceRecognizer () {
super(createEigenFaceRecognizer_0());
}
public EigenFaceRecognizer (int num_components) {
super(createEigenFaceRecognizer_1(num_components));
}
public EigenFaceRecognizer (int num_components, double threshold) {
super(createEigenFaceRecognizer_2(num_components, threshold));
}
}
But, as I said earlier, I can't create the facerec.dll for it and I'm trying for a couple of days and nothing is working.
I have opencv 2.4.8 extracted (C:\opencv), jdk 8_11 (C:\Program Files\Java\jdk1.8.0_11), mingw for windows 64 bits, windows 8 64 bits as operating system and netbeans 8.
Thx
If I try:
g++ facerec.cpp -I"C:\opencv\build\include" -I"C:\Program Files\Java\jdk1.8.0_11\include" -I"C:\Program Files\Java\jdk1.8.0_11\include\win32" -L"C:\opencv\build\x64\vc11\lib" -lopencv_contrib248 -lopencv_core248 -lopencv_ml248 -o facerec.dll
I get:
C:\Users\Robert\AppData\Local\Temp\ccVvdrS9.o:facerec.cpp:(.text+0x4c): undefine
d reference to cv::createFisherFaceRecognizer(int, double)'
C:\Users\Robert\AppData\Local\Temp\ccVvdrS9.o:facerec.cpp:(.text+0x101): undefin
ed reference to
cv::createFisherFaceRecognizer(int, double)'
C:\Users\Robert\AppData\Local\Temp\ccVvdrS9.o:facerec.cpp:(.text+0x1b5): undefin
ed reference to cv::createFisherFaceRecognizer(int, double)'
C:/Program Files/mingw-w64/x86_64-4.9.1-win32-seh-rt_v3-rev0/mingw64/bin/../lib/
gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users
\Robert\AppData\Local\Temp\ccVvdrS9.o: bad reloc address 0x0 in section
.pdata$
_ZN7JNIEnv_9FindClassEPKc'
collect2.exe: error: ld returned 1 exit status
you can't use the vs libs with mingw. sad as it is, you will have to rebuild the opencv libs locally (using cmake), before you can continue (or use cl.exe as compiler, if available)
your cmdline needs -shared -ldl (to make a dll, not an exe)
the FaceRecognizer interface is pretty much in flux atm, 2 updates in the last weeks, 2 more pending
Can you tell me how should I rebuild with cmake the opencv libs locally, please? Thx for the -shared -ldl :D
this worked for me (well, some weeks a go...)
And if I get CMake Error: The source directory "C:/opencv" does not appear to contain CMakeLi sts.txt. ?
locate CMakeLists.txt and point cmake at the folder.
here is how it should look like
(unfortunately, i'm no more familiar with how the souceforge package looks like exactly)
Sorry for the many questions and thx for the help. Now I'm getting:
CMake Error at CMakeLists.txt:62 (include): include could not find load file: cmake/OpenCVUtils.cmake
Btw, how can I point cmake to the CMakeLists.txt? I copied it to C:/opencv and I think that's why it doesn't work now.
I succesfully rebuilt with mingw. Now I have a little error with the "-ldl" flag you told me to use. -shared it's ok but -ldl doesnt seem to exist (I tried even -dl like I saw on your other posts but nothing). Can I create dll without it?
isnt it just -dll and a typo on beraks behalft?
I used only the -shared -o facerec.dll and it created the facerec.dll. Is it ok?
oh, -ldl must be from an older mingw version (or even plain wrong. no idea, where that crept in)
so try with just -shared.