From 8da705452f529bd7b050fb8daaba102ee4c2efe3 Mon Sep 17 00:00:00 2001 From: Tadas Baltrusaitis Date: Sun, 28 Jan 2018 10:16:20 +0000 Subject: [PATCH] Some fixes with recordings --- gui/OpenFaceOffline/MainWindow.xaml.cs | 10 ++++++---- lib/local/CppInerop/RecorderInterop.h | 5 +++++ lib/local/CppInerop/SequenceReader.h | 5 +++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gui/OpenFaceOffline/MainWindow.xaml.cs b/gui/OpenFaceOffline/MainWindow.xaml.cs index edde8f9..fdc53d1 100644 --- a/gui/OpenFaceOffline/MainWindow.xaml.cs +++ b/gui/OpenFaceOffline/MainWindow.xaml.cs @@ -227,7 +227,7 @@ namespace OpenFaceOffline VisualizeFeatures(frame, visualizer_of, landmark_detector.CalculateAllLandmarks(), detection_succeeding, true, reader.GetFx(), reader.GetFy(), reader.GetCx(), reader.GetCy(), progress); // Record an observation - RecordObservation(recorder, visualizer_of.GetVisImage(), detection_succeeding, reader.GetFx(), reader.GetFy(), reader.GetCx(), reader.GetCy()); + RecordObservation(recorder, visualizer_of.GetVisImage(), detection_succeeding, reader.GetFx(), reader.GetFy(), reader.GetCx(), reader.GetCy(), reader.GetTimestamp()); while (thread_running & thread_paused && skip_frames == 0) { @@ -330,7 +330,7 @@ namespace OpenFaceOffline VisualizeFeatures(frame, visualizer_of, landmarks, detection_succeeding, i == 0, reader.GetFx(), reader.GetFy(), reader.GetCx(), reader.GetCy(), progress); // Record an observation - RecordObservation(recorder, visualizer_of.GetVisImage(), detection_succeeding, reader.GetFx(), reader.GetFy(), reader.GetCx(), reader.GetCy()); + RecordObservation(recorder, visualizer_of.GetVisImage(), detection_succeeding, reader.GetFx(), reader.GetFy(), reader.GetCx(), reader.GetCy(), 0); } @@ -354,9 +354,11 @@ namespace OpenFaceOffline } - private void RecordObservation(RecorderOpenFace recorder, RawImage vis_image, 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 timestamp) { + recorder.SetObservationTimestamp(timestamp); + double confidence = landmark_detector.GetConfidence(); List pose = new List(); @@ -366,7 +368,7 @@ namespace OpenFaceOffline List> landmarks_2D = landmark_detector.CalculateAllLandmarks(); List> landmarks_3D = landmark_detector.Calculate3DLandmarks(fx, fy, cx, cy); List global_params = landmark_detector.GetRigidParams(); - List local_params = landmark_detector.GetParams(); + List local_params = landmark_detector.GetNonRigidParams(); recorder.SetObservationLandmarks(landmarks_2D, landmarks_3D, global_params, local_params, confidence, success); diff --git a/lib/local/CppInerop/RecorderInterop.h b/lib/local/CppInerop/RecorderInterop.h index faba7ba..dae3d91 100644 --- a/lib/local/CppInerop/RecorderInterop.h +++ b/lib/local/CppInerop/RecorderInterop.h @@ -148,6 +148,11 @@ namespace UtilitiesOF { } // Setting the observations + void SetObservationTimestamp(double timestamp) + { + m_recorder->SetObservationTimestamp(timestamp); + } + void SetObservationPose(List^ pose) { cv::Vec6d pose_vec(pose[0], pose[1], pose[2], pose[3], pose[4], pose[5]); diff --git a/lib/local/CppInerop/SequenceReader.h b/lib/local/CppInerop/SequenceReader.h index b412f42..6badbb3 100644 --- a/lib/local/CppInerop/SequenceReader.h +++ b/lib/local/CppInerop/SequenceReader.h @@ -159,6 +159,11 @@ namespace UtilitiesOF { return m_rgb_frame; } + double GetTimestamp() + { + return m_sequence_capture->time_stamp; + } + System::String^ GetName() { std::string filename = m_sequence_capture->name;