Feature/opencv4 (#706)

* Travis OpenCV4 update, testing Ubuntu with new OpenCV

* Fix to Ubuntu travis

* Another attempt at OpenCV 4.0 for Ubuntu

* And another OpenCV attempt.

* Simplifying the travis script

* Ubuntu OpenCV 4 support.

* Updating to OpenCV 4, for x64 windows.

* Fixes to move to OpenCV 4 on windows.

* Travis fix for OpenCV 4 on OSX

* Renaming a lib.

* Travis opencv4 fix.

* Building OpenCV4 versions using appveyor.

* Attempt mac travis fix.

* Small travis fix.

* Travis fix attempt.

* First iteration in boost removal and upgrade to C++17

* Test with ocv 4.0

* Moving filesystem out of stdafx

* Some more boost testing with cmake.

* More CMAKE options

* More compiler flag changes

* Another attempt at compiler options.

* Another attempt.

* More filesystem stuff.

* Linking to filesystem.

* Cmake fix with target linking.

* Attempting travis with g++-8

* Attempting to setup g++8 on travis linux.

* Another travis change.

* Adding OpenBLAS to travis and removing g++-8

* Fixing typo

* More travis experiments.

* More travis debugging.

* A small directory change.

* Adding some more travis changes.

* travis typo fix.

* Some reordering of travis, for cleaner yml

* Removing `using namespace std` in order to avoid clash with byte and to make the code more consistent.

* Working towards removing std::filesystem requirement, allow boost::filesystem as well.

* Making boost an optional dependency

* Fixing std issue.

* Fixing cmake issue.

* Fixing the precompiled header issue.

* Another cmake boost fix.

* Including missing files.

* Removing unnecessary includes.

* Removing more includes.

* Changes to appveyor build, proper removal of VS2015

* If boost is present, do not need to link to filesystem.

* Removing un-needed link library.

* oops

* Mac attempt at opencv4 travis.

* Upgrading OCV to 4.1 on VS2018

* Downloading OpenCV binaries through a script

* Triger an appveyor build.

* Upgrading VS version.

* Attempting VS2017 build

* Adding win-32 libraries for OpenCV 4.1

* Adding OpenCV 32 bit libraries.
This commit is contained in:
Tadas Baltrusaitis
2019-05-28 19:49:17 +01:00
committed by GitHub
parent 330383fef7
commit 9147dfe2f3
2762 changed files with 37401 additions and 353002 deletions

View File

@@ -49,8 +49,6 @@
#include "LandmarkDetectorParameters.h"
#include "FaceDetectorMTCNN.h"
using namespace std;
namespace LandmarkDetector
{
@@ -79,10 +77,10 @@ public:
cv::Vec6f params_global;
// A collection of hierarchical CLNF models that can be used for refinement
vector<CLNF> hierarchical_models;
vector<string> hierarchical_model_names;
vector<vector<pair<int,int>>> hierarchical_mapping;
vector<FaceModelParameters> hierarchical_params;
std::vector<CLNF> hierarchical_models;
std::vector<std::string> hierarchical_model_names;
std::vector<std::vector<std::pair<int,int>>> hierarchical_mapping;
std::vector<FaceModelParameters> hierarchical_params;
//==================== Helpers for face detection and landmark detection validation =========================================
@@ -90,13 +88,13 @@ public:
// Haar cascade classifier for face detection
cv::CascadeClassifier face_detector_HAAR;
string haar_face_detector_location;
std::string haar_face_detector_location;
// A HOG SVM-struct based face detector
dlib::frontal_face_detector face_detector_HOG;
FaceDetectorMTCNN face_detector_MTCNN;
string mtcnn_face_detector_location;
std::string mtcnn_face_detector_location;
// Validate if the detected landmarks are correct using an SVR regressor
DetectionValidator landmark_validator;
@@ -114,7 +112,7 @@ public:
bool eye_model;
// the triangulation per each view (for drawing purposes only)
vector<cv::Mat_<int> > triangulations;
std::vector<cv::Mat_<int> > triangulations;
//===========================================================================
// Member variables that retain the state of the tracking (reflecting the state of the lastly tracked (detected) image
@@ -146,7 +144,7 @@ public:
CLNF();
// Constructor from a model file
CLNF(string fname);
CLNF(std::string fname);
// Copy constructor (makes a deep copy of the detector)
CLNF(const CLNF& other);
@@ -183,25 +181,30 @@ public:
void Reset(double x, double y);
// Reading the model in
void Read(string name);
void Read(std::string name);
private:
// Helper reading function
bool Read_CLNF(string clnf_location);
bool Read_CLNF(std::string clnf_location);
// the speedup of RLMS using precalculated KDE responses (described in Saragih 2011 RLMS paper)
map<int, cv::Mat_<float> > kde_resp_precalc;
std::map<int, cv::Mat_<float> > kde_resp_precalc;
// The model fitting: patch response computation and optimisation steps
bool Fit(const cv::Mat_<float>& intensity_image, const std::vector<int>& window_sizes, const FaceModelParameters& parameters);
// Mean shift computation that uses precalculated kernel density estimators (the one actually used)
void NonVectorisedMeanShift_precalc_kde(cv::Mat_<float>& out_mean_shifts, const vector<cv::Mat_<float> >& patch_expert_responses, const cv::Mat_<float> &dxs, const cv::Mat_<float> &dys, int resp_size, float a, int scale, int view_id, map<int, cv::Mat_<float> >& mean_shifts);
void NonVectorisedMeanShift_precalc_kde(cv::Mat_<float>& out_mean_shifts, const std::vector<cv::Mat_<float> >& patch_expert_responses,
const cv::Mat_<float> &dxs, const cv::Mat_<float> &dys, int resp_size, float a, int scale, int view_id,
std::map<int, cv::Mat_<float> >& mean_shifts);
// The actual model optimisation (update step), returns the model likelihood
float NU_RLMS(cv::Vec6f& final_global, cv::Mat_<float>& final_local, const vector<cv::Mat_<float> >& patch_expert_responses, const cv::Vec6f& initial_global, const cv::Mat_<float>& initial_local,
const cv::Mat_<float>& base_shape, const cv::Matx22f& sim_img_to_ref, const cv::Matx22f& sim_ref_to_img, int resp_size, int view_idx, bool rigid, int scale, cv::Mat_<float>& landmark_lhoods, const FaceModelParameters& parameters, bool compute_lhood);
float NU_RLMS(cv::Vec6f& final_global, cv::Mat_<float>& final_local, const std::vector<cv::Mat_<float> >& patch_expert_responses,
const cv::Vec6f& initial_global, const cv::Mat_<float>& initial_local,
const cv::Mat_<float>& base_shape, const cv::Matx22f& sim_img_to_ref,
const cv::Matx22f& sim_ref_to_img, int resp_size, int view_idx, bool rigid, int scale,
cv::Mat_<float>& landmark_lhoods, const FaceModelParameters& parameters, bool compute_lhood);
// Generating the weight matrix for the Weighted least squares
void GetWeightMatrix(cv::Mat_<float>& WeightMatrix, int scale, int view_id, const FaceModelParameters& parameters);