From b571cc212bfdb72a4c69c4cc14cdbc2a0bb5588b Mon Sep 17 00:00:00 2001 From: Tadas Baltrusaitis Date: Mon, 18 Jun 2018 08:42:56 +0100 Subject: [PATCH] Cleaning up includes, fixing tbb binary include for 32 bit windows version. --- .gitignore | 2 ++ lib/3rdParty/OpenBLAS/OpenBLAS.props | 5 +--- lib/3rdParty/dlib/dlib.props | 1 + ... => installation_instructions_windows.txt} | 6 +++-- lib/local/CppInerop/CppInterop.cpp | 13 ++++++++-- lib/local/CppInerop/FaceAnalyserInterop.h | 13 +++------- lib/local/CppInerop/FaceDetectorInterop.h | 25 +++++-------------- lib/local/CppInerop/GazeAnalyserInterop.h | 20 +-------------- lib/local/CppInerop/ImageReader.h | 9 ++----- lib/local/CppInerop/LandmarkDetectorInterop.h | 19 +++----------- lib/local/CppInerop/OpenCVWrappers.h | 4 +-- lib/local/CppInerop/RecorderInterop.h | 5 +++- lib/local/CppInerop/SequenceReader.h | 22 +++++++--------- lib/local/CppInerop/VisualizerInterop.h | 3 ++- lib/local/FaceAnalyser/FaceAnalyser.vcxproj | 2 +- 15 files changed, 53 insertions(+), 96 deletions(-) rename lib/3rdParty/dlib/{installation_instructions.txt => installation_instructions_windows.txt} (75%) diff --git a/.gitignore b/.gitignore index 64b4c844..cc6caadf 100644 --- a/.gitignore +++ b/.gitignore @@ -97,3 +97,5 @@ exe/releases/OpenFace_* /build/ matlab_runners/Action Unit Experiments/AU_predictions/ lib/local/Utilities/Debug/ +lib/3rdParty/CameraEnumerator/Debug/ +lib/local/CppInerop/Debug/ diff --git a/lib/3rdParty/OpenBLAS/OpenBLAS.props b/lib/3rdParty/OpenBLAS/OpenBLAS.props index e0e8b77c..53acdac7 100644 --- a/lib/3rdParty/OpenBLAS/OpenBLAS.props +++ b/lib/3rdParty/OpenBLAS/OpenBLAS.props @@ -11,10 +11,7 @@ $(SolutionDir)lib\3rdParty\OpenBLAS\lib\$(PlatformShortName);%(AdditionalLibraryDirectories) libopenblas.dll.a;%(AdditionalDependencies) - - - - + xcopy /I /E /Y /D /C "$(SolutionDir)lib\3rdParty\OpenBlas\bin\$(PlatformShortName)" "$(OutDir)" diff --git a/lib/3rdParty/dlib/dlib.props b/lib/3rdParty/dlib/dlib.props index 47dffa57..73669a38 100644 --- a/lib/3rdParty/dlib/dlib.props +++ b/lib/3rdParty/dlib/dlib.props @@ -8,5 +8,6 @@ $(SolutionDir)lib\3rdParty\dlib\lib\$(PlatformTarget)\$(PlatformToolset)\$(Configuration);%(AdditionalLibraryDirectories) dlib.lib;%(AdditionalDependencies) + \ No newline at end of file diff --git a/lib/3rdParty/dlib/installation_instructions.txt b/lib/3rdParty/dlib/installation_instructions_windows.txt similarity index 75% rename from lib/3rdParty/dlib/installation_instructions.txt rename to lib/3rdParty/dlib/installation_instructions_windows.txt index d8fb62d2..ec534df2 100644 --- a/lib/3rdParty/dlib/installation_instructions.txt +++ b/lib/3rdParty/dlib/installation_instructions_windows.txt @@ -3,9 +3,11 @@ We are using dlib 19.13, the libraries are pre-built for convenience, they were For win 64 bit cmake -G "Visual Studio 14 2015 Win64" -DDLIB_JPEG_SUPPORT=0 -DDLIB_PNG_SUPPORT=0 -DDLIB_NO_GUI_SUPPORT=1 -DDLIB_ISO_CPP_ONLY=0 -DENABLE_ASSERTS=0 -DCMAKE_INSTALL_PREFIX=install .. cmake --build . --config Debug --target INSTALL -cmake --build . --config R --target INSTALL +cmake --build . --config Release --target INSTALL For win 32 bit cmake -G "Visual Studio 14 2015" -DDLIB_JPEG_SUPPORT=0 -DDLIB_PNG_SUPPORT=0 -DDLIB_NO_GUI_SUPPORT=1 -DDLIB_ISO_CPP_ONLY=0 -DENABLE_ASSERTS=0 -DCMAKE_INSTALL_PREFIX=install .. cmake --build . --config Debug --target INSTALL -cmake --build . --config R --target INSTALL +cmake --build . --config Release --target INSTALL + +Afterwards move the built libs to the right location "lib" folder and rename them accordingly \ No newline at end of file diff --git a/lib/local/CppInerop/CppInterop.cpp b/lib/local/CppInerop/CppInterop.cpp index 1e9fbe53..92f4b043 100644 --- a/lib/local/CppInerop/CppInterop.cpp +++ b/lib/local/CppInerop/CppInterop.cpp @@ -32,13 +32,22 @@ // /////////////////////////////////////////////////////////////////////////////// +// Allows to overcome boost name clash stuff with C++ CLI +#ifdef __cplusplus_cli +#define generic __identifier(generic) +#endif + // This is the main DLL file. +#include "GazeAnalyserInterop.h" #include "LandmarkDetectorInterop.h" #include "FaceAnalyserInterop.h" -#include "GazeAnalyserInterop.h" #include "OpenCVWrappers.h" #include "ImageReader.h" #include "FaceDetectorInterop.h" #include "RecorderInterop.h" #include "VisualizerInterop.h" -#include "SequenceReader.h" \ No newline at end of file +#include "SequenceReader.h" + +#ifdef __cplusplus_cli +#undef generic +#endif \ No newline at end of file diff --git a/lib/local/CppInerop/FaceAnalyserInterop.h b/lib/local/CppInerop/FaceAnalyserInterop.h index 19bfea75..78065727 100644 --- a/lib/local/CppInerop/FaceAnalyserInterop.h +++ b/lib/local/CppInerop/FaceAnalyserInterop.h @@ -46,18 +46,13 @@ #pragma unmanaged +#include + // Allows to overcome boost name clash stuff with C++ CLI #ifdef __cplusplus_cli #define generic __identifier(generic) #endif -#include -#include "opencv2/objdetect.hpp" -#include "opencv2/calib3d.hpp" -#include -#include -#include - #include #include #include @@ -71,10 +66,10 @@ #undef generic #endif -using namespace System::Collections::Generic; - #pragma managed +using namespace System::Collections::Generic; + namespace FaceAnalyser_Interop { public ref class FaceAnalyserManaged diff --git a/lib/local/CppInerop/FaceDetectorInterop.h b/lib/local/CppInerop/FaceDetectorInterop.h index 960138e5..e9925e2b 100644 --- a/lib/local/CppInerop/FaceDetectorInterop.h +++ b/lib/local/CppInerop/FaceDetectorInterop.h @@ -38,32 +38,19 @@ #pragma once // Include all the unmanaged things we need. +#pragma unmanaged -#include -#include "opencv2/objdetect.hpp" -#include "opencv2/calib3d.hpp" -#include -#include -#include - -// Allows to overcome boost name clash stuff with C++ CLI -#ifdef __cplusplus_cli -#define generic __identifier(generic) -#endif - +#undef _M_CEE +#include #include - #include - -#ifdef __cplusplus_cli -#undef generic -#endif - -using namespace System::Collections::Generic; +#define _M_CEE #pragma managed + #include #include +using namespace System::Collections::Generic; namespace FaceDetectorInterop { diff --git a/lib/local/CppInerop/GazeAnalyserInterop.h b/lib/local/CppInerop/GazeAnalyserInterop.h index 98354f70..ffcd67f9 100644 --- a/lib/local/CppInerop/GazeAnalyserInterop.h +++ b/lib/local/CppInerop/GazeAnalyserInterop.h @@ -47,30 +47,12 @@ #pragma unmanaged -#include -#include "opencv2/objdetect.hpp" -#include "opencv2/calib3d.hpp" -#include -#include -#include - -// Allows to overcome boost name clash stuff with C++ CLI -#ifdef __cplusplus_cli -#define generic __identifier(generic) -#endif +#include #include #include #include -// Boost stuff -#include -#include - -#ifdef __cplusplus_cli -#undef generic -#endif - #pragma managed namespace GazeAnalyser_Interop { diff --git a/lib/local/CppInerop/ImageReader.h b/lib/local/CppInerop/ImageReader.h index 85147df7..79f06a99 100644 --- a/lib/local/CppInerop/ImageReader.h +++ b/lib/local/CppInerop/ImageReader.h @@ -37,18 +37,13 @@ // Include all the unmanaged things we need. -#include -#include "opencv2/objdetect.hpp" -#include "opencv2/calib3d.hpp" -#include -#include -#include +#include #include #include #include -#include "ImageCapture.h" +#include #pragma managed diff --git a/lib/local/CppInerop/LandmarkDetectorInterop.h b/lib/local/CppInerop/LandmarkDetectorInterop.h index e81056b5..46b5c93f 100644 --- a/lib/local/CppInerop/LandmarkDetectorInterop.h +++ b/lib/local/CppInerop/LandmarkDetectorInterop.h @@ -45,29 +45,16 @@ // Include all the unmanaged things we need. -#include -#include "opencv2/objdetect.hpp" -#include "opencv2/calib3d.hpp" -#include -#include -#include - -// Allows to overcome boost name clash stuff with C++ CLI -#ifdef __cplusplus_cli -#define generic __identifier(generic) -#endif +#include #include +#undef _M_CEE #include - #include #include #include - -#ifdef __cplusplus_cli -#undef generic -#endif +#define _M_CEE using namespace System::Collections::Generic; diff --git a/lib/local/CppInerop/OpenCVWrappers.h b/lib/local/CppInerop/OpenCVWrappers.h index 915675ec..3824003f 100644 --- a/lib/local/CppInerop/OpenCVWrappers.h +++ b/lib/local/CppInerop/OpenCVWrappers.h @@ -42,8 +42,8 @@ #pragma unmanaged -#include "cv.h" -#include "highgui.h" +#include +#include #include // Video write #include // Video write diff --git a/lib/local/CppInerop/RecorderInterop.h b/lib/local/CppInerop/RecorderInterop.h index 4102e621..e7c543e8 100644 --- a/lib/local/CppInerop/RecorderInterop.h +++ b/lib/local/CppInerop/RecorderInterop.h @@ -39,13 +39,16 @@ // Include all the unmanaged things we need. -#include "RecorderOpenFace.h" +#include +#include #pragma managed #include #include +using namespace System::Collections::Generic; + namespace UtilitiesOF { public ref class RecorderOpenFaceParameters diff --git a/lib/local/CppInerop/SequenceReader.h b/lib/local/CppInerop/SequenceReader.h index 7e37b11a..d351a277 100644 --- a/lib/local/CppInerop/SequenceReader.h +++ b/lib/local/CppInerop/SequenceReader.h @@ -37,27 +37,23 @@ // Include all the unmanaged things we need. -#include -#include "opencv2/objdetect.hpp" -#include "opencv2/calib3d.hpp" -#include -#include -#include +#include #include #include +#include #include #include - -#include "DeviceEnumerator.h" - -#include "SequenceCapture.h" +#include +#include #pragma managed #include #include +using namespace System::Collections::Generic; + namespace UtilitiesOF { @@ -271,7 +267,7 @@ namespace UtilitiesOF { private: // Static methods for listing cameras and their resolutions - static void split(const std::string &s, char delim, std::vector &elems) { + static void split(const std::string &s, char delim, std::vector &elems) { std::stringstream ss; ss.str(s); std::string item; @@ -299,7 +295,7 @@ namespace UtilitiesOF { auto resolutions = gcnew System::Collections::Generic::List^>(); for (size_t r_idx = 0; r_idx < resolution_list.size(); r_idx++) { - string res = resolution_list[r_idx]["res"]; + std::string res = resolution_list[r_idx]["res"]; std::vector elems; split(res, 'x', elems); @@ -329,7 +325,7 @@ namespace UtilitiesOF { auto resolutions = camera_list[name_m]; for (int j = 0; j < resolutions->Count; j++) { - stringstream ss; + std::stringstream ss; ss << resolutions[j]->Item1 << "x" << resolutions[j]->Item2; fs << "{:" << "res" << ss.str(); diff --git a/lib/local/CppInerop/VisualizerInterop.h b/lib/local/CppInerop/VisualizerInterop.h index 7b3b9fb7..85a75bf0 100644 --- a/lib/local/CppInerop/VisualizerInterop.h +++ b/lib/local/CppInerop/VisualizerInterop.h @@ -37,7 +37,8 @@ // Include all the unmanaged things we need. -#include "Visualizer.h" +#include +#include #pragma managed diff --git a/lib/local/FaceAnalyser/FaceAnalyser.vcxproj b/lib/local/FaceAnalyser/FaceAnalyser.vcxproj index 76872172..16e59f16 100644 --- a/lib/local/FaceAnalyser/FaceAnalyser.vcxproj +++ b/lib/local/FaceAnalyser/FaceAnalyser.vcxproj @@ -56,8 +56,8 @@ - +