Compression Digest
compression/_posts/2015-03-06-facerecognition_with_opencv.md
Face Recognition Techniques with OpenCV
[Literal] This post summarizes approaches and ideas for face recognition using OpenCV, focusing on geometric features, Eigenfaces, and Local Binary Patterns Histograms (LBPH).
[Literal] Geometric features utilize marker points like eyes, ears, and noses to build feature vectors based on distances and angles.
[AI Synthesis] The core idea behind Eigenfaces is dimensionality reduction, assuming facial images can be represented in a lower-dimensional subspace capturing most of the variance.
[Literal] Eigenfaces uses Principal Component Analysis (PCA) to find this lower-dimensional subspace with maximum variance.
[AI Synthesis] A computational trick allows for eigenvalue decomposition on a smaller matrix (N x N) instead of the larger image matrix (M x N) when M > N, improving efficiency.
[AI Synthesis] While PCA maximizes variance, it might not be optimal for classification if variance is due to external factors like lighting.
[Literal] OpenCV's createEigenFaceRecognizer API performs PCA and projects data into the subspace.
[Literal] The predict method in Eigenfaces uses L2 distance in the trained subspace to find the closest match.
[AI Synthesis] Fisherfaces is mentioned as another technique, though not detailed in this source.
[AI Synthesis] LBPH focuses on local features, making it implicitly low-dimensional and more robust to illumination variations.
[Literal] Local Binary Patterns (LBP) summarize local structure by comparing pixels with their neighbors.
[Literal] OpenCV'screateLBPHFaceRecognizeruses parameters for LBP creation (radius,neighbors) and spatial histogram grid (grid_x,grid_y).
[Literal] The predict method for LBPH uses the Chi-square test for distance measurement between histograms.
[Literal] Performance evaluation metrics include Receiver Operating Characteristic (ROC) curves, plotting True Acceptance Rate (TAR) against False Acceptance Rate (FAR), and Cumulative Match Characteristic (CMC) curves, which plot identification probability against candidate list size.
Key points
- [Literal] Face recognition can utilize geometric features derived from marker points (eyes, ears, nose).
- [Literal] Eigenfaces employs PCA to reduce dimensionality by finding the subspace with maximum variance in facial image data.
- [Literal] A computational optimization for Eigenfaces involves performing eigenvalue decomposition on an N x N matrix instead of the larger M x N image matrix.
- [Literal] OpenCV provides APIs for Eigenfaces (
createEigenFaceRecognizer) and LBPH (createLBPHFaceRecognizer). - [Literal] LBPH extracts local features using Local Binary Patterns (LBP) and summarizes them into spatial histograms.
- [Literal] LBPH uses the Chi-square test for distance calculation during prediction.
- [Literal] ROC curves assess the trade-off between TAR and FAR, while CMC curves evaluate identification accuracy across different candidate list sizes.
Patterns / reminders
- [AI Synthesis] Dimensionality reduction techniques like PCA (Eigenfaces) are crucial for handling high-dimensional image data in face recognition.
- [AI Synthesis] Local feature extraction methods like LBP (LBPH) offer robustness to variations in illumination and can be more efficient for certain applications.
- [AI Synthesis] Performance evaluation requires specific metrics like ROC and CMC to understand the trade-offs and accuracy of different face recognition algorithms.