public List <Tuple <double, double, List <List <Point3D> > > > determineLimb(PointCloud pcdexisting, double weight) { //pull in skeleton measures from a temporary file for corbett.parse for now. kinectInterp = new KinectInterpreter(skeloutline); Dictionary <String, double[]> jointDepthsStr = new Dictionary <String, double[]>(); //temporary tuple for results Tuple <double, double, List <List <Point3D> > > T = new Tuple <double, double, List <List <Point3D> > >(0, 0, null); //permanent list of tuples for passing back to coreLoader List <Tuple <double, double, List <List <Point3D> > > > limbMeasures = new List <Tuple <double, double, List <List <Point3D> > > >(); //Test if we have a kinect otherwise we cannot use coordinate mapper. if (KinectSensor.KinectSensors.Count > 0) { //test if we have already enumerated joint depths, if so, this has followed a recent scan. if (jointDepths.Count == 0) { StreamReader sr = new StreamReader("SKEL.ptemp"); String line; while ((line = sr.ReadLine()) != null) { String[] joint = Regex.Split(line, ":"); String[] positions = Regex.Split(joint[1], ","); double[] jointPos = { Convert.ToDouble(positions[0]), Convert.ToDouble(positions[1]), Convert.ToDouble(Regex.Split(positions[2], "\n")[0]) }; //convert to depth co-ordinate space SkeletonPoint sp = new SkeletonPoint(); sp.X = (float)Convert.ToDouble(jointPos[1]); sp.Y = (float)Convert.ToDouble(jointPos[2]); sp.Z = (float)Convert.ToDouble(jointPos[0]); CoordinateMapper cm = new CoordinateMapper(kinectInterp.kinectSensor); DepthImagePoint dm = cm.MapSkeletonPointToDepthPoint(sp, DepthImageFormat.Resolution640x480Fps30); //convert x and y co-ords to arbitrary point cloud space Tuple <double, double, double> convertedPoints = LimbCalculator.convertToPCCoords(dm.X, dm.Y, sp.Z); double[] jointPos2 = { convertedPoints.Item3, convertedPoints.Item1, convertedPoints.Item2 }; //place back into jointDepths array in terms of depth space. jointDepthsStr.Add(joint[0], jointPos2); } } else { //we have some live skeleton depths, enumerate into strings foreach (JointType j in jointDepths.Keys) { jointDepthsStr = new Dictionary <String, double[]>(); jointDepthsStr.Add(j.ToString(), jointDepths[j]); } } for (int limbArea = 1; limbArea <= 8; limbArea++) { //pass point cloud and correct bounds to Limb Calculator //shoulders is first option in list so pass first. limbMeasures.Add(LimbCalculator.calculateLimbBounds(pcdexisting, jointDepthsStr, limbArea, weight)); } } else { MessageBoxResult result = System.Windows.MessageBox.Show(this, "You need a Kinect to perform this action.", "Kinect Sensor Missing", MessageBoxButton.OK, MessageBoxImage.Stop); } //change colour of point cloud for limb selection mode gv.setMaterial(); this.DataContext = gv; return(limbMeasures); }