9 Star 15 Fork 14

zhouxiang / ccface

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
opencvfacerecognizer.h 1.46 KB
一键复制 编辑 原始数据 按行查看 历史
zhouxiang 提交于 2015-05-11 21:00 . create pro
#ifndef OPENCVFACERECOGNIZER_H
#define OPENCVFACERECOGNIZER_H
#include <QObject>
#include <vector>
#include <string>
#include "typedef.h"
class OpencvFaceRecognizer : public QObject
{
Q_OBJECT
public:
typedef enum {
FaceRecognizer_Invalid,
FaceRecognizer_Fisher,
FaceRecognizer_Eigen,
FaceRecognizer_LBPH
} FaceRecognizerType;
explicit OpencvFaceRecognizer(QObject *parent = 0);
~OpencvFaceRecognizer();
void loadRecognizer(FaceRecognizerType type = FaceRecognizer_Eigen);
public slots:
void train(Mats src, Ints labels) {
if (!m_ptr.empty()) {
m_ptr->train(src, labels);
m_hadLoad = true;
}
}
void update(Mats src, Ints labels) {
if (!m_ptr.empty()) {
m_ptr->update(src, labels);
m_hadLoad = true;
}
}
int predict(cv::Mat src) const {
int re = -1;
if (!m_ptr.empty() && m_hadLoad) {
re = m_ptr->predict(src);
emit who(re);
}
return re;
}
void save(const std::string& filename) const {
if (!m_ptr.empty()) {
m_ptr->save(filename);
}
}
void load(const std::string& filename) {
if (!m_ptr.empty()) {
m_ptr->load(filename);
}
}
signals:
void who(int i) const;
private:
FaceRecognizerType m_type;
bool m_hadLoad;
cv::Ptr<cv::FaceRecognizer> m_ptr;
};
#endif // OPENCVFACERECOGNIZER_H
C++
1
https://gitee.com/zhouX/ccface.git
git@gitee.com:zhouX/ccface.git
zhouX
ccface
ccface
master

搜索帮助