public static FaceModel Create(float scale, RootSystem.Collections.Generic.Dictionary <Microsoft.Kinect.Face.FaceShapeDeformations, float> faceShapeDeformations) { int _faceShapeDeformationsKeys_idx = 0; var _faceShapeDeformationsKeys = new Microsoft.Kinect.Face.FaceShapeDeformations[faceShapeDeformations.Keys.Count]; foreach (var key in faceShapeDeformations.Keys) { _faceShapeDeformationsKeys[_faceShapeDeformationsKeys_idx] = (Microsoft.Kinect.Face.FaceShapeDeformations)key; _faceShapeDeformationsKeys_idx++; } int _faceShapeDeformationsValues_idx = 0; var _faceShapeDeformationsValues = new float[faceShapeDeformations.Values.Count]; foreach (var value in faceShapeDeformations.Values) { _faceShapeDeformationsValues[_faceShapeDeformationsValues_idx] = (float)value; _faceShapeDeformationsValues_idx++; } RootSystem.IntPtr objectPointer = Microsoft_Kinect_Face_FaceModel_ctor(scale, _faceShapeDeformationsKeys, _faceShapeDeformationsValues, faceShapeDeformations.Count); Helper.ExceptionHelper.CheckLastError(); if (objectPointer == RootSystem.IntPtr.Zero) { return(null); } return(Helper.NativeObjectCache.CreateOrGetObject <Microsoft.Kinect.Face.FaceModel>( objectPointer, n => new Microsoft.Kinect.Face.FaceModel(n))); }
public static FaceModel Create(float scale, RootSystem.Collections.Generic.Dictionary<Microsoft.Kinect.Face.FaceShapeDeformations, float> faceShapeDeformations) { int _faceShapeDeformationsKeys_idx=0; var _faceShapeDeformationsKeys = new Microsoft.Kinect.Face.FaceShapeDeformations[faceShapeDeformations.Keys.Count]; foreach(var key in faceShapeDeformations.Keys) { _faceShapeDeformationsKeys[_faceShapeDeformationsKeys_idx] = (Microsoft.Kinect.Face.FaceShapeDeformations)key; _faceShapeDeformationsKeys_idx++; } int _faceShapeDeformationsValues_idx=0; var _faceShapeDeformationsValues = new float[faceShapeDeformations.Values.Count]; foreach(var value in faceShapeDeformations.Values) { _faceShapeDeformationsValues[_faceShapeDeformationsValues_idx] = (float)value; _faceShapeDeformationsValues_idx++; } RootSystem.IntPtr objectPointer = Microsoft_Kinect_Face_FaceModel_ctor(scale, _faceShapeDeformationsKeys, _faceShapeDeformationsValues, faceShapeDeformations.Count); Helper.ExceptionHelper.CheckLastError(); if (objectPointer == RootSystem.IntPtr.Zero) { return null; } return Helper.NativeObjectCache.CreateOrGetObject<Microsoft.Kinect.Face.FaceModel>( objectPointer, n => new Microsoft.Kinect.Face.FaceModel(n)); }