Starting to introduce recording parameters for simplicity.

This commit is contained in:
Tadas Baltrusaitis 2017-11-03 21:35:55 +00:00
parent 7f3ed9c855
commit 8beb7e58c4
3 changed files with 7 additions and 8 deletions

View File

@ -58,11 +58,7 @@ namespace Recorder
// 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);
// Simplified constructor that records all, TODO implement
RecorderOpenFace(const std::string out_directory, const std::string in_filename, bool sequence, int num_face_landmarks, int num_model_modes, int num_eye_landmarks,
const std::vector<std::string>& au_names_class, const std::vector<std::string>& au_names_reg);
~RecorderOpenFace();
// TODO copy, assignment and move operators? Do not allow

View File

@ -66,6 +66,8 @@ namespace Recorder
bool outputHOG() const { return output_hog; }
bool outputTrackedVideo() const { return output_tracked_video; }
bool outputAlignedFaces() const { return output_aligned_faces; }
std::string outputCodec() const { return output_codec; }
double outputFps() const { return fps_vid_out; }
private:

View File

@ -86,7 +86,7 @@ RecorderOpenFace::RecorderOpenFace(const std::string out_directory, const std::s
// Consruct HOG recorder here
if(output_hog)
if(params.outputHOG())
{
std::string hog_filename = (path(record_root) / path(filename).replace_extension(".hog")).string();
hog_recorder.Open(hog_filename);
@ -95,7 +95,7 @@ RecorderOpenFace::RecorderOpenFace(const std::string out_directory, const std::s
// TODO construct a video recorder
// saving the videos
if (output_tracked_video)
if (params.outputTrackedVideo())
{
this->video_filename = (path(record_root) / path(filename).replace_extension(".avi")).string();
}
@ -109,12 +109,13 @@ RecorderOpenFace::RecorderOpenFace(const std::string out_directory, const std::s
void RecorderOpenFace::SetObservationVisualization(const cv::Mat &vis_track)
{
if (output_tracked_video)
if (params.outputTrackedVideo())
{
// Initialize the video writer if it has not been opened yet
if(!video_writer.isOpened())
{
std::string video_filename = (path(record_root) / path(filename).replace_extension(".avi")).string();
std::string output_codec = params.outputCodec();
try
{
video_writer.open(video_filename, CV_FOURCC(output_codec[0], output_codec[1], output_codec[2], output_codec[3]), fps_vid_out, vis_track.size(), true);