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); } }
public LMFrame(JObject jObject) { //JObject jObject = JObject.Parse(jsonData); Id = (long)jObject.GetValue("id"); TimeStamp = (long)jObject.GetValue("timeStamp"); string leftBitmapBase64Str = (string)jObject.GetValue("leftCamImg"); string rightBitmapBase64Str = (string)jObject.GetValue("rightCamImg"); LeftCamImg = Helper.ImageHelper.imageFromString(leftBitmapBase64Str); RightCamImg = Helper.ImageHelper.imageFromString(rightBitmapBase64Str); Hands = new List <LMHand>(); foreach (JObject obj in (JArray)jObject["hands"]) { LMHand hand = new LMHand(obj); Hands.Add(hand); } }