Skip to content
Snippets Groups Projects
Commit 214161d8 authored by johni's avatar johni
Browse files

fixed conflicts

parents b331b2a8 60272eda
No related branches found
No related tags found
1 merge request!4Saving features
//This is our project //This is our project
//Change made by Jon
#include <iostream> #include <iostream>
#include <string> #include <string>
...@@ -38,7 +37,13 @@ int main() { ...@@ -38,7 +37,13 @@ int main() {
return 1; return 1;
} }
imshow("Webcam", frame); //show some test text
Mat frame_with_text = frame.clone();
putText(frame_with_text, "Press Spacebar to take a picture", Point2f(110,100), FONT_HERSHEY_SIMPLEX, 2.0, Scalar(255,0,0,0), 3);
putText(frame_with_text, "Press ESC to close the application", Point2f(90,600), FONT_HERSHEY_SIMPLEX, 2.0, Scalar(0,0,255,255), 3);
imshow("Webcam", frame_with_text);
key = waitKey(30); key = waitKey(30);
if (key == 27) { //escape key pressed: stop program if (key == 27) { //escape key pressed: stop program
...@@ -46,15 +51,20 @@ int main() { ...@@ -46,15 +51,20 @@ int main() {
break; break;
} }
else if (key == ' ') { //spacebar pressed: take a picture else if (key == ' ') { //spacebar pressed: take a picture
picture = frame; picture = frame;
key = -1; key = -1;
while (true) { while (true) {
imshow("Webcam", picture); Mat picture_with_text = picture.clone();
putText(picture_with_text, "Press 's' to save", Point2f(375,100), FONT_HERSHEY_SIMPLEX, 2.0, Scalar(255,0,0,0), 3);
putText(picture_with_text, "Press ESC/Spacebar to return", Point2f(160,600), FONT_HERSHEY_SIMPLEX, 2.0, Scalar(0,0,255,255), 3);
imshow("Webcam", picture_with_text);
key = waitKey(30); key = waitKey(30);
if (key == 27 || key == 32) { if (key == 27 || key == 32) { //spacebar or ESC pressed
cout << "ESC or SPACE pressed. Returning to video..." << endl; cout << "ESC or SPACE pressed. Returning to video..." << endl;
break; break;
} else if (key == 115) { } else if (key == 115) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment