public void addJoint(JointType jointType, DepthSpacePoint depthSpacePoint) { if (this.joinsAnalize.ContainsKey(jointType)) { DetailsOfStepFunctionalMovement detail = new DetailsOfStepFunctionalMovement(); detail.join = (int)jointType; detail.x = depthSpacePoint.X; detail.y = depthSpacePoint.Y; joinsAnalize[jointType] = detail; } }
private void getjoinsAnalize() { foreach (int _angle in this.HeaderView.Trainer.functionalMovement.anglesOfMovement) { List <JointType> joints = DetailsOfStepFunctionalMovement.translateAngles(_angle); foreach (JointType joint in joints) { if (!this.joinsAnalize.ContainsKey(joint)) { this.joinsAnalize.Add(joint, null); } } } }
private void readMetadata() { try { bool read = this.Trainer.getTraining(); if (read) { this.disableAllButtonFiles(); string nameCal = DetailsOfStepFunctionalMovement.getNameJoin(this.Trainer.functionalMovement.focusJoin); this.LbCalibracion = $"Calibracion de ${nameCal}"; this.LbAlturaKinectText = $"La altura del Kinect es de {this.Trainer.functionalMovement.height} mts"; } this.BtnCalibrarIsEnable = read; } catch (Exception) { this.BtnCalibrarIsEnable = false; this.enableAllButtonFiles(); WinForms.MessageBox.Show("Hubo un error en la carpeta de metadata"); } }
private void checkData(int step) { if (step > -1) { try { double time = this.gestureResultView.TimeMF; double accumulateTime = this.gestureResultView.TimeTotalMF; List <DetailsOfStepFunctionalMovement> details = new List <DetailsOfStepFunctionalMovement>(); foreach (KeyValuePair <JointType, DetailsOfStepFunctionalMovement> mean in this.kinectBodyView.joinsAnalize) { DetailsOfStepFunctionalMovement detail = mean.Value.clone(); details.Add(detail); } this.kinectBodyView.clearJoins(); StepFunctionalMovement sfm = StepFunctionalMovement.createStep(details, step, this.headerView.Trainer.functionalMovement._ID, time, accumulateTime, this.gestureResultView.Progress); this.gestureResultView.addStepDetail(sfm); } catch (Exception) { } } }
public void getAngle(List <int> _angles, int i) { List <List <StepFunctionalMovement> > _series = this.stepsByMovement[i]; for (int x = 0; x < _series.Count; x++) { List <StepFunctionalMovement> _repetitions = _series[x]; bool isOut = false; int ii = 0; foreach (StepFunctionalMovement step in _repetitions) { if (step != null) { if (ii == 0) { step.time = 0; } else { step.time = _repetitions[ii].accumulate - _repetitions[ii - 1].accumulate; } foreach (int _angle in _angles) { List <JointType> joints = DetailsOfStepFunctionalMovement.translateAngles(_angle); List <DetailsOfStepFunctionalMovement> vectorialPoints = step.detailsOfStepFunctionalMovement.FindAll(e => joints.Contains((JointType)e.join)); if (vectorialPoints.Count != 3) { isOut = true; break; } DetailsOfStepFunctionalMovement origen = vectorialPoints.Find(e => e.join == (int)joints[0]); if (origen == null) { isOut = true; break; } vectorialPoints.RemoveAll(e => (int)e.join == (int)joints[0]); if (vectorialPoints.Count != 2) { isOut = true; break; } if ((vectorialPoints[0] == null) || (vectorialPoints[1] == null)) { isOut = true; break; } Point po = new Point(origen.x, origen.y); Point p1 = new Point(vectorialPoints[0].x, vectorialPoints[0].y); Point p2 = new Point(vectorialPoints[1].x, vectorialPoints[1].y); origen.angle = KinectAngleBody.getAngleBody(po, p1, p2); } Predicate <DetailsOfStepFunctionalMovement> predicate = detail => { return(!_angles.Contains(detail.join)); }; step.detailsOfStepFunctionalMovement.RemoveAll(predicate); } else { isOut = true; } if (isOut == true) { break; } ii++; } if (isOut == true) { _series.RemoveAt(x); x--; } } }