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

features

parent 3906ed43
No related branches found
No related tags found
1 merge request!4Saving features
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
//Change made by Jon //Change made by Jon
#include <iostream> #include <iostream>
#include <string>
#include "opencv2/imgproc/imgproc.hpp" #include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp" #include "opencv2/highgui/highgui.hpp"
...@@ -27,6 +28,7 @@ int main() { ...@@ -27,6 +28,7 @@ int main() {
namedWindow("Webcam", CV_WINDOW_AUTOSIZE); namedWindow("Webcam", CV_WINDOW_AUTOSIZE);
while(true) { while(true) {
Mat frame; Mat frame;
videoCapture.retrieve(frame); videoCapture.retrieve(frame);
...@@ -56,8 +58,18 @@ int main() { ...@@ -56,8 +58,18 @@ int main() {
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) {
bool maybe = imwrite("./testimage.jpg", picture); string name;
cout << "s was pressed. saving image " << maybe << endl; string directory = "./images/";
cout << "Please select a name for the image." << endl;
getline(cin, name);
directory.append(name);
directory.append(".jpg");
Point org;
org.x = 15;
org.y = 100;
putText(picture, name, org, FONT_HERSHEY_SIMPLEX, 2, Scalar(0, 0, 255), 3, 8);
bool maybe = imwrite(directory, picture);
cout << "s was pressed. saving image, success: " << maybe << endl;
} }
} }
} }
......
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