Some more model simplification, only write the header on first write

This commit is contained in:
Tadas Baltrusaitis 2017-11-05 07:45:19 +00:00
parent cb229ad50b
commit ca3b252d19
2 changed files with 25 additions and 7 deletions

View file

@ -101,6 +101,7 @@ namespace Recorder
// Keep track of the file and output root location // Keep track of the file and output root location
std::string record_root; std::string record_root;
std::string filename; std::string filename;
std::string csv_filename;
// The actual output file stream that will be written // The actual output file stream that will be written
RecorderCSV csv_recorder; RecorderCSV csv_recorder;

View file

@ -82,8 +82,7 @@ RecorderOpenFace::RecorderOpenFace(const std::string out_directory, const std::s
CreateDirectory(record_root); CreateDirectory(record_root);
// Create the required individual recorders, CSV, HOG, aligned, video // Create the required individual recorders, CSV, HOG, aligned, video
std::string csv_filename = (path(record_root) / path(filename).replace_extension(".csv")).string(); csv_filename = (path(record_root) / path(filename).replace_extension(".csv")).string();
// Consruct HOG recorder here // Consruct HOG recorder here
if(params.outputHOG()) if(params.outputHOG())
@ -92,16 +91,13 @@ RecorderOpenFace::RecorderOpenFace(const std::string out_directory, const std::s
hog_recorder.Open(hog_filename); hog_recorder.Open(hog_filename);
} }
// TODO construct a video recorder
// saving the videos // saving the videos
if (params.outputTrackedVideo()) if (params.outputTrackedVideo())
{ {
this->video_filename = (path(record_root) / path(filename).replace_extension(".avi")).string(); this->video_filename = (path(record_root) / path(filename).replace_extension(".avi")).string();
} }
// TODO aligned Prepare image recording
// Prepare image recording
observation_count = 0; observation_count = 0;
@ -141,6 +137,27 @@ void RecorderOpenFace::WriteObservation()
if(observation_count == 1) if(observation_count == 1)
{ {
// As we are writing out the header, work out some things like number of landmarks, names of AUs etc.
int num_face_landmarks = landmarks_2D.rows / 2;
int num_eye_landmarks = eye_landmarks.size();
int num_model_modes = pdm_params_local.rows / 2;
std::vector<std::string> au_names_class;
for (auto au : au_occurences)
{
au_names_class.push_back(au.first);
}
std::sort(au_names_class.begin(), au_names_class.end());
std::vector<std::string> au_names_reg;
for (auto au : au_intensities)
{
au_names_reg.push_back(au.first);
}
std::sort(au_names_reg.begin(), au_names_reg.end());
csv_recorder.Open(csv_filename, params.output2DLandmarks(), params.output3DLandmarks(), params.outputPDMParams(), params.outputPose(), csv_recorder.Open(csv_filename, params.output2DLandmarks(), params.output3DLandmarks(), params.outputPDMParams(), params.outputPose(),
params.outputAUs(), params.outputGaze(), num_face_landmarks, num_model_modes, num_eye_landmarks, au_names_class, au_names_reg); params.outputAUs(), params.outputGaze(), num_face_landmarks, num_model_modes, num_eye_landmarks, au_names_class, au_names_reg);
} }