-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
34 lines (26 loc) · 940 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "Stag2.h"
#include "opencv2/opencv.hpp"
int main() {
cv::Mat image;
cv::VideoCapture cap(2);//Declaring an object to capture stream of frames from default camera
if (!cap.isOpened()){ //This section prompt an error message if no video stream is found
std::cout << "No video stream detected" << std::endl;
system("pause");
return-1;
}
while (true){ //Taking an everlasting loop to show the video
Stag2 stag2(11, 7, true);
cap >> image;
if (image.empty()){ //Breaking the loop if no video frame is detected
break;
}
stag2.detectMarkers(image);
stag2.logResults(image,"markers", false);
char c = (char)cv::waitKey(1);//Allowing 1 milliseconds frame processing time and initiating break condition
if (c == 27){ //If 'Esc' is entered break the loop
break;
}
}
cap.release();//Releasing the buffer memory
return 0;
}