diff --git a/exe/FaceLandmarkVid/FaceLandmarkVid.cpp b/exe/FaceLandmarkVid/FaceLandmarkVid.cpp index 87e210b..3a1b75e 100644 --- a/exe/FaceLandmarkVid/FaceLandmarkVid.cpp +++ b/exe/FaceLandmarkVid/FaceLandmarkVid.cpp @@ -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; } diff --git a/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.cpp b/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.cpp index 484b677..f0409f8 100644 --- a/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.cpp +++ b/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.cpp @@ -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);