diff --git a/.travis.yml b/.travis.yml index 155b85a8..af46fde2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,8 @@ compiler: os: - linux - + - osx + before_install: # OpenCV dependencies and boost diff --git a/CMakeLists.txt b/CMakeLists.txt index 0df087d5..de49ca32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,9 +9,15 @@ set(CMAKE_CONFIG_DIR etc/OpenFace) set(CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_CONFIG_DIR}") add_definitions(-DCONFIG_DIR="${CONFIG_DIR}") -find_package( BLAS REQUIRED ) -include_directories( ${BLAS_INCLUDE_DIRS} ) -LINK_DIRECTORIES(${BLAS_LIBRARY_DIRS}) +if (APPLE) + find_package( OpenBLAS REQUIRED ) + include_directories( ${OpenBLAS_INCLUDE_DIRS} ) + LINK_DIRECTORIES(${OpenBLAS_LIBRARY_DIRS}) +else() + find_package( BLAS REQUIRED ) + include_directories( ${BLAS_INCLUDE_DIRS} ) + LINK_DIRECTORIES(${BLAS_LIBRARY_DIRS}) +endif() find_package( OpenCV 3.3 REQUIRED ) diff --git a/lib/local/LandmarkDetector/src/PDM.cpp b/lib/local/LandmarkDetector/src/PDM.cpp index 8baed710..12cc9333 100644 --- a/lib/local/LandmarkDetector/src/PDM.cpp +++ b/lib/local/LandmarkDetector/src/PDM.cpp @@ -460,6 +460,7 @@ void PDM::UpdateModelParameters(const cv::Mat_& delta_p, cv::Mat_& // get the original rotation matrix cv::Vec3f eulerGlobal(params_global[1], params_global[2], params_global[3]); + cv::Matx33f R1 = Utilities::Euler2RotationMatrix(eulerGlobal); // construct R' = [1, -wz, wy @@ -479,8 +480,18 @@ void PDM::UpdateModelParameters(const cv::Mat_& delta_p, cv::Mat_& // Extract euler angle (through axis angle first to make sure it's legal) cv::Vec3f axis_angle = Utilities::RotationMatrix2AxisAngle(R3); + cv::Vec3f euler = Utilities::AxisAngle2Euler(axis_angle); + // Temporary fix to numerical instability + if (isnan(euler[0]) || isnan(euler[1]) || isnan(euler[2])) + { + euler[0] = 0; + euler[1] = 0; + euler[2] = 0; + + } + params_global[1] = euler[0]; params_global[2] = euler[1]; params_global[3] = euler[2];