facerec.dll for windows 8 x64, for EigenFaceRecognizer

asked 2014-08-12 09:22:36 -0600

RobertM gravatar image

updated 2014-08-13 05:44:44 -0600

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 tocv::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

edit retag flag offensive close merge delete

Comments

1
  • 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

berak gravatar imageberak ( 2014-08-13 05:43:45 -0600 )edit

Can you tell me how should I rebuild with cmake the opencv libs locally, please? Thx for the -shared -ldl :D

RobertM gravatar imageRobertM ( 2014-08-13 05:55:51 -0600 )edit
2

this worked for me (well, some weeks a go...)

berak gravatar imageberak ( 2014-08-13 05:58:34 -0600 )edit

And if I get CMake Error: The source directory "C:/opencv" does not appear to contain CMakeLi sts.txt. ?

RobertM gravatar imageRobertM ( 2014-08-13 06:20:56 -0600 )edit
1

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)

berak gravatar imageberak ( 2014-08-13 06:23:59 -0600 )edit
1

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.

RobertM gravatar imageRobertM ( 2014-08-13 06:49:39 -0600 )edit

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?

RobertM gravatar imageRobertM ( 2014-08-13 08:17:30 -0600 )edit
1

isnt it just -dll and a typo on beraks behalft?

StevenPuttemans gravatar imageStevenPuttemans ( 2014-08-13 08:20:27 -0600 )edit
1

I used only the -shared -o facerec.dll and it created the facerec.dll. Is it ok?

RobertM gravatar imageRobertM ( 2014-08-13 08:30:21 -0600 )edit
2

oh, -ldl must be from an older mingw version (or even plain wrong. no idea, where that crept in)

so try with just -shared.

berak gravatar imageberak ( 2014-08-13 08:33:26 -0600 )edit