-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
54 lines (38 loc) · 1021 Bytes
/
main.cpp
File metadata and controls
54 lines (38 loc) · 1021 Bytes
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "houghCirclesContrast/houghCirclesContrast.hpp"
int main(int argc, char *argv[]){
cout << "rodou" << endl;
// Create a VideoCapture object and open the input file
// If the input is the web camera, pass 0 instead of the video file name
VideoCapture cap(argv[1]);
// Check if camera opened successfully
if(!cap.isOpened()){
cout << "Error opening video stream or file" << endl;
return -1;
}
Mat frame;
Point p;
while(1){
// Captures a frame
cap >> frame;
cap >> frame;
cap >> frame;
cap >> frame;
cap >> frame;
houghCirclesContrast hough;
p = hough.run(frame);
if(p.x != -1){
Point center(p.x, p.y);
// circle center
circle( frame, center, 3, Scalar(0,0,255), -1, 8, 0 );
}
imshow("frame", frame);
char c=(char)waitKey(0);
// If the frame is empty or esc, break immediately
if (frame.empty() || c == 27)
break;
}
cap.release();
// Closes all the frames
destroyAllWindows();
return 0;
}