From 2513688463c1f3469688ecc28c9abc731aca03fc Mon Sep 17 00:00:00 2001 From: Tadas Baltrusaitis Date: Fri, 19 Jan 2018 21:11:58 +0000 Subject: [PATCH] Towards recording visualizations and cleaning old interop code. --- gui/OpenFaceOffline/MainWindow.xaml.cs | 9 ++++----- lib/local/CppInerop/RecorderInterop.h | 6 ++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/gui/OpenFaceOffline/MainWindow.xaml.cs b/gui/OpenFaceOffline/MainWindow.xaml.cs index f92d925..c5971c5 100644 --- a/gui/OpenFaceOffline/MainWindow.xaml.cs +++ b/gui/OpenFaceOffline/MainWindow.xaml.cs @@ -433,7 +433,7 @@ namespace OpenFaceOffline } - private void RecordObservation(RecorderOpenFace recorder, bool success, float fx, float fy, float cx, float cy) + private void RecordObservation(RecorderOpenFace recorder, RawImage vis_image, bool success, float fx, float fy, float cx, float cy) { double confidence = clnf_model.GetConfidence(); @@ -464,11 +464,11 @@ namespace OpenFaceOffline var hog_feature = face_analyser.GetLatestHOGFeature(); recorder.SetObservationHOG(success, hog_feature, face_analyser.GetHOGRows(), face_analyser.GetHOGCols(), face_analyser.GetHOGChannels()); - + + recorder.SetObservationVisualization(vis_image); + recorder.WriteObservation(); - // TODO - //open_face_rec.SetObservationVisualization(visualizer.GetVisImage()); } @@ -494,7 +494,6 @@ namespace OpenFaceOffline double scale = 0; // Helps with recording and showing the visualizations - visualizer.SetObservationFaceAlign(face_analyser.GetLatestAlignedFace()); visualizer.SetObservationHOG(face_analyser.GetLatestHOGFeature(), face_analyser.GetHOGRows(), face_analyser.GetHOGCols()); visualizer.SetObservationLandmarks(landmarks, confidence); // Set confidence to high to make sure we always visualize visualizer.SetObservationPose(pose, confidence); diff --git a/lib/local/CppInerop/RecorderInterop.h b/lib/local/CppInerop/RecorderInterop.h index 9230685..f344bac 100644 --- a/lib/local/CppInerop/RecorderInterop.h +++ b/lib/local/CppInerop/RecorderInterop.h @@ -176,6 +176,12 @@ namespace UtilitiesOF { m_recorder->SetObservationFaceAlign(aligned_face_image->Mat); } + void SetObservationVisualization(OpenCVWrappers::RawImage^ vis_image) + { + m_recorder->SetObservationVisualization(vis_image->Mat); + } + + void SetObservationHOG(bool success, OpenCVWrappers::RawImage^ aligned_face_image, int num_cols, int num_rows, int num_channels) { m_recorder->SetObservationHOG(success, aligned_face_image->Mat, num_cols, num_rows, num_channels);