More recorder simplification.

This commit is contained in:
Tadas Baltrusaitis 2017-11-04 20:57:24 +00:00
parent 8beb7e58c4
commit cb229ad50b
5 changed files with 17 additions and 45 deletions

View file

@ -557,12 +557,8 @@ int main (int argc, char **argv)
return 0;
}
void get_output_feature_params(vector<string> &output_similarity_aligned, vector<string> &output_hog_aligned_files, bool& visualize_track,
bool& visualize_align, bool& visualize_hog, bool &output_2D_landmarks, bool &output_3D_landmarks, bool &output_model_params,
bool &output_pose, bool &output_AUs, bool &output_gaze, vector<string> &arguments)
void get_visualization_params(bool& visualize_track, bool& visualize_align, bool& visualize_hog,vector<string> &arguments)
{
output_similarity_aligned.clear();
output_hog_aligned_files.clear();
bool* valid = new bool[arguments.size()];
@ -632,36 +628,6 @@ void get_output_feature_params(vector<string> &output_similarity_aligned, vector
visualize_track = true;
valid[i] = false;
}
else if (arguments[i].compare("-no2Dfp") == 0)
{
output_2D_landmarks = false;
valid[i] = false;
}
else if (arguments[i].compare("-no3Dfp") == 0)
{
output_3D_landmarks = false;
valid[i] = false;
}
else if (arguments[i].compare("-noMparams") == 0)
{
output_model_params = false;
valid[i] = false;
}
else if (arguments[i].compare("-noPose") == 0)
{
output_pose = false;
valid[i] = false;
}
else if (arguments[i].compare("-noAUs") == 0)
{
output_AUs = false;
valid[i] = false;
}
else if (arguments[i].compare("-noGaze") == 0)
{
output_gaze = false;
valid[i] = false;
}
}
for (int i = arguments.size() - 1; i >= 0; --i)

View file

@ -142,6 +142,7 @@
<ClCompile Include="src\RecorderCSV.cpp" />
<ClCompile Include="src\RecorderHOG.cpp" />
<ClCompile Include="src\RecorderOpenFace.cpp" />
<ClCompile Include="src\RecorderOpenFaceParameters.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\RecorderCSV.h" />

View file

@ -24,6 +24,9 @@
<ClCompile Include="src\RecorderOpenFace.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\RecorderOpenFaceParameters.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\RecorderCSV.h">

View file

@ -47,14 +47,13 @@ using namespace std;
namespace Recorder
{
struct RecorderOpenFaceParameters
class RecorderOpenFaceParameters
{
public:
// Constructors
RecorderOpenFaceParameters();
RecorderOpenFaceParameters(vector<string> &arguments, double fps_vid_out = 30, std::string output_codec = "DIVX");
RecorderOpenFaceParameters(std::vector<std::string> &arguments, double fps_vid_out = 30, std::string output_codec = "DIVX");
bool isSequence() const { return is_sequence; }
bool output2DLandmarks() const { return output_2D_landmarks; }
@ -91,8 +90,11 @@ namespace Recorder
// Some video recording parameters
std::string output_codec;
double fps_vid_out;
// For output location
std::string output_root = "";
};
}
#endif // __FACE_ANALYSER_PARAM_H
#endif // ____RECORDER_OPENFACE_PARAM_H

View file

@ -118,7 +118,7 @@ void RecorderOpenFace::SetObservationVisualization(const cv::Mat &vis_track)
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);
video_writer.open(video_filename, CV_FOURCC(output_codec[0], output_codec[1], output_codec[2], output_codec[3]), params.outputFps(), vis_track.size(), true);
}
catch (cv::Exception e)
{
@ -141,20 +141,20 @@ void RecorderOpenFace::WriteObservation()
if(observation_count == 1)
{
csv_recorder.Open(csv_filename, output_2D_landmarks, output_3D_landmarks, output_model_params, output_pose,
output_AUs, output_gaze, num_face_landmarks, num_model_modes, num_eye_landmarks, au_names_class, au_names_reg);
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);
}
this->csv_recorder.WriteLine(observation_count, timestamp, landmark_detection_success,
landmark_detection_confidence, landmarks_2D, landmarks_3D, pdm_params_local, pdm_params_global, head_pose,
gaze_direction0, gaze_direction1, gaze_angle, eye_landmarks, au_intensities, au_occurences);
if(output_hog)
if(params.outputHOG())
{
this->hog_recorder.Write();
}
if(output_tracked_video)
if(params.outputTrackedVideo())
{
if (vis_to_out.empty())
{