Ability to specify output image formats and removing unused quiet parameter.

This commit is contained in:
Tadas Baltrusaitis
2018-11-04 13:10:28 +00:00
parent 91cb3f9c39
commit 126b34f181
5 changed files with 24 additions and 16 deletions

View File

@@ -99,9 +99,6 @@ struct FaceModelParameters
string mtcnn_face_detector_location;
FaceDetector curr_face_detector;
// Should the results be visualised and reported to console
bool quiet_mode;
// Should the model be refined hierarchically (if available)
bool refine_hierarchical;

View File

@@ -150,13 +150,6 @@ FaceModelParameters::FaceModelParameters(vector<string> &arguments)
valid[i + 1] = false;
i++;
}
else if (arguments[i].compare("-q") == 0)
{
quiet_mode = true;
valid[i] = false;
}
else if (arguments[i].compare("-wild") == 0)
{
// For in the wild fitting these parameters are suitable
@@ -345,7 +338,6 @@ void FaceModelParameters::init()
// Face detection
haar_face_detector_location = "classifiers/haarcascade_frontalface_alt.xml";
mtcnn_face_detector_location = "model/mtcnn_detector/MTCNN_detector.txt";
quiet_mode = false;
// By default use MTCNN
curr_face_detector = MTCNN_DETECTOR;

View File

@@ -70,6 +70,8 @@ namespace Utilities
bool outputTracked() const { return output_tracked; }
bool outputAlignedFaces() const { return output_aligned_faces; }
std::string outputCodec() const { return output_codec; }
std::string imageFormatAligned() const { return image_format_aligned; }
std::string imageFormatVisualization() const { return image_format_visualization; }
double outputFps() const { return fps_vid_out; }
bool outputBadAligned() const { return record_aligned_bad; }
@@ -107,6 +109,10 @@ namespace Utilities
std::string output_codec;
double fps_vid_out;
// Image recording parameters
std::string image_format_aligned;
std::string image_format_visualization;
// Camera parameters for recording in the meta file;
float fx, fy, cx, cy;

View File

@@ -197,7 +197,7 @@ void RecorderOpenFace::PrepareRecording(const std::string& in_filename)
}
else
{
this->media_filename = out_name + ".jpg";
this->media_filename = out_name + "." + params.imageFormatVisualization();
metadata_file << "Output image:" << this->media_filename << endl;
this->media_filename = (path(record_root) / this->media_filename).string();
}
@@ -378,18 +378,18 @@ void RecorderOpenFace::WriteObservation()
char name[100];
// Filename is based on frame number
// Filename is based on frame number (TODO stringstream this)
if(params.isSequence())
std::sprintf(name, "frame_det_%02d_%06d.bmp", face_id, frame_number);
std::sprintf(name, "frame_det_%02d_%06d.", face_id, frame_number);
else
std::sprintf(name, "face_det_%06d.bmp", face_id);
std::sprintf(name, "face_det_%06d.", face_id);
// Construct the output filename
boost::filesystem::path slash("/");
std::string preferredSlash = slash.make_preferred().string();
string out_file = aligned_output_directory + preferredSlash + string(name);
string out_file = aligned_output_directory + preferredSlash + string(name) + params.imageFormatAligned();
if(params.outputBadAligned() || landmark_detection_success)
{

View File

@@ -58,6 +58,9 @@ RecorderOpenFaceParameters::RecorderOpenFaceParameters(std::vector<std::string>
// Default output code
this->output_codec = "DIVX";
this->image_format_aligned = "bmp";
this->image_format_visualization = "jpg";
bool output_set = false;
this->output_2D_landmarks = false;
@@ -74,6 +77,16 @@ RecorderOpenFaceParameters::RecorderOpenFaceParameters(std::vector<std::string>
for (size_t i = 0; i < arguments.size(); ++i)
{
if (arguments[i].compare("-format_aligned") == 0)
{
this->image_format_aligned = arguments[i+1];
i++;
}
if (arguments[i].compare("-format_vis_image") == 0)
{
this->image_format_visualization = arguments[i + 1];
i++;
}
if (arguments[i].compare("-nobadaligned") == 0)
{
this->record_aligned_bad = false;