/// <summary> /// This event is fired when a new HDFace frame is ready for consumption /// </summary> /// <param name="sender">object sending the event</param> /// <param name="e">event arguments</param> private void HdFaceReader_FrameArrived(object sender, HighDefinitionFaceFrameArrivedEventArgs e) { using (var frame = e.FrameReference.AcquireFrame()) { // We might miss the chance to acquire the frame; it will be null if it's missed. // Also ignore this frame if face tracking failed if (frame == null || !frame.IsFaceTracked) { return; } frame.GetAndRefreshFaceAlignmentResult(this.currentFaceAlignment); var captureValues = this.currentFaceAlignment.AnimationUnits; if (collectData) { FaceDataReading f = new FaceDataReading(true); //Format data from IReadOnlyDic -> Dictionary f.AddData(captureValues); fd.AddFaceData(f); } } }
public void AddFaceData(FaceDataReading data) { data.Write(); faceData.Add(data); }