Merge pull request #107 from CJxD/develop
Fix CMake install process for Unix make install
This commit is contained in:
commit
51f442a3e2
7 changed files with 123 additions and 61 deletions
|
@ -5,6 +5,10 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/)
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
|
||||||
|
|
||||||
|
set(CMAKE_CONFIG_DIR etc/OpenFace)
|
||||||
|
set(CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_CONFIG_DIR}")
|
||||||
|
add_definitions(-DCONFIG_DIR="${CONFIG_DIR}")
|
||||||
|
|
||||||
find_package( OpenCV REQUIRED )
|
find_package( OpenCV REQUIRED )
|
||||||
|
|
||||||
MESSAGE("OpenCV information:")
|
MESSAGE("OpenCV information:")
|
||||||
|
@ -34,6 +38,8 @@ foreach(file ${files})
|
||||||
else(MSVC)
|
else(MSVC)
|
||||||
file(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/bin/model)
|
file(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/bin/model)
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
|
|
||||||
|
install(FILES ${file} DESTINATION ${CMAKE_CONFIG_DIR}/model)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Move the hierarchical LandmarkDetector models
|
# Move the hierarchical LandmarkDetector models
|
||||||
|
@ -45,6 +51,8 @@ foreach(file ${files})
|
||||||
else(MSVC)
|
else(MSVC)
|
||||||
file(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/bin/model)
|
file(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/bin/model)
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
|
|
||||||
|
install(DIRECTORY ${file} DESTINATION ${CMAKE_CONFIG_DIR}/model)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
file(GLOB files "lib/local/LandmarkDetector/model/detection_validation/*.txt")
|
file(GLOB files "lib/local/LandmarkDetector/model/detection_validation/*.txt")
|
||||||
|
@ -55,6 +63,8 @@ foreach(file ${files})
|
||||||
else(MSVC)
|
else(MSVC)
|
||||||
file(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/bin/model/detection_validation)
|
file(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/bin/model/detection_validation)
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
|
|
||||||
|
install(FILES ${file} DESTINATION ${CMAKE_CONFIG_DIR}/model/detection_validation)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
file(GLOB files "lib/local/LandmarkDetector/model/patch_experts/*.txt")
|
file(GLOB files "lib/local/LandmarkDetector/model/patch_experts/*.txt")
|
||||||
|
@ -65,6 +75,8 @@ foreach(file ${files})
|
||||||
else(MSVC)
|
else(MSVC)
|
||||||
file(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/bin/model/patch_experts)
|
file(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/bin/model/patch_experts)
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
|
|
||||||
|
install(FILES ${file} DESTINATION ${CMAKE_CONFIG_DIR}/model/patch_experts)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
file(GLOB files "lib/local/LandmarkDetector/model/pdms/*.txt")
|
file(GLOB files "lib/local/LandmarkDetector/model/pdms/*.txt")
|
||||||
|
@ -75,6 +87,8 @@ foreach(file ${files})
|
||||||
else(MSVC)
|
else(MSVC)
|
||||||
file(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/bin/model/pdms)
|
file(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/bin/model/pdms)
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
|
|
||||||
|
install(FILES ${file} DESTINATION ${CMAKE_CONFIG_DIR}/model/pdms)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Move OpenCV classifiers
|
# Move OpenCV classifiers
|
||||||
|
@ -86,6 +100,8 @@ foreach(file ${files})
|
||||||
else(MSVC)
|
else(MSVC)
|
||||||
file(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/bin/classifiers)
|
file(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/bin/classifiers)
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
|
|
||||||
|
install(FILES ${file} DESTINATION ${CMAKE_CONFIG_DIR}/classifiers)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Move AU prediction modules
|
# Move AU prediction modules
|
||||||
|
@ -97,6 +113,8 @@ foreach(file ${files})
|
||||||
else(MSVC)
|
else(MSVC)
|
||||||
file(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/bin/AU_predictors)
|
file(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/bin/AU_predictors)
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
|
|
||||||
|
install(FILES ${file} DESTINATION ${CMAKE_CONFIG_DIR}/AU_predictors)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Move AU prediction modules
|
# Move AU prediction modules
|
||||||
|
@ -108,6 +126,8 @@ foreach(file ${files})
|
||||||
else(MSVC)
|
else(MSVC)
|
||||||
file(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/bin/AU_predictors)
|
file(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/bin/AU_predictors)
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
|
|
||||||
|
install(DIRECTORY ${file} DESTINATION ${CMAKE_CONFIG_DIR}/AU_predictors)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Move AU prediction modules
|
# Move AU prediction modules
|
||||||
|
@ -119,6 +139,8 @@ foreach(file ${files})
|
||||||
else(MSVC)
|
else(MSVC)
|
||||||
file(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/bin/AU_predictors)
|
file(COPY ${file} DESTINATION ${CMAKE_BINARY_DIR}/bin/AU_predictors)
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
|
|
||||||
|
install(DIRECTORY ${file} DESTINATION ${CMAKE_CONFIG_DIR}/AU_predictors)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
||||||
|
|
|
@ -78,6 +78,10 @@
|
||||||
#include <FaceAnalyser.h>
|
#include <FaceAnalyser.h>
|
||||||
#include <GazeEstimation.h>
|
#include <GazeEstimation.h>
|
||||||
|
|
||||||
|
#ifndef CONFIG_DIR
|
||||||
|
#define CONFIG_DIR "~"
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
vector<string> get_arguments(int argc, char **argv)
|
vector<string> get_arguments(int argc, char **argv)
|
||||||
|
@ -317,6 +321,10 @@ int main (int argc, char **argv)
|
||||||
//Convert arguments to more convenient vector form
|
//Convert arguments to more convenient vector form
|
||||||
vector<string> arguments = get_arguments(argc, argv);
|
vector<string> arguments = get_arguments(argc, argv);
|
||||||
|
|
||||||
|
// Search paths
|
||||||
|
boost::filesystem::path config_path = boost::filesystem::path(CONFIG_DIR);
|
||||||
|
boost::filesystem::path parent_path = boost::filesystem::path(arguments[0]).parent_path();
|
||||||
|
|
||||||
// Some initial parameters that can be overriden from command line
|
// Some initial parameters that can be overriden from command line
|
||||||
vector<string> files, depth_files, output_images, output_landmark_locations, output_pose_locations;
|
vector<string> files, depth_files, output_images, output_landmark_locations, output_pose_locations;
|
||||||
|
|
||||||
|
@ -356,39 +364,45 @@ int main (int argc, char **argv)
|
||||||
// Loading the AU prediction models
|
// Loading the AU prediction models
|
||||||
string au_loc = "AU_predictors/AU_all_static.txt";
|
string au_loc = "AU_predictors/AU_all_static.txt";
|
||||||
|
|
||||||
if (!boost::filesystem::exists(boost::filesystem::path(au_loc)))
|
boost::filesystem::path au_loc_path = boost::filesystem::path(au_loc);
|
||||||
|
if (boost::filesystem::exists(au_loc_path))
|
||||||
{
|
{
|
||||||
boost::filesystem::path loc = boost::filesystem::path(arguments[0]).parent_path() / au_loc;
|
au_loc = au_loc_path.string();
|
||||||
|
}
|
||||||
if (boost::filesystem::exists(loc))
|
else if (boost::filesystem::exists(parent_path/au_loc_path))
|
||||||
{
|
{
|
||||||
au_loc = loc.string();
|
au_loc = (parent_path/au_loc_path).string();
|
||||||
|
}
|
||||||
|
else if (boost::filesystem::exists(config_path/au_loc_path))
|
||||||
|
{
|
||||||
|
au_loc = (config_path/au_loc_path).string();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cout << "Can't find AU prediction files, exiting" << endl;
|
cout << "Can't find AU prediction files, exiting" << endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Used for image masking for AUs
|
// Used for image masking for AUs
|
||||||
string tri_loc;
|
string tri_loc;
|
||||||
if (boost::filesystem::exists(boost::filesystem::path("model/tris_68_full.txt")))
|
boost::filesystem::path tri_loc_path = boost::filesystem::path("model/tris_68_full.txt");
|
||||||
|
if (boost::filesystem::exists(tri_loc_path))
|
||||||
{
|
{
|
||||||
std::ifstream triangulation_file("model/tris_68_full.txt");
|
tri_loc = tri_loc_path.string();
|
||||||
tri_loc = "model/tris_68_full.txt";
|
}
|
||||||
|
else if (boost::filesystem::exists(parent_path/tri_loc_path))
|
||||||
|
{
|
||||||
|
tri_loc = (parent_path/tri_loc_path).string();
|
||||||
|
}
|
||||||
|
else if (boost::filesystem::exists(config_path/tri_loc_path))
|
||||||
|
{
|
||||||
|
tri_loc = (config_path/tri_loc_path).string();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
boost::filesystem::path loc = boost::filesystem::path(arguments[0]).parent_path() / "model/tris_68_full.txt";
|
|
||||||
tri_loc = loc.string();
|
|
||||||
|
|
||||||
if (!exists(loc))
|
|
||||||
{
|
{
|
||||||
cout << "Can't find triangulation files, exiting" << endl;
|
cout << "Can't find triangulation files, exiting" << endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
FaceAnalysis::FaceAnalyser face_analyser(vector<cv::Vec3d>(), 0.7, 112, 112, au_loc, tri_loc);
|
FaceAnalysis::FaceAnalyser face_analyser(vector<cv::Vec3d>(), 0.7, 112, 112, au_loc, tri_loc);
|
||||||
|
|
||||||
|
|
|
@ -14,3 +14,5 @@ target_link_libraries(FeatureExtraction FaceAnalyser)
|
||||||
target_link_libraries(FeatureExtraction dlib)
|
target_link_libraries(FeatureExtraction dlib)
|
||||||
|
|
||||||
target_link_libraries(FeatureExtraction ${OpenCV_LIBS} ${Boost_LIBRARIES} ${TBB_LIBRARIES})
|
target_link_libraries(FeatureExtraction ${OpenCV_LIBS} ${Boost_LIBRARIES} ${TBB_LIBRARIES})
|
||||||
|
|
||||||
|
install (TARGETS FeatureExtraction DESTINATION bin)
|
||||||
|
|
|
@ -81,6 +81,9 @@
|
||||||
#include <FaceAnalyser.h>
|
#include <FaceAnalyser.h>
|
||||||
#include <GazeEstimation.h>
|
#include <GazeEstimation.h>
|
||||||
|
|
||||||
|
#ifndef CONFIG_DIR
|
||||||
|
#define CONFIG_DIR "~"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define INFO_STREAM( stream ) \
|
#define INFO_STREAM( stream ) \
|
||||||
std::cout << stream << std::endl
|
std::cout << stream << std::endl
|
||||||
|
@ -242,6 +245,10 @@ int main (int argc, char **argv)
|
||||||
|
|
||||||
vector<string> arguments = get_arguments(argc, argv);
|
vector<string> arguments = get_arguments(argc, argv);
|
||||||
|
|
||||||
|
// Search paths
|
||||||
|
boost::filesystem::path config_path = boost::filesystem::path(CONFIG_DIR);
|
||||||
|
boost::filesystem::path parent_path = boost::filesystem::path(arguments[0]).parent_path();
|
||||||
|
|
||||||
// Some initial parameters that can be overriden from command line
|
// Some initial parameters that can be overriden from command line
|
||||||
vector<string> input_files, depth_directories, output_files, tracked_videos_output;
|
vector<string> input_files, depth_directories, output_files, tracked_videos_output;
|
||||||
|
|
||||||
|
@ -322,23 +329,25 @@ int main (int argc, char **argv)
|
||||||
output_2D_landmarks, output_3D_landmarks, output_model_params, output_pose, output_AUs, output_gaze, arguments);
|
output_2D_landmarks, output_3D_landmarks, output_model_params, output_pose, output_AUs, output_gaze, arguments);
|
||||||
|
|
||||||
// Used for image masking
|
// Used for image masking
|
||||||
|
|
||||||
string tri_loc;
|
string tri_loc;
|
||||||
if(boost::filesystem::exists(path("model/tris_68_full.txt")))
|
boost::filesystem::path tri_loc_path = boost::filesystem::path("model/tris_68_full.txt");
|
||||||
|
if (boost::filesystem::exists(tri_loc_path))
|
||||||
{
|
{
|
||||||
tri_loc = "model/tris_68_full.txt";
|
tri_loc = tri_loc_path.string();
|
||||||
|
}
|
||||||
|
else if (boost::filesystem::exists(parent_path/tri_loc_path))
|
||||||
|
{
|
||||||
|
tri_loc = (parent_path/tri_loc_path).string();
|
||||||
|
}
|
||||||
|
else if (boost::filesystem::exists(config_path/tri_loc_path))
|
||||||
|
{
|
||||||
|
tri_loc = (config_path/tri_loc_path).string();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
path loc = path(arguments[0]).parent_path() / "model/tris_68_full.txt";
|
|
||||||
tri_loc = loc.string();
|
|
||||||
|
|
||||||
if(!exists(loc))
|
|
||||||
{
|
{
|
||||||
cout << "Can't find triangulation files, exiting" << endl;
|
cout << "Can't find triangulation files, exiting" << endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Will warp to scaled mean shape
|
// Will warp to scaled mean shape
|
||||||
cv::Mat_<double> similarity_normalised_shape = face_model.pdm.mean_shape * sim_scale;
|
cv::Mat_<double> similarity_normalised_shape = face_model.pdm.mean_shape * sim_scale;
|
||||||
|
@ -362,24 +371,24 @@ int main (int argc, char **argv)
|
||||||
au_loc_local = "AU_predictors/AU_all_static.txt";
|
au_loc_local = "AU_predictors/AU_all_static.txt";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(boost::filesystem::exists(path(au_loc_local)))
|
boost::filesystem::path au_loc_path = boost::filesystem::path(au_loc_local);
|
||||||
|
if (boost::filesystem::exists(au_loc_path))
|
||||||
{
|
{
|
||||||
au_loc = au_loc_local;
|
au_loc = au_loc_path.string();
|
||||||
}
|
}
|
||||||
else
|
else if (boost::filesystem::exists(parent_path/au_loc_path))
|
||||||
{
|
{
|
||||||
path loc = path(arguments[0]).parent_path() / au_loc_local;
|
au_loc = (parent_path/au_loc_path).string();
|
||||||
|
}
|
||||||
if(exists(loc))
|
else if (boost::filesystem::exists(config_path/au_loc_path))
|
||||||
{
|
{
|
||||||
au_loc = loc.string();
|
au_loc = (config_path/au_loc_path).string();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cout << "Can't find AU prediction files, exiting" << endl;
|
cout << "Can't find AU prediction files, exiting" << endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Creating a face analyser that will be used for AU extraction
|
// Creating a face analyser that will be used for AU extraction
|
||||||
FaceAnalysis::FaceAnalyser face_analyser(vector<cv::Vec3d>(), 0.7, 112, 112, au_loc, tri_loc);
|
FaceAnalysis::FaceAnalyser face_analyser(vector<cv::Vec3d>(), 0.7, 112, 112, au_loc, tri_loc);
|
||||||
|
|
|
@ -29,5 +29,5 @@ include_directories(../LandmarkDetector/include)
|
||||||
|
|
||||||
add_library( FaceAnalyser ${SOURCE} ${HEADERS})
|
add_library( FaceAnalyser ${SOURCE} ${HEADERS})
|
||||||
|
|
||||||
install (TARGETS FaceAnalyser DESTINATION bin)
|
install (TARGETS FaceAnalyser DESTINATION lib)
|
||||||
install (FILES ${HEADERS} DESTINATION include)
|
install (FILES ${HEADERS} DESTINATION include/OpenFace)
|
||||||
|
|
|
@ -35,7 +35,7 @@ SET(HEADERS
|
||||||
include_directories(./include)
|
include_directories(./include)
|
||||||
include_directories(${LandmarkDetector_SOURCE_DIR}/include)
|
include_directories(${LandmarkDetector_SOURCE_DIR}/include)
|
||||||
|
|
||||||
add_library( LandmarkDetector ${SOURCE} ${HEADERS})
|
add_library( LandmarkDetector ${SOURCE} ${HEADERS} )
|
||||||
|
|
||||||
install (TARGETS LandmarkDetector DESTINATION bin)
|
install (TARGETS LandmarkDetector DESTINATION lib)
|
||||||
install (FILES ${HEADERS} DESTINATION include)
|
install (FILES ${HEADERS} DESTINATION include/OpenFace)
|
||||||
|
|
|
@ -67,6 +67,11 @@
|
||||||
// System includes
|
// System includes
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
#ifndef CONFIG_DIR
|
||||||
|
#define CONFIG_DIR "~"
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -200,15 +205,25 @@ FaceModelParameters::FaceModelParameters(vector<string> &arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure model_location is valid
|
// Make sure model_location is valid
|
||||||
if (!boost::filesystem::exists(boost::filesystem::path(model_location)))
|
// First check working directory, then the executable's directory, then the config path set by the build process.
|
||||||
|
boost::filesystem::path config_path = boost::filesystem::path(CONFIG_DIR);
|
||||||
|
boost::filesystem::path model_path = boost::filesystem::path(model_location);
|
||||||
|
if (boost::filesystem::exists(model_path))
|
||||||
{
|
{
|
||||||
model_location = (root / model_location).string();
|
model_location = model_path.string();
|
||||||
if (!boost::filesystem::exists(boost::filesystem::path(model_location)))
|
}
|
||||||
|
else if (boost::filesystem::exists(root/model_path))
|
||||||
|
{
|
||||||
|
model_location = (root/model_path).string();
|
||||||
|
}
|
||||||
|
else if (boost::filesystem::exists(config_path/model_path))
|
||||||
|
{
|
||||||
|
model_location = (config_path/model_path).string();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Could not find the landmark detection model to load" << std::endl;
|
std::cout << "Could not find the landmark detection model to load" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FaceModelParameters::init()
|
void FaceModelParameters::init()
|
||||||
|
|
Loading…
Reference in a new issue