Ask Your Question

OpenCv 3.4.0 FaceRecognizer was removed?

asked 2018-01-26 19:04:40 -0500

blaisexen gravatar image

But I see this document,

What's the read truth, I searched for word "lbph" or "recognizer", it can't be found in the sources

if was NOT removed,, where it was?

edit retag flag offensive close merge delete


BUT IF FaceRecognizer was removed from Opencv3.4.0 why when I used SharpOpenCv why still it was there? Confusing...

blaisexen gravatar imageblaisexen ( 2018-01-27 08:20:47 -0500 )edit

problem solved, I included the /modules/contrib(of opencv24.13.5) folder to /modules(of opencv3.4.0), and build a x86 dlls and libs :D then going to use it for my c++ builder experiments along with dll wrappers.

but I'm interested to see how DNN is accurately good for face recognition as @berak and @phillity suggestions,

thank you Masters, so grateful that you replied :D

blaisexen gravatar imageblaisexen ( 2018-01-28 18:16:30 -0500 )edit

oh men, contrib dll was not compiled, tsk..tsk..

blaisexen gravatar imageblaisexen ( 2018-01-28 18:44:11 -0500 )edit

error this is a compatibility header which should not be used inside the OpenCV library


blaisexen gravatar imageblaisexen ( 2018-01-28 18:45:54 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2018-01-27 03:30:58 -0500

berak gravatar image

updated 2018-01-28 06:48:39 -0500

alternatively, you could use opencv's new dnn module with a pretrained FaceNet model for face recognition:

dnn::Net net = dnn::readNetFromTorch("openface.nn4.small2.v1.t7");

Mat inputBlob = dnn::blobFromImage(image, 1./255, Size(96,96), Scalar(), true, false);
Mat feature = net.forward().clone();


careful here, the output of net.forward() points to the last (internal) network blob, so we need a clone() to get distinctive results !

then, use those 128 float feature vectors, to simply compare images :

double distance = norm(feature1, feature2);

or, train your favourite ml or clustering algorithm using those.

edit flag offensive delete link more


upon your testing is it tested that is better than lbph face recognizer?

blaisexen gravatar imageblaisexen ( 2018-01-27 08:18:57 -0500 )edit

"better" always depends on your context, but here are some pro's:

  • it's the state of the art
  • you can use color images
  • you're not restricted to a "framework", that does an explicit "identification from a database" task, you can do authentication / verification, too !
  • you can experiment with your own distance functions / ml algo's. (though the paper uses a straight L2 norm)

and some con's:

  • you have to write your own code. there is no boiler-plate code, apart from the above.
  • 120 cnn network layers really take their time. (but again, comparing only 128 features later is fast)
  • not very good, if you have to use grayscale images for some reason
  • large classifier (~30mb) apart from your own data
berak gravatar imageberak ( 2018-01-27 08:36:13 -0500 )edit

do you have a binary application that I can test?

you can use color images and in opencv facerecognizer(lbph,eigen,fisher) can used colored image too but you have to convert it to grayscale before training and prediction,

large classifier (~30mb) apart from your own data large classifier is just fine, as long it's more accurate than lbph,

you have to write your own code. there is no boiler-plate code, apart from the above. the problem is maybe it doesn't tell if the face is "unknown" or has name, that's the worst of all, programming is not magic

and which do you think it's better? the new openface by opencv or this?

blaisexen gravatar imageblaisexen ( 2018-01-27 09:53:24 -0500 )edit

there are some experiments here , but you'll have to compile on your own.

berak gravatar imageberak ( 2018-01-27 09:57:49 -0500 )edit

thanks for the info, I will try my best to compile and run it under windows 7, and test which is the best and accurate.

blaisexen gravatar imageblaisexen ( 2018-01-27 10:40:27 -0500 )edit

answered 2018-01-27 00:00:03 -0500

phillity gravatar image

updated 2018-01-27 00:02:21 -0500

If you're looking for the LBPHFaceRecognizer documentation, look here

The corresponding code is still apart of the face contrib module. It can be found in the contrib repository here

edit flag offensive delete link more


so it was removed from the original source location? I can only use the class from opencv2.4.13.5

blaisexen gravatar imageblaisexen ( 2018-01-27 02:18:00 -0500 )edit

please read this and see this for an alternative (maybe better )

sturkmen gravatar imagesturkmen ( 2018-01-27 02:29:46 -0500 )edit

so thankful for the information you have, so it was really removed from the original source location and added openface, do you have any link that would lead to windows desktop and web application?

blaisexen gravatar imageblaisexen ( 2018-01-27 03:10:56 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-01-26 19:04:40 -0500

Seen: 325 times

Last updated: Jan 28