Fix with reading multiple sequences and visualizing data in multi-face setting.

This commit is contained in:
Tadas Baltrusaitis 2017-11-22 17:37:26 +00:00
parent bafbfdca29
commit 41af428f5c
2 changed files with 11 additions and 5 deletions

View file

@ -106,6 +106,8 @@ int main (int argc, char **argv)
Utilities::FpsTracker fps_tracker;
fps_tracker.AddFrame();
int sequence_number = 0;
while (true) // this is not a for loop as we might also be reading from a webcam
{
@ -113,7 +115,7 @@ int main (int argc, char **argv)
if(!sequence_reader.Open(arguments))
{
// If failed to open because no input files specified, attempt to open a webcam
if (sequence_reader.no_input_specified)
if (sequence_reader.no_input_specified && sequence_number == 0)
{
// If that fails, revert to webcam
INFO_STREAM("No input specified, attempting to open a webcam 0");
@ -190,6 +192,8 @@ int main (int argc, char **argv)
// Reset the model, for the next video
face_model.Reset();
sequence_number++;
}
return 0;
}

View file

@ -152,6 +152,8 @@ int main (int argc, char **argv)
Utilities::FpsTracker fps_tracker;
fps_tracker.AddFrame();
int sequence_number = 0;
while(true) // this is not a for loop as we might also be reading from a webcam
{
@ -159,7 +161,7 @@ int main (int argc, char **argv)
if (!sequence_reader.Open(arguments))
{
// If failed to open because no input files specified, attempt to open a webcam
if (sequence_reader.no_input_specified)
if (sequence_reader.no_input_specified && sequence_number == 0)
{
// If that fails, revert to webcam
INFO_STREAM("No input specified, attempting to open a webcam 0");
@ -290,11 +292,11 @@ int main (int argc, char **argv)
{
visualizer.SetObservationLandmarks(face_models[model].detected_landmarks, face_models[model].detection_certainty, face_models[model].detection_success);
visualizer.SetObservationPose(LandmarkDetector::GetPose(face_models[model], sequence_reader.fx, sequence_reader.fy, sequence_reader.cx, sequence_reader.cy), face_models[model].detection_certainty);
visualizer.SetFps(fps_tracker.GetFPS());
visualizer.ShowObservation();
}
}
visualizer.SetFps(fps_tracker.GetFPS());
visualizer.ShowObservation();
// detect key presses
char character_press = cv::waitKey(1);