How to use the FaceRecognizer library created in openCV from Java?

て烟熏妆下的殇ゞ 提交于 2019-12-11 01:43:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!