| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef RECORDER_OPENFACE_H |
| | #define RECORDER_OPENFACE_H |
| |
|
| | #include "RecorderCSV.h" |
| | #include "RecorderHOG.h" |
| | #include "RecorderOpenFaceParameters.h" |
| |
|
| | |
| | #include <vector> |
| |
|
| | |
| | #include <opencv2/core/core.hpp> |
| | #include <opencv2/highgui/highgui.hpp> |
| |
|
| | #include <thread> |
| |
|
| | #include <ConcurrentQueue.h> |
| |
|
| | namespace Utilities |
| | { |
| |
|
| | |
| | |
| | |
| | |
| | class RecorderOpenFace { |
| |
|
| | public: |
| |
|
| | |
| | RecorderOpenFace(const std::string in_filename, const RecorderOpenFaceParameters& parameters, std::vector<std::string>& arguments); |
| | RecorderOpenFace(const std::string in_filename, const RecorderOpenFaceParameters& parameters, std::string output_directory); |
| |
|
| | ~RecorderOpenFace(); |
| |
|
| | |
| | void Close(); |
| |
|
| | |
| |
|
| | |
| | void SetObservationTimestamp(double timestamp); |
| |
|
| | |
| | void SetObservationFrameNumber(int frame_number); |
| |
|
| | |
| | void SetObservationFaceID(int face_id); |
| |
|
| | |
| | void SetObservationLandmarks(const cv::Mat_<float>& landmarks_2D, const cv::Mat_<float>& landmarks_3D, |
| | const cv::Vec6f& params_global, const cv::Mat_<float>& params_local, double confidence, bool success); |
| |
|
| | |
| | void SetObservationPose(const cv::Vec6f& pose); |
| |
|
| | |
| | void SetObservationActionUnits(const std::vector<std::pair<std::string, double> >& au_intensities, |
| | const std::vector<std::pair<std::string, double> >& au_occurences); |
| |
|
| | |
| | void SetObservationGaze(const cv::Point3f& gazeDirection0, const cv::Point3f& gazeDirection1, |
| | const cv::Vec2f& gaze_angle, const std::vector<cv::Point2f>& eye_landmarks2D, const std::vector<cv::Point3f>& eye_landmarks3D); |
| |
|
| | |
| | void SetObservationFaceAlign(const cv::Mat& aligned_face); |
| |
|
| | |
| | void SetObservationHOG(bool good_frame, const cv::Mat_<double>& hog_descriptor, int num_cols, int num_rows, int num_channels); |
| |
|
| | void SetObservationVisualization(const cv::Mat &vis_track); |
| |
|
| | |
| | void WriteObservation(); |
| |
|
| | |
| | void WriteObservationTracked(); |
| |
|
| | std::string GetCSVFile() { return csv_filename; } |
| |
|
| | private: |
| |
|
| | |
| | RecorderOpenFace & operator= (const RecorderOpenFace& other); |
| | RecorderOpenFace & operator= (const RecorderOpenFace&& other); |
| | RecorderOpenFace(const RecorderOpenFace&& other); |
| | RecorderOpenFace(const RecorderOpenFace& other); |
| |
|
| | void PrepareRecording(const std::string& in_filename); |
| |
|
| | |
| | void VideoWritingTask(bool is_sequence); |
| | void AlignedImageWritingTask(); |
| |
|
| | |
| | const RecorderOpenFaceParameters params; |
| |
|
| | |
| | std::string record_root; |
| | std::string default_record_directory = "processed"; |
| | std::string out_name; |
| | std::string csv_filename; |
| | std::string aligned_output_directory; |
| | std::ofstream metadata_file; |
| |
|
| | |
| | RecorderCSV csv_recorder; |
| | RecorderHOG hog_recorder; |
| |
|
| | |
| | |
| | double timestamp; |
| | int face_id; |
| | int frame_number; |
| |
|
| | |
| | cv::Mat_<float> landmarks_2D; |
| | cv::Mat_<float> landmarks_3D; |
| | cv::Vec6f pdm_params_global; |
| | cv::Mat_<float> pdm_params_local; |
| | double landmark_detection_confidence; |
| | bool landmark_detection_success; |
| |
|
| | |
| | cv::Vec6f head_pose; |
| |
|
| | |
| | std::vector<std::pair<std::string, double> > au_intensities; |
| | std::vector<std::pair<std::string, double> > au_occurences; |
| |
|
| | |
| | cv::Point3f gaze_direction0; |
| | cv::Point3f gaze_direction1; |
| | cv::Vec2f gaze_angle; |
| | std::vector<cv::Point2f> eye_landmarks2D; |
| | std::vector<cv::Point3f> eye_landmarks3D; |
| |
|
| | |
| | cv::VideoWriter video_writer; |
| | std::string media_filename; |
| | |
| | |
| | const int TRACKED_QUEUE_CAPACITY = 100; |
| | bool tracked_writing_thread_started; |
| | cv::Mat vis_to_out; |
| | ConcurrentQueue<std::pair<std::string, cv::Mat> > vis_to_out_queue; |
| |
|
| | |
| | const int ALIGNED_QUEUE_CAPACITY = 100; |
| | bool aligned_writing_thread_started; |
| | cv::Mat aligned_face; |
| | ConcurrentQueue<std::pair<std::string, cv::Mat> > aligned_face_queue; |
| |
|
| | std::thread video_writing_thread; |
| | std::thread aligned_writing_thread; |
| |
|
| | }; |
| | } |
| | #endif |