-
Notifications
You must be signed in to change notification settings - Fork 0
/
humancounting.cpp
42 lines (33 loc) · 998 Bytes
/
humancounting.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
35
36
37
38
39
40
41
42
#include "cv.hpp" //여기에 필요한 거 다 있음
#include "opencv2/opencv.hpp" //이렇게만 하면 다 뜬다 다 뜬다
using namespace std;
using namespace cv;
int main(){
Mat background, diff;
Mat diff2;
Mat src;
VideoCapture capture("C:\\Users\\Administrator\\Desktop\\Study\\4학년\\공프기\\OpenCV\\background.mp4");
int key;
int count = 6;
int frame_rate = 30;
Mat kernel = getStructuringElement(0, Size(5, 5));
Scalar from(200, 200, 200);
Scalar to(255, 255, 255);
capture >> src;
capture >> background;
while (capture.read(src)){
//inRange(src, from, to, background);
diff2 = src - background;
Canny(diff2, diff2, 50, 100, 3);
morphologyEx(diff2, diff2, MORPH_CLOSE, kernel);
//imshow("Backgrouond", background);
//imshow("SCREEN", diff);
// imshow("Origin", src);
imshow("diff", diff2);
imshow("background", background);
//imshow("background", background);
key = waitKey(frame_rate);
if (key == 27)
break;
}
}