c++ - 使用 FaceRecognizer OpenCV 训练人脸以获得最佳结果的最佳方法是什么?

标签 c++ opencv image-processing face-recognition

这里说一下我尝试过很多tutorials在 OpenCV 3.2 中通过使用 Face 模块中的 FaceRecognizer 类来实现人脸识别。但我并没有得到我希望的接受的结果。

这里我想问,我想知道,在训练和识别过程中最好的方法是什么或者需要注意什么?

我为提高准确性所做的工作:

  • 创建(至少)10 个面孔,以最佳质量、尺寸和角度训练每个人。
  • 尝试使脸部适合图像。
  • 均衡图像的 HIST

然后我又尝试了三个人脸识别器(EigenFaceRecognizer、FisherFaceRecognizer、LBPHFaceRecognizer),结果都是一样的,但是识别率确实很低,我只训练了三个人,也识别不了好吧(第一个人被识别为第二个人等等问题)。

问题:

  • 训练和识别图像必须来自同一个 相机?
  • 是否手动裁剪训练图像(photoshop -> 读取图像然后训练)或此任务 必须以编程方式完成(检测->裁剪->调整大小然后训练)?
  • 每个人脸识别器的最佳参数是什么(int num_components,双阈值)
  • 以及如何设置训练算法在未知时返回-1 人。

最佳答案

扩展我的评论,掌握 OpenCV 中的第 8 章提供了关于预处理人脸以帮助识别过程的非常有用的技巧,例如:

  • 仅在检测到双眼时才采集样本(通过 haar 级联)
  • Geometrical transformation and cropping: This process would include scaling, rotating, and translating the images so that the eyes are aligned, followed by the removal of the forehead, chin, ears, and background from the face image.

  • Separate histogram equalization for left and right sides: This process standardizes the brightness and contrast on both the left- and right-hand sides of the face independently.

  • Smoothing: This process reduces the image noise using a bilateral filter.

  • Elliptical mask: The elliptical mask removes some remaining hair and background from the face image.

我在my fork of the example code中添加了一个hacky加载/保存,请随意尝试/根据需要调整它。目前还非常有限,但这是一个开始。

此外,您还应该检查OpenFace and it's DNN face recognizer 。 我还没有玩过,所以无法提供详细信息,但它看起来真的很酷。

关于c++ - 使用 FaceRecognizer OpenCV 训练人脸以获得最佳结果的最佳方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44752330/

相关文章:

performance - 在 opencv 中执行 alpha 掩码的最有效方法是什么?

python - SWIG 教程问题

c++ - 使用 boost json 读取 json 消息

python - 点检测和圆区域选择

OpenCV:移动单相机的旋转矩阵和平移向量

c - 我如何知道 char* 缓冲区是否包含单色图像?

opengl - 用于图像处理的 GPU 编程

c++ - 链表 pop() 函数

c++ - 在程序的函数中创建对象数组

java - 如何在Android中使用OpenCV去除轮廓的背景?