// Canvas events private void inputCanvas_MouseUp(object sender, MouseEventArgs e) { double[][] input = Sequence.Preprocess(canvas.GetSequence()); if (input.Length < 5) { panelUserLabeling.Visible = false; panelClassification.Visible = false; return; } if (hmm == null && hcrf == null) { panelUserLabeling.Visible = true; panelClassification.Visible = false; } else { int index = (hcrf != null) ? hcrf.Compute(input) : hmm.Compute(input); string label = database.Classes[index]; lbHaveYouDrawn.Text = String.Format("Have you drawn a {0}?", label); panelClassification.Visible = true; panelUserLabeling.Visible = false; } }
//Gesture events based on Canvas events, modded for 3D space-time gestures private void inputCanvas_GestureDone() { double[][] input = Sequence.Preprocess(Get3DSequence()); if (input.Length < 5) //length of input, might incr this because now gestures not screen drawing. { System.Diagnostics.Debug.WriteLine("----input gesture was too short---!"); panelUserLabeling.Visible = false; panelClassification.Visible = false; return; } if (hmm == null && hcrf == null) { panelUserLabeling.Visible = true; panelClassification.Visible = false; } else { int index = (hcrf != null) ? hcrf.Compute(input) : hmm.Compute(input); //check if input is well formed from sequence preprocessing, only xy breakpoint label = database.Classes[index]; //modified lbHaveYouDrawn.Text = String.Format("Did you say: {0}?", label); SpeakOut(label); //speak the label panelClassification.Visible = true; panelUserLabeling.Visible = false; } }
void checkResting() { int restPosFrames = 0; while (null != _kinectDevice && _kinectDevice.Status == KinectStatus.Connected && _kinectDevice.SkeletonStream.IsEnabled == true && skel != null) { // System.Diagnostics.Debug.WriteLine(skel.Joints[JointType.HandRight].Position.Y +" "+ skel.Joints[JointType.HipCenter].Position.Y+ " "+ skel.Joints[JointType.HandLeft].Position.Y); //add code for rest pos check. if (skel.Joints[JointType.HandRight].Position.Y < skel.Joints[JointType.HipCenter].Position.Y && skel.Joints[JointType.HandLeft].Position.Y < skel.Joints[JointType.HipCenter].Position.Y) { if (isRestPos) { continue; } if (restPosFrames < 3) { restPosFrames++; } else { isRestPos = true; System.Diagnostics.Debug.Write("Rest pos !! ~~~~~~~~~~"); //ops if (TestingOn) { double[][] input = Sequence.Preprocess(Get3DSequence()); if (input.Length < 5) //length of input, might incr this because now gestures not screen drawing. { System.Diagnostics.Debug.WriteLine("----input gesture was too short---!"); //panelUserLabeling.Visible = false; //panelClassification.Visible = false; //return; } if (hmm == null && hcrf == null) { System.Diagnostics.Debug.WriteLine("----hmm not declared---!"); //panelUserLabeling.Visible = true; //panelClassification.Visible = false; } else { int index = (hcrf != null) ? hcrf.Compute(input) : hmm.Compute(input); //check if input is well formed from sequence preprocessing, only xy breakpoint label = database.Classes[index]; //modified // lbHaveYouDrawn.Text = String.Format("Have you drawn a {0}?", label); SpeakOut(label); //speak the label // panelClassification.Visible = true; // panelUserLabeling.Visible = false; } sequence.Clear(); } restPosFrames = 0; } } else { isRestPos = false; } } }