/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2017, Carnegie Mellon University and University of Cambridge, // all rights reserved. // // ACADEMIC OR NON-PROFIT ORGANIZATION NONCOMMERCIAL RESEARCH USE ONLY // // BY USING OR DOWNLOADING THE SOFTWARE, YOU ARE AGREEING TO THE TERMS OF THIS LICENSE AGREEMENT. // IF YOU DO NOT AGREE WITH THESE TERMS, YOU MAY NOT USE OR DOWNLOAD THE SOFTWARE. // // License can be found in OpenFace-license.txt // * Any publications arising from the use of this software, including but // not limited to academic journal and conference publications, technical // reports and manuals, must cite at least one of the following works: // // OpenFace 2.0: Facial Behavior Analysis Toolkit // Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency // in IEEE International Conference on Automatic Face and Gesture Recognition, 2018 // // Convolutional experts constrained local model for facial landmark detection. // A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency, // in Computer Vision and Pattern Recognition Workshops, 2017. // // Rendering of Eyes for Eye-Shape Registration and Gaze Estimation // Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling // in IEEE International. Conference on Computer Vision (ICCV), 2015 // // Cross-dataset learning and person-specific normalisation for automatic Action Unit detection // Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson // in Facial Expression Recognition and Analysis Challenge, // IEEE International Conference on Automatic Face and Gesture Recognition, 2015 // /////////////////////////////////////////////////////////////////////////////// // FaceTrackingVid.cpp : Defines the entry point for the console application for tracking faces in videos. // Libraries for landmark detection (includes CLNF and CLM modules) #include "LandmarkCoreIncludes.h" #include "GazeEstimation.h" #include #include #include #include #include #include #include #include #define INFO_STREAM( stream ) \ std::cout << stream << std::endl #define WARN_STREAM( stream ) \ std::cout << "Warning: " << stream << std::endl #define ERROR_STREAM( stream ) \ std::cout << "Error: " << stream << std::endl static void printErrorAndAbort(const std::string & error) { std::cout << error << std::endl; abort(); } #define FATAL_STREAM( stream ) \ printErrorAndAbort( std::string( "Fatal error: " ) + stream ) std::vector get_arguments(int argc, std::string *out_dir, char **argv) { std::vector arguments; for (int i = 0; i < argc; ++i) { arguments.push_back(std::string(argv[i])); if (std::string(argv[i]).compare("-out_dir") == 0) { *out_dir = std::string(argv[i+1]); } } return arguments; } int main(int argc, char **argv) { std::string out_dir = "."; std::vector arguments = get_arguments(argc, &out_dir, argv); std::cout<< "out_dir:" << out_dir < grayscale_image = sequence_reader.GetGrayFrame(); // The actual facial landmark detection / tracking bool detection_success = LandmarkDetector::DetectLandmarksInVideo(rgb_image, face_model, det_parameters, grayscale_image); // Gaze tracking, absolute gaze direction cv::Point3f gazeDirection0(0, 0, -1); cv::Point3f gazeDirection1(0, 0, -1); cv::Vec6d pose_estimate(0, 0, 0, 0, 0, 0); // If tracking succeeded and we have an eye model, estimate gaze if (detection_success && face_model.eye_model) { GazeAnalysis::EstimateGaze(face_model, gazeDirection0, sequence_reader.fx, sequence_reader.fy, sequence_reader.cx, sequence_reader.cy, true); GazeAnalysis::EstimateGaze(face_model, gazeDirection1, sequence_reader.fx, sequence_reader.fy, sequence_reader.cx, sequence_reader.cy, false); } // Work out the pose of the head from the tracked model if (detection_success){ pose_estimate = LandmarkDetector::GetPose(face_model, sequence_reader.fx, sequence_reader.fy, sequence_reader.cx, sequence_reader.cy); } // cv::Mat sim_warped_img; // face_analyser.PredictStaticAUsAndComputeFeatures(rgb_image, face_model.detected_landmarks); // face_analyser.GetLatestAlignedFace(sim_warped_img); // Keeping track of FPS fps_tracker.AddFrame(); // Displaying the tracking visualizations // std::cout<< "setting observation landmarks"<