您的位置:首页 > 其它

Kinect v2.0原理介绍之九:高清面部帧(2) 面部特征对齐

2015-09-04 20:08 591 查看

~~有兴趣的小伙伴,加kinect算法交流群:462964980。

使用SDK: Kinect for Windows SDK v2.0 public preview1408

根据前一节的说明,这节就是关于面部特征对齐的。
接口为IFaceAlignment,因为SDK还在Beta中,提供官网的连接可能会失效,所以不提供了。

需要可以到微软官方查询。目前,面部特征对齐主要可以干:
0. 获取面部外框 —— 面部帧也能。但是经测试,精度高得多,抖动大概在几像素内
1. 获取头部旋转中心 ——结果是一个相机空间坐标,大致位置就是颈部中心
2. 获取头部旋转四元数 —— 面部帧也能。但是这个精度高,抖动小,抖动范围大致在3°以内。
3. 获取动画单元 —— 目前有高达17种动画单元(高达:谁叫我....)
等等....

动画声明如下:

[cpp]
view plaincopyprint?

enum _FaceShapeAnimations  
    {  
        FaceShapeAnimations_JawOpen = 0,  
        FaceShapeAnimations_LipPucker   = 1,  
        FaceShapeAnimations_JawSlideRight   = 2,  
        FaceShapeAnimations_LipStretcherRight   = 3,  
        FaceShapeAnimations_LipStretcherLeft    = 4,  
        FaceShapeAnimations_LipCornerPullerLeft = 5,  
        FaceShapeAnimations_LipCornerPullerRight    = 6,  
        FaceShapeAnimations_LipCornerDepressorLeft  = 7,  
        FaceShapeAnimations_LipCornerDepressorRight = 8,  
        FaceShapeAnimations_LeftcheekPuff   = 9,  
        FaceShapeAnimations_RightcheekPuff  = 10,  
        FaceShapeAnimations_LefteyeClosed   = 11,  
        FaceShapeAnimations_RighteyeClosed  = 12,  
        FaceShapeAnimations_RighteyebrowLowerer = 13,  
        FaceShapeAnimations_LefteyebrowLowerer  = 14,  
        FaceShapeAnimations_LowerlipDepressorLeft   = 15,  
        FaceShapeAnimations_LowerlipDepressorRight  = 16,  
        FaceShapeAnimations_Count   = ( FaceShapeAnimations_LowerlipDepressorRight + 1 )   
    } ;  

enum _FaceShapeAnimations
{
FaceShapeAnimations_JawOpen	= 0,
FaceShapeAnimations_LipPucker	= 1,
FaceShapeAnimations_JawSlideRight	= 2,
FaceShapeAnimations_LipStretcherRight	= 3,
FaceShapeAnimations_LipStretcherLeft	= 4,
FaceShapeAnimations_LipCornerPullerLeft	= 5,
FaceShapeAnimations_LipCornerPullerRight	= 6,
FaceShapeAnimations_LipCornerDepressorLeft	= 7,
FaceShapeAnimations_LipCornerDepressorRight	= 8,
FaceShapeAnimations_LeftcheekPuff	= 9,
FaceShapeAnimations_RightcheekPuff	= 10,
FaceShapeAnimations_LefteyeClosed	= 11,
FaceShapeAnimations_RighteyeClosed	= 12,
FaceShapeAnimations_RighteyebrowLowerer	= 13,
FaceShapeAnimations_LefteyebrowLowerer	= 14,
FaceShapeAnimations_LowerlipDepressorLeft	= 15,
FaceShapeAnimations_LowerlipDepressorRight	= 16,
FaceShapeAnimations_Count	= ( FaceShapeAnimations_LowerlipDepressorRight + 1 )
} ;


术语:

(FACS)AU: Action Unit,动作单元 参考前一节
(FACS)AD: Action Descriptor, 动作描述符,和AU差不多。

FaceShapeAnimations_JawOpen: 
(微软目前还没有进行说明)就是将下巴张开,下巴张开不一定是张开嘴巴。
FACS编码应该是指AU26(Jaw Drop)

浮点模拟量范围 [0, 1],  都快掉下巴了,才到1,个人建议阈值0.8

FaceShapeAnimations_LipPucker:

撅嘴,FACS编码: AU18
浮点模拟量范围 [0, 1], 本人最大值0.8X.......

FaceShapeAnimations_JawSlideRight:

下巴往右滑动,
FACS编码: R-AD30
浮点模拟量范围
[-1, 1]
,负数表示往左(L-AD30),本人最大值0.2X......

FaceShapeAnimations_LipStretcherRight:

嘴角向右拉伸, FACS编码: R-AU20
浮点模拟量范围
[0, 1]


FaceShapeAnimations_LipStretcherLeft:
嘴角向左拉伸,
FACS编码: L-AU20
[b]浮点模拟量范围
[0, 1]


FaceShapeAnimations_LipCornerPullerLeft:[/b]
拉动嘴角倾斜向左上,
FACS编码: L-AU12

浮点模拟量范围
[0, 1]


FaceShapeAnimations_LipCornerPullerRight:
拉动嘴角倾斜向右上,
FACS编码: R-AU12

浮点模拟量范围
[0, 1]


FaceShapeAnimations_LipCornerDepressorLeft:

拉动嘴角向左下倾斜, FACS编码: L-AU15

浮点模拟量范围
[0, 1]


FaceShapeAnimations_LipCornerDepressorRight:

拉动嘴角向右下倾斜, FACS编码: R-AU15

浮点模拟量范围
[0, 1]


FaceShapeAnimations_LeftcheekPuff:
鼓起左脸颊, FACS编码: L-AD34
浮点模拟量范围
[0, 1]


FaceShapeAnimations_RightcheekPuff:
鼓起右脸颊, FACS编码: R-AD34
浮点模拟量范围
[0, 1]


FaceShapeAnimations_LefteyeClosed:
闭左眼, FACS编码: L-AU43
浮点模拟量范围
[0, 1]


FaceShapeAnimations_RighteyeClosed:
闭右眼, FACS编码: R-AU43
浮点模拟量范围
[0, 1]


(戴着眼镜或者眼睛比较小、离得远的可能就直接识别为闭着眼睛了)

FaceShapeAnimations_RighteyebrowLowerer:
右皱眉, FACS编码: R-AU4
浮点模拟量范围
[-1, 1], 负数表示右眉上挑(
R-AU1+2)

FaceShapeAnimations_LefteyebrowLowerer:
左皱眉, FACS编码: L-AU4
浮点模拟量范围
[-1, 1], 负数表示左眉上挑(
L-AU1+2)

FaceShapeAnimations_LowerlipDepressorLeft:
拉动下唇向左下, FACS编码: L-AU16
浮点模拟量范围
[0, 1]


FaceShapeAnimations_LowerlipDepressorRight:
拉动下唇向右下, FACS编码: R-AU16
浮点模拟量范围
[0, 1]


共计17个单元。使用IFaceAlignment::GetAnimationUnits获取

大致步骤: (参考面部帧)
不同于面部帧的:
         创建高清面部帧源:   CreateHighDefinitionFaceFrameSource
         创建面部特征对齐:    CreateFaceAlignment

使用高清面部帧源,轮询还是事件随意啦,注意跟踪id丢失或者无效。

获取到正确的高清面部帧后,使用
IHighDefinitionFaceFrame::GetAndRefreshFaceAlignmentResult
刷新面部特征对齐对象,之后就可以获取前面所说的4个基本东西了。

这个东西可能会消耗比普通面部帧更大的计算机资源,所以我们这次就对一个人跟踪即可。
效果如下:
(自然也需要"NuiDatabase"文件夹,但是创建高清面部帧的耗时远远小于普通面部帧(感觉不到 vs 5秒钟))

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  kinect 高清面部帧