Skip to content
Snippets Groups Projects
Commit 3906ed43 authored by neig's avatar neig
Browse files

Merge branch 'save_image' into 'master'

Save image

The directory was the problem. Changed to "./name_of_pic" to denote current directory.

See merge request !2
parents 1a3a3a14 88b10014
Branches master
No related tags found
No related merge requests found
......@@ -42,23 +42,27 @@ int main() {
if (key == 27) { //escape key pressed: stop program
cout << "ESC pressed. Program closing..." << endl;
break;
} else if (key == ' ') { //spacebar pressed: take a picture
}
else if (key == ' ') { //spacebar pressed: take a picture
picture = frame;
key = -1;
while (true) {
imshow("Webcam", picture);
key = waitKey(30);
if (key == 27 || key == 32) {
cout << "ESC or SPACE pressed. Returning to video..." << endl;
break;
} else if (key == 115) {
bool maybe = imwrite("./testimage.jpg", picture);
cout << "s was pressed. saving image " << maybe << endl;
}
}
}
}
return 0;
}
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