public LMFinger(JObject obj) { FingerID = (int)obj.GetValue("fingerId"); FingerType = (string)obj.GetValue("fingerType"); Width = (float)obj.GetValue("width"); Length = (float)obj.GetValue("length"); Bones = new List <LMBone>(); foreach (JObject boneObj in (JArray)obj["bones"]) { LMBone bone = new LMBone(boneObj); Bones.Add(bone); } }
public LMFrame(Frame aFrame, string humanSign) { //frame = aFrame; Id = aFrame.Id; TimeStamp = aFrame.Timestamp; HumanSign = humanSign; try { LeftCamImg = Helper.ImageHelper.generateBitmapFromLeapImage(aFrame.Images[0]); RightCamImg = Helper.ImageHelper.generateBitmapFromLeapImage(aFrame.Images[1]); } catch (Exception e) { FileHelper.saveDebugString("Image creatation" + e.Data.ToString()); } if (LeftCamImg == null) { FileHelper.saveDebugString("LMFRame creation : " + aFrame.Images[0].ToString()); } Hands = new List <LMHand>(); foreach (Hand aHand in aFrame.Hands) { List <LMFinger> fingers = new List <LMFinger>(); foreach (Finger afinger in aHand.Fingers) { List <LMBone> bones = new List <LMBone>(); foreach (Bone.BoneType boneType in (Bone.BoneType[])Enum.GetValues(typeof(Bone.BoneType))) { Bone bone = afinger.Bone(boneType); LMBone lmBone = new LMBone(boneType.ToString(), bone.PrevJoint, bone.NextJoint, bone.Direction); bones.Add(lmBone); } LMFinger lmFinger = new LMFinger(afinger.Id, afinger.Type.ToString(), afinger.Width, afinger.Length, bones); fingers.Add(lmFinger); } LMHand lmHand = new LMHand(aHand.IsLeft, aHand.Id, aHand.GetType().ToString(), aHand.PalmPosition, aHand.PalmNormal, aHand.Direction, aHand.Arm.Direction, aHand.Arm.WristPosition, aHand.Arm.ElbowPosition, fingers); Hands.Add(lmHand); } }