public void JointPredictorConstructorTest() { double decay = 2F; JointPredictor target = new JointPredictor(decay); Assert.IsNotNull(target); }
public void DecayConstantTest() { double decay = 2F; JointPredictor target = new JointPredictor(decay); double expected = 2F; double actual; target.DecayConstant = expected; actual = target.DecayConstant; Assert.AreEqual(expected, actual); }
public void UpdateTest() { DateTime dtg = DateTime.Now; double decay = 0.5F; double weight = Math.Exp(-1 * decay); JointPredictor target = new JointPredictor(decay); Assert.IsNull(target.EwmaVelocity); Observation observation1 = new Observation { DateTime = dtg.AddSeconds(0.0), X = 0, Y = 0, Z = 0 }; target.Update(observation1); Assert.AreEqual(target.EwmaVelocity.DateTime, observation1.DateTime); Assert.AreEqual(target.EwmaVelocity.X, 0); Assert.AreEqual(target.EwmaVelocity.Y, 0); Assert.AreEqual(target.EwmaVelocity.Z, 0); Observation observation2 = new Observation { DateTime = dtg.AddSeconds(1.0), X = 1, Y = -1, Z = 0 }; target.Update(observation2); Assert.AreEqual(target.EwmaVelocity.DateTime, observation2.DateTime); Assert.AreEqual(target.EwmaVelocity.X, weight); Assert.AreEqual(target.EwmaVelocity.Y, -1 * weight); Assert.AreEqual(target.EwmaVelocity.Z, 0); Observation observation3 = new Observation { DateTime = dtg.AddSeconds(2.0), X = 1, Y = -1, Z = 0 }; target.Update(observation3); Assert.AreEqual(target.EwmaVelocity.DateTime, observation3.DateTime); Assert.AreEqual(target.EwmaVelocity.X, weight * (1 - weight)); Assert.AreEqual(target.EwmaVelocity.Y, -1 * weight * (1 - weight)); Assert.AreEqual(target.EwmaVelocity.Z, 0); target.Update(observation1); }
void Start() { markerUI = new MarkerUI(); markerPositions = new Dictionary <string, Vector3>(); // This one initilize the render marker to render the list of trackers written in the file alias_marker if (drawMarkers) { markerUI.InitMarkerRendering(); } mocapCaptureData = new List <MocapSample>(); fusedCaptureData = new List <FusedSample>(); handTemplate = new HandTemplate(); /* Marker IDs description: * 0 - Pinky base * 1 - Wrist * 2 - Index base * 3 - Ring fingertip * 4 - Pinky fingertip * 5 - Index fingertip * 6 - Middle fingertip * 7 - Thumb 2nd joint * 8 - Thumb fingertip */ /* * Specify the offsets for the alignment points. For instance, if the marker corresponding to the wrist is 3 cm above the wrist bone, you should define an offset of (-0.03, 0, 0). * This is not strictly necessary, but it helps with improving the precision (and allows the markers to be placed in arbitrary locations). * All coordinates are in object space. */ handTemplate.AddMarker("LEHAR", "l_pinky1", new Vector3(-0.01f, 0.0f, 0.0f), true); handTemplate.AddMarker("LEHAL", "l_wrist", new Vector3(-0.03f, 0.0f, 0.0f), true); handTemplate.AddMarker("WHARHAR", "l_index1", new Vector3(-0.01f, 0.0f, 0.0f), true); handTemplate.AddMarker("LRIF", "l_ring_tip", Vector3.zero); handTemplate.AddMarker("LBAF", "l_pinky_tip", Vector3.zero); handTemplate.AddMarker("LMIF", "l_index_tip", Vector3.zero); handTemplate.AddMarker("LINF", "l_middle_tip", Vector3.zero); handTemplate.AddMarker("LPAL", "l_thumb2", new Vector3(-0.01f, 0.0f, 0.0f)); handTemplate.AddMarker("LTHF", "l_thumb_tip", Vector3.zero); handTemplate.SetPivot("l_wrist"); handTemplate.SaveToFile(Constants.OutputDirectory + "\\hand.csv"); foreach (var marker in handTemplate.MarkerList) { markerPositions[marker] = handTemplate.GetInitialMarkerWorldPosition(marker); int j = markerUI.marker_alias_to_ids[marker]; markerUI.marker_positions[j, 0] = -markerPositions[marker].x; markerUI.marker_positions[j, 1] = markerPositions[marker].y; markerUI.marker_positions[j, 2] = markerPositions[marker].z; } markerUI.RenderMarkers(); jointPredictor = new JointPredictor("models/joint_model.bin", handTemplate); jointPredictor.AddJoint("l_index1", new Vector3(1, 1, 1)); jointPredictor.AddJoint("l_index2", new Vector3(0, 1, 0)); jointPredictor.AddJoint("l_index3", new Vector3(0, 1, 0)); jointPredictor.AddJoint("l_middle1", new Vector3(1, 1, 1)); jointPredictor.AddJoint("l_middle2", new Vector3(0, 1, 0)); jointPredictor.AddJoint("l_middle3", new Vector3(0, 1, 0)); jointPredictor.AddJoint("l_pinky1", new Vector3(1, 1, 1)); jointPredictor.AddJoint("l_pinky2", new Vector3(0, 1, 0)); jointPredictor.AddJoint("l_pinky3", new Vector3(0, 1, 0)); jointPredictor.AddJoint("l_ring1", new Vector3(1, 1, 1)); jointPredictor.AddJoint("l_ring2", new Vector3(0, 1, 0)); jointPredictor.AddJoint("l_ring3", new Vector3(0, 1, 0)); jointPredictor.AddJoint("l_thumb1", new Vector3(1, 1, 1)); jointPredictor.AddJoint("l_thumb2", new Vector3(1, 1, 0)); jointPredictor.AddJoint("l_thumb3", new Vector3(1, 0, 0)); occlusionManager = new OcclusionManager(handTemplate.MarkerList); occlusionManager.AddImplementation(new NaiveOcclusionPredictor()); }