// ------------------------------------------ // SETTER // ------------------------------------------ protected bool UpdateFace(string name) { if (null == name) { return(false); } bool hasChange = true; // Search for WSRProfile foreach (WSRProfile profile in Profiles) { if (profile.Name != name) { continue; } hasChange = false; Current = profile; break; } // Create new WSRProfile if (null == Current || (Current.Name != name && !Current.Name.StartsWith("Unknow"))) { Current = new WSRProfile(); Profiles.Add(Current); } // Reset TimeStamp Current.Timestamp = DateTime.Now; Current.Name = name; return(hasChange); }
public void UpdatePitch(double pitch) { bool hasChange = Profiles.RemoveAll(ProfileTimout) > 0; // Search for WSRProfile var delta = null != Current?Math.Abs(Current.Pitch - pitch) : pitch; foreach (WSRProfile profile in Profiles) { var d = Math.Abs(profile.Pitch - pitch); if (delta < d) { continue; } Current = profile; delta = d; } // Create new WSRProfile if (null == Current || (Current.Pitch > 0 && delta > WSRConfig.GetInstance().PitchDelta)) { Current = new WSRProfile(); Profiles.Add(Current); } // Reset TimeStamp Current.Timestamp = DateTime.Now; Current.Pitch = pitch; // Trigger ProfileChange(hasChange); }
private void DrawProfile() { var current = WSRProfileManager.GetInstance().Current; var profiles = WSRProfileManager.GetInstance().Profiles; for (int i = 0; i < profiles.Count && i < 5; i++) { WSRProfile profile = profiles[i]; if (profile == null) { continue; } var label = ((TextBlock)System.Windows.LogicalTreeHelper.FindLogicalNode(this, "label_Profile" + i)); label.Text = profile.Name; label.Foreground = (profile == current) ? red : black; ((TextBlock)System.Windows.LogicalTreeHelper.FindLogicalNode(this, "label_Pitch" + i)).Text = "Pitch: " + Math.Round(profile.Pitch); ((TextBlock)System.Windows.LogicalTreeHelper.FindLogicalNode(this, "label_Mood" + i)).Text = "Mood: " + profile.Mood; ((TextBlock)System.Windows.LogicalTreeHelper.FindLogicalNode(this, "label_Height" + i)).Text = "Height: " + profile.Height; ((TextBlock)System.Windows.LogicalTreeHelper.FindLogicalNode(this, "label_Head" + i)).Text = "Head: " + Math.Round(profile.x / 10) + "," + Math.Round(profile.y / 10) + "," + Math.Round(profile.z / 10); } if (null != current) { label_Gesture.Text = "Head: Tracked x: " + Math.Round(current.x / 10) + " y: " + Math.Round(current.y / 10) + " z: " + Math.Round(current.z / 10); label_Height.Text = "Height: " + current.Height + "m"; } }
private bool ProfileTimout(WSRProfile profile){ if (profile.Name != null) return false; var timeout = (DateTime.Now - profile.Timestamp) > WSRConfig.GetInstance().FaceTH; if (timeout && Current == profile) { Current = null; } return timeout; }
public void UpdateHeight(double height) { // Create new WSRProfile if (null == Current) { Current = new WSRProfile(); Profiles.Add(Current); } // Update Height Current.Timestamp = DateTime.Now; Current.Height = height; }
public void UpdateMood(double mood) { // Create new WSRProfile if (null == Current) { Current = new WSRProfile(); Profiles.Add(Current); } // Update Height Current.Timestamp = DateTime.Now; Current.Mood = mood; }
private bool ProfileTimout(WSRProfile profile) { if (profile.Name != null) { return(false); } var timeout = (DateTime.Now - profile.Timestamp) > WSRConfig.GetInstance().FaceTH; if (timeout && Current == profile) { Current = null; } return(timeout); }
public void UpdateHead(float x, float y, float z) { // Create new WSRProfile if (null == Current) { Current = new WSRProfile(); Profiles.Add(Current); } // Update Height Current.Timestamp = DateTime.Now; Current.x = x; Current.y = y; Current.z = z; }
// ------------------------------------------ // SETTER // ------------------------------------------ protected bool UpdateFace(string name) { if (null == name) { return false; } bool hasChange = true; // Search for WSRProfile foreach (WSRProfile profile in Profiles) { if (profile.Name != name) { continue; } hasChange = false; Current = profile; break; } // Create new WSRProfile if (null == Current || (Current.Name != name && !Current.Name.StartsWith("Unknow"))) { Current = new WSRProfile(); Profiles.Add(Current); } // Reset TimeStamp Current.Timestamp = DateTime.Now; Current.Name = name; return hasChange; }
public void UpdatePitch(double pitch) { bool hasChange = Profiles.RemoveAll(ProfileTimout) > 0; // Search for WSRProfile var delta = null != Current ? Math.Abs(Current.Pitch - pitch) : pitch; foreach (WSRProfile profile in Profiles) { var d = Math.Abs(profile.Pitch - pitch); if (delta < d) { continue; } Current = profile; delta = d; } // Create new WSRProfile if (null == Current || (Current.Pitch > 0 && delta > WSRConfig.GetInstance().PitchDelta)) { Current = new WSRProfile(); Profiles.Add(Current); } // Reset TimeStamp Current.Timestamp = DateTime.Now; Current.Pitch = pitch; // Trigger ProfileChange(hasChange); }