More refactorization.

This commit is contained in:
Tadas Baltrusaitis 2017-11-09 18:37:26 +00:00
parent 6c14aeab89
commit 8ded025baf
3 changed files with 17 additions and 9 deletions

View file

@ -188,7 +188,7 @@ int main (int argc, char **argv)
cv::Mat captured_image;
Utilities::RecorderOpenFaceParameters recording_params(arguments, true, sequence_reader.fps);
Utilities::RecorderOpenFace open_face_rec(output_files[f_n], sequence_reader.name, recording_params);
Utilities::RecorderOpenFace open_face_rec(sequence_reader.name, recording_params, arguments);
int frame_count = 0;
@ -211,8 +211,8 @@ int main (int argc, char **argv)
if (det_parameters.track_gaze && detection_success && face_model.eye_model)
{
GazeAnalysis::EstimateGaze(face_model, gazeDirection0, fx, fy, cx, cy, true);
GazeAnalysis::EstimateGaze(face_model, gazeDirection1, fx, fy, cx, cy, false);
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);
gazeAngle = GazeAnalysis::GetGazeAngle(gazeDirection0, gazeDirection1);
}
@ -245,7 +245,7 @@ int main (int argc, char **argv)
}
// Work out the pose of the head from the tracked model
cv::Vec6d pose_estimate = LandmarkDetector::GetPose(face_model, fx, fy, cx, cy);
cv::Vec6d pose_estimate = LandmarkDetector::GetPose(face_model, sequence_reader.fx, sequence_reader.fy, sequence_reader.cx, sequence_reader.cy);
// Drawing the visualization on the captured image
if (recording_params.outputTrackedVideo() || (visualize_track && !det_parameters.quiet_mode))

View file

@ -57,7 +57,7 @@ namespace Utilities
public:
// The constructor for the recorder, need to specify if we are recording a sequence or not
RecorderOpenFace(const std::string out_directory, const std::string in_filename, RecorderOpenFaceParameters parameters);
RecorderOpenFace(const std::string in_filename, RecorderOpenFaceParameters parameters, std::vector<std::string> arguments);
~RecorderOpenFace();
@ -104,7 +104,7 @@ namespace Utilities
const RecorderOpenFaceParameters params;
// Keep track of the file and output root location
std::string record_root;
std::string record_root = "processed"; // By default we are writing in the processed directory in the working directory
std::string filename;
std::string csv_filename;
std::string aligned_output_directory;

View file

@ -71,12 +71,20 @@ void CreateDirectory(std::string output_path)
}
RecorderOpenFace::RecorderOpenFace(const std::string out_directory, const std::string in_filename, RecorderOpenFaceParameters parameters):video_writer(), params(parameters)
RecorderOpenFace::RecorderOpenFace(const std::string in_filename, RecorderOpenFaceParameters parameters, std::vector<std::string> arguments):video_writer(), params(parameters)
{
// From the filename, strip out the name without directory and extension
filename = path(in_filename).replace_extension("").filename().string();
record_root = out_directory;
// Determine output directory
for (size_t i = 0; i < arguments.size(); ++i)
{
if (arguments[i].compare("-out_dir") == 0)
{
record_root = arguments[i + 1];
}
}
// Construct the directories required for the output
CreateDirectory(record_root);