Some cross-platform fixes.
This commit is contained in:
parent
f9b979c547
commit
b4dd338a86
2 changed files with 22 additions and 15 deletions
|
@ -132,7 +132,7 @@ RecorderOpenFace::RecorderOpenFace(const std::string in_filename, RecorderOpenFa
|
||||||
|
|
||||||
// Create the filename for the general output file that contains all of the meta information about the recording
|
// Create the filename for the general output file that contains all of the meta information about the recording
|
||||||
path of_det_name(filename);
|
path of_det_name(filename);
|
||||||
of_det_name = path(record_root) / of_det_name.concat("_of_details.txt");
|
of_det_name = path(record_root) / path(filename + "_of_details.txt");
|
||||||
|
|
||||||
// Write in the of file what we are outputing what is the input etc.
|
// Write in the of file what we are outputing what is the input etc.
|
||||||
metadata_file.open(of_det_name.string(), std::ios_base::out);
|
metadata_file.open(of_det_name.string(), std::ios_base::out);
|
||||||
|
@ -163,13 +163,13 @@ RecorderOpenFace::RecorderOpenFace(const std::string in_filename, RecorderOpenFa
|
||||||
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;
|
||||||
|
|
||||||
// Create the required individual recorders, CSV, HOG, aligned, video
|
// Create the required individual recorders, CSV, HOG, aligned, video
|
||||||
csv_filename = path(filename).concat(".csv").string();
|
csv_filename = filename + ".csv";
|
||||||
|
|
||||||
// Consruct HOG recorder here
|
// Consruct HOG recorder here
|
||||||
if(params.outputHOG())
|
if(params.outputHOG())
|
||||||
{
|
{
|
||||||
// Output the data based on record_root, but do not include record_root in the meta file, as it is also in that directory
|
// Output the data based on record_root, but do not include record_root in the meta file, as it is also in that directory
|
||||||
std::string hog_filename = path(filename).concat(".hog").string();
|
std::string hog_filename = filename + ".hog";
|
||||||
metadata_file << "Output HOG:" << hog_filename << endl;
|
metadata_file << "Output HOG:" << hog_filename << endl;
|
||||||
hog_filename = (path(record_root) / hog_filename).string();
|
hog_filename = (path(record_root) / hog_filename).string();
|
||||||
hog_recorder.Open(hog_filename);
|
hog_recorder.Open(hog_filename);
|
||||||
|
@ -181,13 +181,13 @@ RecorderOpenFace::RecorderOpenFace(const std::string in_filename, RecorderOpenFa
|
||||||
if(parameters.isSequence())
|
if(parameters.isSequence())
|
||||||
{
|
{
|
||||||
// Output the data based on record_root, but do not include record_root in the meta file, as it is also in that directory
|
// Output the data based on record_root, but do not include record_root in the meta file, as it is also in that directory
|
||||||
this->media_filename = path(filename).concat(".avi").string();
|
this->media_filename = filename + ".avi";
|
||||||
metadata_file << "Output video:" << this->media_filename << endl;
|
metadata_file << "Output video:" << this->media_filename << endl;
|
||||||
this->media_filename = (path(record_root) / this->media_filename).string();
|
this->media_filename = (path(record_root) / this->media_filename).string();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->media_filename = path(filename).concat(".jpg").string();
|
this->media_filename = filename + ".jpg";
|
||||||
metadata_file << "Output image:" << this->media_filename << endl;
|
metadata_file << "Output image:" << this->media_filename << endl;
|
||||||
this->media_filename = (path(record_root) / this->media_filename).string();
|
this->media_filename = (path(record_root) / this->media_filename).string();
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ RecorderOpenFace::RecorderOpenFace(const std::string in_filename, RecorderOpenFa
|
||||||
// Prepare image recording
|
// Prepare image recording
|
||||||
if (params.outputAlignedFaces())
|
if (params.outputAlignedFaces())
|
||||||
{
|
{
|
||||||
aligned_output_directory = path(filename + "_aligned").string();
|
aligned_output_directory = filename + "_aligned";
|
||||||
metadata_file << "Output aligned directory:" << this->aligned_output_directory << endl;
|
metadata_file << "Output aligned directory:" << this->aligned_output_directory << endl;
|
||||||
this->aligned_output_directory = (path(record_root) / this->aligned_output_directory).string();
|
this->aligned_output_directory = (path(record_root) / this->aligned_output_directory).string();
|
||||||
CreateDirectory(aligned_output_directory);
|
CreateDirectory(aligned_output_directory);
|
||||||
|
|
|
@ -44,6 +44,10 @@
|
||||||
// OpenCV includes
|
// OpenCV includes
|
||||||
#include <opencv2/imgproc.hpp>
|
#include <opencv2/imgproc.hpp>
|
||||||
|
|
||||||
|
// For timing
|
||||||
|
#include <chrono>
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
using namespace Utilities;
|
using namespace Utilities;
|
||||||
|
|
||||||
#define INFO_STREAM( stream ) \
|
#define INFO_STREAM( stream ) \
|
||||||
|
@ -179,16 +183,19 @@ bool SequenceCapture::Open(std::vector<std::string>& arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get current date/time, format is YYYY-MM-DD.HH:mm, useful for saving data from webcam
|
// Get current date/time, format is YYYY-MM-DD.HH:mm, useful for saving data from webcam
|
||||||
const std::string currentDateTime() {
|
const std::string currentDateTime()
|
||||||
time_t now = time(0);
|
{
|
||||||
struct tm tstruct;
|
|
||||||
char buf[200];
|
|
||||||
localtime_s(&tstruct, &now);
|
|
||||||
// Visit http://www.cplusplus.com/reference/clibrary/ctime/strftime/
|
|
||||||
// for more information about date/time format
|
|
||||||
strftime(buf, sizeof(buf), "%Y-%m-%d-%H-%M", &tstruct);
|
|
||||||
|
|
||||||
return buf;
|
time_t rawtime;
|
||||||
|
struct tm * timeinfo;
|
||||||
|
char buffer[80];
|
||||||
|
|
||||||
|
time(&rawtime);
|
||||||
|
timeinfo = localtime(&rawtime);
|
||||||
|
|
||||||
|
strftime(buffer, sizeof(buffer), "%Y-%m-%d-%H-%M", timeinfo);
|
||||||
|
|
||||||
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue