问题
I am trying to implement a face recognizer in java. I got this code example and made changes to fit my requirements on how the system should behave. It works but then when I have images of the same person in different light intensities its efficiency drops. I read that there is a library inserted in openCV for faceRecognizer but then its samples are implemented in c++. Is there any way i can use this library to code in java? and also if we can use it then will it increase the efficiency of the code?
Please do provide some help on this. Stuck on it badly...
回答1:
You can create a C++ dll for java. You should write a wrapper class (in C++) which uses your C++ codes. Function definitions of the wrapper class should use JNI. This link here should be helpful (it was for me). After you implement the wrapper class, export it as a dll.
回答2:
Just Use java cv so that you can use all c++ function in java. Download all javacv jar files and try to install javacv to your system
Just look through how to setup javacv in your system.
回答3:
I think this should do the magic in java
FaceRecognizer model=createFisherFaceRecognizer(); model.train(images,label);
For prediction Int id=model.predict(img);
来源:https://stackoverflow.com/questions/19048813/how-to-use-the-facerecognizer-library-created-in-opencv-from-java