/// <summary> /// Called when MainForm is closed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { videoPlayer.Stop(); // dispose dlib resources if (faceDetector != null) { faceDetector.Dispose(); faceDetector = null; } if (shapePredictor != null) { shapePredictor.Dispose(); shapePredictor = null; } }
public void Dispose() { dnn.Dispose(); predictor.Dispose(); detector.Dispose(); }