From ae80aa7eeea4d725a3f919bc5f8f2c1490675040 Mon Sep 17 00:00:00 2001 From: Tadas Baltrusaitis Date: Thu, 9 Feb 2017 11:43:50 -0500 Subject: [PATCH] Restructuring number of iterations a bit. --- .../LandmarkDetector/src/LandmarkDetectorModel.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp b/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp index 8d8b9e76..0920e528 100644 --- a/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp +++ b/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp @@ -735,15 +735,18 @@ bool CLNF::Fit(const cv::Mat_& im, const cv::Mat_& depthImg, const FaceModelParameters tmp_parameters = parameters; + // Active scale is there in case we need to upsample too much + int active_scale = 0; + // Optimise the model across a number of areas of interest (usually in descending window size and ascending scale size) for(int scale = 0; scale < num_scales; scale++) { + // Control the number of iterations through window size + if (window_sizes[scale] == 0) + continue; int window_size = window_sizes[scale]; - //if(window_size == 0 || 0.9 * patch_experts.patch_scaling[scale] > params_global[0]) - // continue; - // The patch expert response computation if(scale != window_sizes.size() - 1) { @@ -785,6 +788,11 @@ bool CLNF::Fit(const cv::Mat_& im, const cv::Mat_& depthImg, const cout << "Face too small for landmark detection" << endl; return false; } + + // Making sure we do not upsample too much + if (active_scale < num_scales - 1 && 0.9 * patch_experts.patch_scaling[active_scale + 1] < params_global[0]) + active_scale = active_scale + 1; + } return true;