mirror of
https://gitcode.com/gh_mirrors/ope/OpenFace.git
synced 2025-12-30 04:52:29 +00:00
Bug fix with output aligned faces and videos if no face is detected in the first frame. Adding .webm file support
This commit is contained in:
@@ -759,7 +759,7 @@ namespace OpenFaceOffline
|
||||
}
|
||||
else
|
||||
{
|
||||
d.Filter = "Video files|*.avi;*.wmv;*.mov;*.mpg;*.mpeg;*.mp4";
|
||||
d.Filter = "Video files|*.avi;*.webm;*.wmv;*.mov;*.mpg;*.mpeg;*.mp4";
|
||||
}
|
||||
if (d.ShowDialog(this) == true)
|
||||
{
|
||||
|
||||
@@ -175,11 +175,13 @@ namespace Utilities
|
||||
|
||||
// Do not exceed 100MB in the concurrent queue
|
||||
const int TRACKED_QUEUE_CAPACITY = 100;
|
||||
bool tracked_writing_thread_started;
|
||||
cv::Mat vis_to_out;
|
||||
tbb::concurrent_bounded_queue<std::pair<std::string, cv::Mat> > vis_to_out_queue;
|
||||
|
||||
// For aligned face writing
|
||||
const int ALIGNED_QUEUE_CAPACITY = 100;
|
||||
bool aligned_writing_thread_started;
|
||||
cv::Mat aligned_face;
|
||||
tbb::concurrent_bounded_queue<std::pair<std::string, cv::Mat> > aligned_face_queue;
|
||||
|
||||
|
||||
@@ -213,6 +213,8 @@ void RecorderOpenFace::PrepareRecording(const std::string& in_filename)
|
||||
}
|
||||
|
||||
this->frame_number = 0;
|
||||
this->tracked_writing_thread_started = false;
|
||||
this->aligned_writing_thread_started = false;
|
||||
}
|
||||
|
||||
RecorderOpenFace::RecorderOpenFace(const std::string in_filename, const RecorderOpenFaceParameters& parameters, std::vector<std::string>& arguments):video_writer(), params(parameters)
|
||||
@@ -363,10 +365,10 @@ void RecorderOpenFace::WriteObservation()
|
||||
// Write aligned faces
|
||||
if (params.outputAlignedFaces())
|
||||
{
|
||||
// To support both video and image input
|
||||
if ((face_id == 0 && frame_number == 0) || (face_id == 0 && frame_number == 1))
|
||||
{
|
||||
|
||||
if (!aligned_writing_thread_started)
|
||||
{
|
||||
aligned_writing_thread_started = true;
|
||||
int capacity = (1024 * 1024 * ALIGNED_QUEUE_CAPACITY) / (aligned_face.size().width *aligned_face.size().height * aligned_face.channels()) + 1;
|
||||
aligned_face_queue.set_capacity(capacity);
|
||||
|
||||
@@ -412,9 +414,10 @@ void RecorderOpenFace::WriteObservationTracked()
|
||||
|
||||
if (params.outputTracked())
|
||||
{
|
||||
// To support both video and image input
|
||||
if ((!params.isSequence() && frame_number == 0) || (params.isSequence() && frame_number == 1))
|
||||
|
||||
if (!tracked_writing_thread_started)
|
||||
{
|
||||
tracked_writing_thread_started = true;
|
||||
// Set up the queue for video writing based on output size
|
||||
int capacity = (1024 * 1024 * TRACKED_QUEUE_CAPACITY) / (vis_to_out.size().width * vis_to_out.size().height * vis_to_out.channels()) + 1;
|
||||
vis_to_out_queue.set_capacity(capacity);
|
||||
@@ -547,6 +550,8 @@ void RecorderOpenFace::Close()
|
||||
aligned_writing_thread.join();
|
||||
#endif
|
||||
|
||||
tracked_writing_thread_started = false;
|
||||
aligned_writing_thread_started = false;
|
||||
|
||||
hog_recorder.Close();
|
||||
csv_recorder.Close();
|
||||
|
||||
Reference in New Issue
Block a user