1 | initial version |
All you probably need is in the chapter 8 of Mastering OpenCV with practical computer vision projects book. The source code is here: https://github.com/MasteringOpenCV/code.
If you have a huge collection of face (not everything in RAM as the code above), you probably need to create a routine which get X faces from a database, compute the score, keep the best, get next X faces from the database, update the best (if needed), etc. until all faces of the database have been compared.
I'm not a specialist of this, but may be you can order your face in a acceleration structure (KD-tree or everything else) and load only useful images from the database. As you can see in the above code, only a norm is used to compare faces (getSimilarity() function), so it will be easy to create a partition of the database according to vector values.