-
Notifications
You must be signed in to change notification settings - Fork 58
/
Real-time_Object_Detection_and_Tracking.java
78 lines (70 loc) · 2.44 KB
/
Real-time_Object_Detection_and_Tracking.java
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Size;
import org.opencv.core.Scalar;
import org.opencv.core.CvType;
import org.opencv.core.MatOfPoint;
import org.opencv.core.MatOfPoint2f;
import org.opencv.core.Rect;
import org.opencv.core.Point;
import org.opencv.core.CvType;
import org.opencv.core.MatOfByte;
import org.opencv.core.MatOfFloat;
import org.opencv.core.MatOfInt;
import org.opencv.core.MatOfInt4;
import org.opencv.core.CvType;
import org.opencv.core.Size;
import org.opencv.core.Core.MinMaxLocResult;
import org.opencv.core.TermCriteria;
import org.opencv.core.Core.MinMaxLocResult;
import org.opencv.core.Core.MinMaxLocResult;
import org.opencv.core.CvType;
import org.opencv.core.CvType;
import org.opencv.core.Core.MinMaxLocResult;
import org.opencv.core.CvType;
import org.opencv.core.CvType;
import org.opencv.core.CvType;
import org.opencv.core.Core.MinMaxLocResult;
import org.opencv.core.Core.MinMaxLocResult;
import org.opencv.core.Core.MinMaxLocResult;
import org.opencv.core.Core.MinMaxLocResult;
import org.opencv.core.Core.MinMaxLocResult;
import org.opencv.core.CvType;
import org.opencv.core.Core.MinMaxLocResult;
import org.opencv.core.CvType;
import org.opencv.core.Core.MinMaxLocResult;
import org.opencv.core.Core.MinMaxLocResult;
import org.opencv.core.Core.MinMaxLocResult;
import org.opencv.core.MatOfRect;
import org.opencv.core.MatOfFloat6;
import org.opencv.core.MatOfDouble;
import org.opencv.core.MatOfPoint3;
import org.opencv.core.MatOfPoint3f;
import org.opencv.core.MatOfPoint3f;
import org.opencv.core.MatOfPoint2f;
import org.opencv.core.MatOfPoint2f;
import org.opencv.videoio.VideoCapture;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.videoio.VideoWriter;
public class Main {
public static void main(String[] args) {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
int frameWidth = 640;
int frameHeight = 480;
VideoCapture cap = new VideoCapture(0);
cap.set(Videoio.CAP_PROP_FRAME_WIDTH, frameWidth);
cap.set(Videoio.CAP_PROP_FRAME_HEIGHT, frameHeight);
Mat img = new Mat();
while (true) {
cap.read(img);
// Perform image processing operations
Imgcodecs.imwrite("result.jpg", img);
HighGui.imshow("Result", img);
if (HighGui.waitKey(1) & 0xFF == 'q') {
break;
}
}
cap.release();
HighGui.destroyAllWindows();
}
}