// face_recog_from_video.cpp 定义控制台应用程序的入口点。
// train_PCA_model.cpp
//用于训练人脸识别所需的pCA模型
//#include "stdafx.h"
#include"opencv2/opencv.hpp"
#include"opencv2/core.hpp"
#include"opencv2/imgproc.hpp"
#include"opencv2/highgui.hpp"
#include"opencv2/face.hpp" // 包含FaceRecognizer
#include<iostream>
using namespace std;
using namespace cv;
using namespace cv::face;
static void read_csv(const string& filename, vector<Mat>& images, vector<int>& labels, int max, int min, char separator);
int CountMax = 9, CountMin = 0;
int main(int argc, char *argv[])
{
string csvFile = "D:\\projects\\orl_faces\\at.txt";
vector<Mat> images;
vector<int> labels;
// 读取csv文件
try
{
read_csv(csvFile, images, labels, CountMax, CountMin, ';'); //读取csvFile中所有的img和label
}
catch (cv::Exception& e) // 异常检查
{ // cerr:输出到标准
opencv 使用face类训练人脸分类器
最新推荐文章于 2023-06-17 20:14:59 发布