如何对齐面部图像c ++ opencv [英] How to align face images c++ opencv

查看:250
本文介绍了如何对齐面部图像c ++ opencv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发面向身份验证的C ++应用程序。首先,我必须检测脸部并预处理图像。


  1. 对于脸部检测,我使用了HaarCascadeClassifier。问题是,这个工具或这个算法给我一个面部区域检测到一个有点大的矩形,包括头发和一些背景。有改变这个矩形的维度的解决方案吗?我使用frontalfacecascaadclassifier.xml。

  2. 对于面部预处理,我想做面部对齐完全像这种技术

不能再使用另一个Haar分类器找到每只眼睛(眼睛很容易找到),然后假定这个人有两只眼睛,我们定义一个水平的脸,意味着眼睛是水平的。



测量两只眼睛之间的距离并以该角度旋转图像。

  angle = atan(eye1.Y- eye2.Y )/(eye1.X-eye2.X)


I am developing a C++ application for face authentication. First, I have to detect the face and pre-process the image.

  1. For face detection I have used the HaarCascadeClassifier. The problem is that the this tool or this algorithm gives me a facial region detected by a little bit large rectangle that englobes hair and some of the background. Is there a solution to change the dimension of this rectangle? I used "frontalfacecascaadclassifier.xml".
  2. For face pre-processing i want to do face alignment exactly like this technique. How would I go about accomplishing this?

解决方案

Can't you then use another Haar classifier to find each eye (eyes are very easy to find) then assuming the person has two eyes and we define a 'level' face to mean the eyes are horizontal.

Simply measure the anlge between the two eyes and rotate the image by that angle.

angle = atan ( eye1.Y - eye2.Y ) / (eye1.X - eye2.X )

这篇关于如何对齐面部图像c ++ opencv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆