Correct metafile output for webcam.
This commit is contained in:
parent
d793e71f72
commit
67041371dd
5 changed files with 14 additions and 10 deletions
|
@ -186,7 +186,7 @@ int main (int argc, char **argv)
|
||||||
while (!captured_image.empty())
|
while (!captured_image.empty())
|
||||||
{
|
{
|
||||||
|
|
||||||
Utilities::RecorderOpenFaceParameters recording_params(arguments, false,
|
Utilities::RecorderOpenFaceParameters recording_params(arguments, false, false,
|
||||||
image_reader.fx, image_reader.fy, image_reader.cx, image_reader.cy);
|
image_reader.fx, image_reader.fy, image_reader.cx, image_reader.cy);
|
||||||
Utilities::RecorderOpenFace open_face_rec(image_reader.name, recording_params, arguments);
|
Utilities::RecorderOpenFace open_face_rec(image_reader.name, recording_params, arguments);
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ int main (int argc, char **argv)
|
||||||
|
|
||||||
cv::Mat captured_image;
|
cv::Mat captured_image;
|
||||||
|
|
||||||
Utilities::RecorderOpenFaceParameters recording_params(arguments, true,
|
Utilities::RecorderOpenFaceParameters recording_params(arguments, true, sequence_reader.IsWebcam(),
|
||||||
sequence_reader.fx, sequence_reader.fy, sequence_reader.cx, sequence_reader.cy, sequence_reader.fps);
|
sequence_reader.fx, sequence_reader.fy, sequence_reader.cx, sequence_reader.cy, sequence_reader.fps);
|
||||||
Utilities::RecorderOpenFace open_face_rec(sequence_reader.name, recording_params, arguments);
|
Utilities::RecorderOpenFace open_face_rec(sequence_reader.name, recording_params, arguments);
|
||||||
|
|
||||||
|
|
|
@ -53,9 +53,10 @@ namespace Utilities
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
RecorderOpenFaceParameters(std::vector<std::string> &arguments, bool sequence, float fx = -1, float fy = -1, float cx = -1, float cy = -1, double fps_vid_out = 30);
|
RecorderOpenFaceParameters(std::vector<std::string> &arguments, bool sequence, bool is_from_webcam, float fx = -1, float fy = -1, float cx = -1, float cy = -1, double fps_vid_out = 30);
|
||||||
|
|
||||||
bool isSequence() const { return is_sequence; }
|
bool isSequence() const { return is_sequence; }
|
||||||
|
bool isFromWebcam() const { return is_from_webcam; }
|
||||||
bool output2DLandmarks() const { return output_2D_landmarks; }
|
bool output2DLandmarks() const { return output_2D_landmarks; }
|
||||||
bool output3DLandmarks() const { return output_3D_landmarks; }
|
bool output3DLandmarks() const { return output_3D_landmarks; }
|
||||||
bool outputPDMParams() const { return output_model_params; }
|
bool outputPDMParams() const { return output_model_params; }
|
||||||
|
@ -77,6 +78,8 @@ namespace Utilities
|
||||||
|
|
||||||
// If we are recording results from a sequence each row refers to a frame, if we are recording an image each row is a face
|
// If we are recording results from a sequence each row refers to a frame, if we are recording an image each row is a face
|
||||||
bool is_sequence;
|
bool is_sequence;
|
||||||
|
// If the data is coming from a webcam
|
||||||
|
bool is_from_webcam;
|
||||||
|
|
||||||
// Keep track of what we are recording
|
// Keep track of what we are recording
|
||||||
bool output_2D_landmarks;
|
bool output_2D_landmarks;
|
||||||
|
|
|
@ -144,7 +144,7 @@ RecorderOpenFace::RecorderOpenFace(const std::string in_filename, RecorderOpenFa
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate relative and full path names in the meta file, unless it is a webcam
|
// Populate relative and full path names in the meta file, unless it is a webcam
|
||||||
if(in_filename.compare("webcam") != 0)
|
if(!params.isFromWebcam())
|
||||||
{
|
{
|
||||||
string input_filename_relative = in_filename;
|
string input_filename_relative = in_filename;
|
||||||
string input_filename_full = in_filename;
|
string input_filename_full = in_filename;
|
||||||
|
@ -158,7 +158,7 @@ RecorderOpenFace::RecorderOpenFace(const std::string in_filename, RecorderOpenFa
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Populate the metadata file
|
// Populate the metadata file
|
||||||
metadata_file << "Input:" << in_filename << endl;
|
metadata_file << "Input:webcam" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
metadata_file << "Camera parameters:" << parameters.getFx() << "," << parameters.getFy() << "," << parameters.getCx() << "," << parameters.getCy() << endl;
|
metadata_file << "Camera parameters:" << parameters.getFx() << "," << parameters.getFy() << "," << parameters.getCx() << "," << parameters.getCy() << endl;
|
||||||
|
@ -271,9 +271,6 @@ void RecorderOpenFace::WriteObservation()
|
||||||
|
|
||||||
std::sort(au_names_reg.begin(), au_names_reg.end());
|
std::sort(au_names_reg.begin(), au_names_reg.end());
|
||||||
|
|
||||||
csv_recorder.Open(csv_filename, params.isSequence(), 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);
|
|
||||||
|
|
||||||
metadata_file << "Output csv:" << csv_filename << endl;
|
metadata_file << "Output csv:" << csv_filename << endl;
|
||||||
metadata_file << "Gaze: " << params.outputGaze() << endl;
|
metadata_file << "Gaze: " << params.outputGaze() << endl;
|
||||||
metadata_file << "AUs: " << params.outputAUs() << endl;
|
metadata_file << "AUs: " << params.outputAUs() << endl;
|
||||||
|
@ -281,6 +278,10 @@ void RecorderOpenFace::WriteObservation()
|
||||||
metadata_file << "Landmarks 3D: " << params.output3DLandmarks() << endl;
|
metadata_file << "Landmarks 3D: " << params.output3DLandmarks() << endl;
|
||||||
metadata_file << "Pose: " << params.outputPose() << endl;
|
metadata_file << "Pose: " << params.outputPose() << endl;
|
||||||
metadata_file << "Shape parameters: " << params.outputPDMParams() << endl;
|
metadata_file << "Shape parameters: " << params.outputPDMParams() << endl;
|
||||||
|
|
||||||
|
csv_filename = (path(record_root) / csv_filename).string();
|
||||||
|
csv_recorder.Open(csv_filename, params.isSequence(), 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,
|
this->csv_recorder.WriteLine(observation_count, timestamp, landmark_detection_success,
|
||||||
|
|
|
@ -37,13 +37,13 @@ using namespace std;
|
||||||
|
|
||||||
using namespace Utilities;
|
using namespace Utilities;
|
||||||
|
|
||||||
RecorderOpenFaceParameters::RecorderOpenFaceParameters(std::vector<std::string> &arguments, bool sequence, float fx, float fy, float cx, float cy, double fps_vid_out)
|
RecorderOpenFaceParameters::RecorderOpenFaceParameters(std::vector<std::string> &arguments, bool sequence, bool from_webcam, float fx, float fy, float cx, float cy, double fps_vid_out)
|
||||||
{
|
{
|
||||||
|
|
||||||
string separator = string(1, boost::filesystem::path::preferred_separator);
|
string separator = string(1, boost::filesystem::path::preferred_separator);
|
||||||
|
|
||||||
this->is_sequence = sequence;
|
this->is_sequence = sequence;
|
||||||
|
this->is_from_webcam = from_webcam;
|
||||||
this->fx = fx;
|
this->fx = fx;
|
||||||
this->fy = fy;
|
this->fy = fy;
|
||||||
this->cx = cx;
|
this->cx = cx;
|
||||||
|
|
Loading…
Reference in a new issue