Bit more on HOG recording.

This commit is contained in:
Tadas Baltrusaitis 2017-11-01 20:03:31 +00:00
parent 32a9ee0a7e
commit 550b325095
4 changed files with 15 additions and 10 deletions

View file

@ -50,10 +50,10 @@ namespace Recorder
public: public:
// The constructor for the recorder, by default does not do anything // The constructor for the recorder, by default does not do anything
RecorderHOG(int num_rows, int num_cols, int num_channels); RecorderHOG();
// Adding observations to the recorder // Adding observations to the recorder
void AddObservationHOG(bool success, const cv::Mat_<double>& hog_descriptor); void AddObservationHOG(bool success, const cv::Mat_<double>& hog_descriptor, int num_cols, int num_rows, int num_channels);
bool Open(std::string filename); bool Open(std::string filename);
@ -64,9 +64,6 @@ namespace Recorder
std::ofstream hog_file; std::ofstream hog_file;
int num_rows;
int num_cols;
const int num_channels;
}; };
} }
#endif #endif

View file

@ -75,7 +75,7 @@ namespace Recorder
void AddObservationGaze(const cv::Point3f& gazeDirection0, const cv::Point3f& gazeDirection1, void AddObservationGaze(const cv::Point3f& gazeDirection0, const cv::Point3f& gazeDirection1,
const cv::Vec2d& gaze_angle, const cv::Mat_<double>& eye_landmarks); const cv::Vec2d& gaze_angle, const cv::Mat_<double>& eye_landmarks);
void AddObservationFaceAlign(const cv::Mat& aligned_face); void AddObservationFaceAlign(const cv::Mat& aligned_face);
void AddObservationHOG(const cv::Mat_<double>& aligned_HOG); void AddObservationHOG(bool good_frame, const cv::Mat_<double>& hog_descriptor, int num_cols, int num_rows, int num_channels);
void AddObservationSuccess(double confidence, bool success); void AddObservationSuccess(double confidence, bool success);
void AddObservationTimestamp(double timestamp); void AddObservationTimestamp(double timestamp);

View file

@ -38,7 +38,7 @@
using namespace Recorder; using namespace Recorder;
// Default constructor initializes the variables // Default constructor initializes the variables
RecorderHOG::RecorderHOG(int num_rows, int num_cols, int num_channels) :hog_file(),num_rows(num_rows), num_cols(num_cols), num_channels(num_channels) {}; RecorderHOG::RecorderHOG() :hog_file() {};
// TODO the other 4 constructors + destructors? // TODO the other 4 constructors + destructors?
@ -56,7 +56,7 @@ void RecorderHOG::Close()
} }
// Writing to a HOG file // Writing to a HOG file
void RecorderHOG::AddObservationHOG(bool good_frame, const cv::Mat_<double>& hog_descriptor) void RecorderHOG::AddObservationHOG(bool good_frame, const cv::Mat_<double>& hog_descriptor, int num_cols, int num_rows, int num_channels)
{ {
hog_file.write((char*)(&num_cols), 4); hog_file.write((char*)(&num_cols), 4);

View file

@ -89,8 +89,11 @@ RecorderOpenFace::RecorderOpenFace(const std::string out_directory, const std::s
output_AUs, output_gaze, num_face_landmarks, num_model_modes, num_eye_landmarks, au_names_class, au_names_reg); output_AUs, output_gaze, num_face_landmarks, num_model_modes, num_eye_landmarks, au_names_class, au_names_reg);
// Consruct HOG recorder here // Consruct HOG recorder here
if(output_hog)
{
std::string hog_filename = (path(record_root) / path(filename).replace_extension(".hog")).string(); std::string hog_filename = (path(record_root) / path(filename).replace_extension(".hog")).string();
hog_recorder.Open(hog_filename); hog_recorder.Open(hog_filename);
}
// TODO construct a video recorder // TODO construct a video recorder
@ -98,5 +101,10 @@ RecorderOpenFace::RecorderOpenFace(const std::string out_directory, const std::s
} }
void RecorderOpenFace::AddObservationHOG(bool good_frame, const cv::Mat_<double>& hog_descriptor, int num_cols, int num_rows, int num_channels)
{
hog_recorder.AddObservationHOG(good_frame, hog_descriptor, num_cols, num_rows, num_channels);
}
// TODO the other 4 constructors + destructors? // TODO the other 4 constructors + destructors?