A couple of bug fixes:

- progress reporting in sequence capture when not opening from command line arguments
- stop button and closing the app works when multiple videos have been opened
This commit is contained in:
Tadas Baltrusaitis 2018-01-24 18:58:12 +00:00
parent 6dae14ac6b
commit 7addeffdea
3 changed files with 25 additions and 8 deletions

View file

@ -161,6 +161,12 @@ namespace OpenFaceOffline
{ {
SequenceReader reader = new SequenceReader(filenames[i], false); SequenceReader reader = new SequenceReader(filenames[i], false);
ProcessSequence(reader); ProcessSequence(reader);
// Before continuing to next video make sure the user did not stop the processing
if(!thread_running)
{
break;
}
} }
} }
@ -206,11 +212,10 @@ namespace OpenFaceOffline
{ {
if(!thread_running) if(!thread_running)
{ {
continue; break;
} }
double progress = reader.GetProgress(); double progress = reader.GetProgress();
bool detection_succeeding = clnf_model.DetectLandmarksInVideo(gray_frame, face_model_params); bool detection_succeeding = clnf_model.DetectLandmarksInVideo(gray_frame, face_model_params);
// The face analysis step (for AUs and eye gaze) // The face analysis step (for AUs and eye gaze)
@ -240,8 +245,8 @@ namespace OpenFaceOffline
processing_fps.AddFrame(); processing_fps.AddFrame();
} }
// Post-process the AU recordings, TODO // Post-process the AU recordings
//recorder.FinishRecording(clnf_model, face_analyser); face_analyser.PostProcessOutputFile(recorder.GetCSVFile());
EndMode(); EndMode();
@ -283,7 +288,7 @@ namespace OpenFaceOffline
{ {
if (!thread_running) if (!thread_running)
{ {
continue; break;
} }
// Setup recording // Setup recording
@ -337,7 +342,6 @@ namespace OpenFaceOffline
// TODO how to report errors from the reader here? exceptions? logging? Problem for future versions? // TODO how to report errors from the reader here? exceptions? logging? Problem for future versions?
} }
// TODO is this still needed?
EndMode(); EndMode();
} }
@ -700,6 +704,7 @@ namespace OpenFaceOffline
SequenceReader reader = new SequenceReader(directory, true); SequenceReader reader = new SequenceReader(directory, true);
processing_thread = new Thread(() => ProcessSequence(reader)); processing_thread = new Thread(() => ProcessSequence(reader));
processing_thread.Name = "Image sequence processing";
processing_thread.Start(); processing_thread.Start();
} }
@ -712,6 +717,7 @@ namespace OpenFaceOffline
var video_files = openMediaDialog(false); var video_files = openMediaDialog(false);
processing_thread = new Thread(() => ProcessSequences(video_files)); processing_thread = new Thread(() => ProcessSequences(video_files));
processing_thread.Name = "Video processing";
processing_thread.Start(); processing_thread.Start();
} }

View file

@ -142,6 +142,11 @@ namespace UtilitiesOF {
m_recorder->SetObservationGaze(gaze_direction0_cv, gaze_direction1_cv, gaze_angle_cv, landmarks_2D_cv, landmarks_3D_cv); m_recorder->SetObservationGaze(gaze_direction0_cv, gaze_direction1_cv, gaze_angle_cv, landmarks_2D_cv, landmarks_3D_cv);
} }
System::String^ GetCSVFile()
{
return gcnew System::String(m_recorder->GetCSVFile().c_str());
}
// Setting the observations // Setting the observations
void SetObservationPose(List<double>^ pose) void SetObservationPose(List<double>^ pose)
{ {

View file

@ -73,8 +73,6 @@ bool SequenceCapture::Open(std::vector<std::string>& arguments)
// Some default values // Some default values
std::string input_root = ""; std::string input_root = "";
fx = -1; fy = -1; cx = -1; cy = -1; fx = -1; fy = -1; cx = -1; cy = -1;
frame_num = 0;
time_stamp = 0;
std::string separator = std::string(1, boost::filesystem::path::preferred_separator); std::string separator = std::string(1, boost::filesystem::path::preferred_separator);
@ -204,6 +202,8 @@ bool SequenceCapture::OpenWebcam(int device, int image_width, int image_height,
INFO_STREAM("Attempting to read from webcam: " << device); INFO_STREAM("Attempting to read from webcam: " << device);
no_input_specified = false; no_input_specified = false;
frame_num = 0;
time_stamp = 0;
if (device < 0) if (device < 0)
{ {
@ -268,6 +268,8 @@ bool SequenceCapture::OpenVideoFile(std::string video_file, float fx, float fy,
INFO_STREAM("Attempting to read from file: " << video_file); INFO_STREAM("Attempting to read from file: " << video_file);
no_input_specified = false; no_input_specified = false;
frame_num = 0;
time_stamp = 0;
latest_frame = cv::Mat(); latest_frame = cv::Mat();
latest_gray_frame = cv::Mat(); latest_gray_frame = cv::Mat();
@ -310,6 +312,8 @@ bool SequenceCapture::OpenImageSequence(std::string directory, float fx, float f
INFO_STREAM("Attempting to read from directory: " << directory); INFO_STREAM("Attempting to read from directory: " << directory);
no_input_specified = false; no_input_specified = false;
frame_num = 0;
time_stamp = 0;
image_files.clear(); image_files.clear();
@ -443,6 +447,8 @@ double SequenceCapture::GetProgress()
} }
else else
{ {
//TODO test here
std::cout << frame_num << " " << vid_length << std::endl;
return (double)frame_num / (double)vid_length; return (double)frame_num / (double)vid_length;
} }
} }