Kinect for Windows SDK v2.0 开发笔记 (十一) 高清面部帧(2) 面部特征对齐
(转载请注明出处)
使用SDK: Kinect for Windows SDK v2.0 public preview1408
依据前一节的说明,这节就是关于面部特征对齐的。
接口为IFaceAlignment,由于SDK还在Beta中,提供官网的连接可能会失效,所以不提供了。
须要能够到微软官方查询。眼下。面部特征对齐主要能够干:
0. 获取面部外框 —— 面部帧也能。可是经測试,精度高得多,抖动大概在几像素内
1. 获取头部旋转中心 ——结果是一个相机空间坐标,大致位置就是颈部中心
2. 获取头部旋转四元数 —— 面部帧也能。
可是这个精度高。抖动小。抖动范围大致在3°以内。
3. 获取动画单元 —— 眼下有高达17种动画单元(高达:谁叫我....)
等等....
动画声明例如以下:
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
浮点模拟量范围
[0, 1]
FaceShapeAnimations_LipCornerPullerLeft:
拉动嘴角倾斜向左上,
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秒钟))
下载地址: CSDN抽了?
上传了看不到,能够的话,请到笔者的资源列表里面看看。不行再向笔者索要吧
浙公网安备 33010602011771号