diff --git a/lib/local/FaceAnalyser/src/FaceAnalyser.cpp b/lib/local/FaceAnalyser/src/FaceAnalyser.cpp index c7cbd61..3a6af5f 100644 --- a/lib/local/FaceAnalyser/src/FaceAnalyser.cpp +++ b/lib/local/FaceAnalyser/src/FaceAnalyser.cpp @@ -323,12 +323,13 @@ void FaceAnalyser::AddNextFrame(const cv::Mat& frame, const cv::Mat_& det // Extract shape parameters from the detected landmarks cv::Vec6f params_global; cv::Mat_ params_local; - pdm.CalcParams(params_global, params_local, detected_landmarks); // First align the face if tracking was successfull if(success) { + pdm.CalcParams(params_global, params_local, detected_landmarks); + // The aligned face requirement for AUs AlignFaceMask(aligned_face_for_au, frame, detected_landmarks, params_global, pdm, triangulation, true, align_scale_au, align_width_au, align_height_au); @@ -348,6 +349,7 @@ void FaceAnalyser::AddNextFrame(const cv::Mat& frame, const cv::Mat_& det aligned_face_for_au = cv::Mat(align_height_au, align_width_au, CV_8UC3); aligned_face_for_output.setTo(0); aligned_face_for_au.setTo(0); + params_local = cv::Mat_(pdm.NumberOfModes(), 1, 0.0f); } if (aligned_face_for_output.channels() == 3 && out_grayscale) diff --git a/lib/local/LandmarkDetector/include/LandmarkDetectorModel.h b/lib/local/LandmarkDetector/include/LandmarkDetectorModel.h index 52ba242..eae4337 100644 --- a/lib/local/LandmarkDetector/include/LandmarkDetectorModel.h +++ b/lib/local/LandmarkDetector/include/LandmarkDetectorModel.h @@ -102,7 +102,7 @@ public: // Indicating if the tracking has been initialised (for video based tracking) bool tracking_initialised; - // The actual output of the regressor (-1 is perfect detection 1 is worst detection) + // Representing how confident we are that tracking succeeds (0 - complete failure, 1 - perfect success) double detection_certainty; // Indicator if eye model is there for eye detection diff --git a/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp b/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp index e5f3c6b..14041c3 100644 --- a/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp +++ b/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp @@ -511,7 +511,7 @@ void CLNF::Read(string main_location) detection_success = false; tracking_initialised = false; model_likelihood = -10; // very low - detection_certainty = 1; // very uncertain + detection_certainty = 0; // very uncertain // Initialising default values for the rest of the variables @@ -534,7 +534,7 @@ void CLNF::Reset() detection_success = false; tracking_initialised = false; model_likelihood = -10; // very low - detection_certainty = 1; // very uncertain + detection_certainty = 0; // very uncertain // local parameters (shape) params_local.setTo(0.0); @@ -647,11 +647,11 @@ bool CLNF::DetectLandmarks(const cv::Mat_ &image, FaceModelParameters& pa detection_success = fit_success; if(fit_success) { - detection_certainty = -1; + detection_certainty = 1; } else { - detection_certainty = 1; + detection_certainty = 0; } } diff --git a/matlab_runners/Demos/feature_extraction_demo_vid.m b/matlab_runners/Demos/feature_extraction_demo_vid.m index ccdb85a..810090c 100644 --- a/matlab_runners/Demos/feature_extraction_demo_vid.m +++ b/matlab_runners/Demos/feature_extraction_demo_vid.m @@ -156,7 +156,7 @@ gaze_inds = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'gaze_angle' % Read gaze (x,y,z) for one eye and (x,y,z) for another gaze = all_params(valid_frames, gaze_inds); -plot(time, gaze(:,1), 'DisplayName', 'Left - right'); +plot(time_stamps, gaze(:,1), 'DisplayName', 'Left - right'); hold on; plot(time_stamps, gaze(:,2), 'DisplayName', 'Up - down'); xlabel('Time(s)') % x-axis label