Summary about Face Recognition with OpenCV
Some ideas and approachments about Face Recognition
geometric feature
- marker points ( position of eyes, ears, noses, ...) are used to build the feature vector (the distance, the angle, ...)
Eigenfaces
Fisherfaces
Local Binary Patterns Histograms (LBPH)
-
idea
-
The focus is only on extracting local features of an object, thus the features in this waywill have a low-dim implicitly.
-
Also, the local description has to be a bit robust against image illumination variations (things like scale,translation or rotation), so the Local Binary Patterns (LBP) is given to summarize the local structure in a image by comparing each pixel with its neighborhood .
-
The API in OpenCV Ptr createLBPHFaceRecognizer(int radius,int neighbors, int grid_x, int grid_y, double threshold) Calculate lbp image
-
elbp(src[sampleIdx],_radius,_neighbors)
- The parameters radius and neighbors are used in the local binary pattern creation
-
Get spatial histogram from this lbp image
Mat p = spatial_histogram(
lbp_image, /* lbp_image */
/* number of possible patterns */
static_cast<int>(std::pow(2.0, static_cast<double>(_neighbors))),
_grid_x, /* grid size x */
_grid_y, /* grid size y */
true)
The parameters *gird_x* and *grid_y* control the grid size of the spatial histograms.
At last the feature vectors (p here is the spatial histogram) are given .
LBPH::predict(InputArray _src, int &minClass, double &minDist)
compareHist(_histograms[sampleIdx], query, CV_COMP_CHISQR)
Chi-square test is used for the distance measure
The Performance
Reference