- 基本流程:
输入人脸->人脸数据表示->LBPH特征提取+人脸图像与特征数据库->分类识别->识别人脸
- LBPH算法:
图像灰度化->LBP特征提取->ULBP降维处理->分割为多个方格(Cell)->每个方格生成直方图->直方图链接,特征向量集合->与DB中直方图比较(直方图比较)->得到分类结果
Ptr<LBPHFaceRecognizer> model = LBPHFaceRecognizer::create();
#include <opencv2/opencv.hpp>
#include <opencv2/face.hpp>
#include <iostream>
using namespace std;
using namespace cv;
using namespace cv::face;
int main(int argc, char** argv)
{
String filename = string("face_image.txt");
ifstream file(filename.c_str(), ifstream::in);
if (!file)
{
cout << "could not load label_file"