├── .gitignore
├── README.md
├── build.xml
├── dist
├── JavaOpenCV.jar
├── README.TXT
└── lib
│ └── opencv-246.jar
├── doc
└── images
│ └── java_motion_detection.png
├── figs
└── 320x240.gif
├── lib
└── opencv-246.jar
├── manifest.mf
├── nbproject
├── build-impl.xml
├── genfiles.properties
├── private
│ ├── config.properties
│ ├── private.properties
│ └── private.xml
├── project.properties
└── project.xml
├── opencv_java246.dll
├── opencv_java246.x64.dll
├── opencv_java246.x86.dll
├── run.bat
├── run_console.bat
└── src
└── javaopencv
├── ImagePanel.java
├── Main.java
├── MainFrame.form
└── MainFrame.java
/.gitignore:
--------------------------------------------------------------------------------
1 | tmp/
2 | build/
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Motion Detection with Java + OpenCV + Webcam
2 | ============================================
3 |
4 | Last page update: **30/04/2015**
5 |
6 | Last version: **1.0.0** (see Release Notes for more info)
7 |
8 | Netbeans Project
9 |
10 |

11 |
12 | Release Notes:
13 | --------------
14 | * Version 1.0.0:
15 | First version.
16 |
--------------------------------------------------------------------------------
/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Builds, tests, and runs the project JavaOpenCV.
12 |
13 |
73 |
74 |
--------------------------------------------------------------------------------
/dist/JavaOpenCV.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrewssobral/java_motion_detection/74b4644da46c0bb8b78d936ffd622a90a970794e/dist/JavaOpenCV.jar
--------------------------------------------------------------------------------
/dist/README.TXT:
--------------------------------------------------------------------------------
1 | ========================
2 | BUILD OUTPUT DESCRIPTION
3 | ========================
4 |
5 | When you build an Java application project that has a main class, the IDE
6 | automatically copies all of the JAR
7 | files on the projects classpath to your projects dist/lib folder. The IDE
8 | also adds each of the JAR files to the Class-Path element in the application
9 | JAR files manifest file (MANIFEST.MF).
10 |
11 | To run the project from the command line, go to the dist folder and
12 | type the following:
13 |
14 | java -jar "JavaOpenCV.jar"
15 |
16 | To distribute this project, zip up the dist folder (including the lib folder)
17 | and distribute the ZIP file.
18 |
19 | Notes:
20 |
21 | * If two JAR files on the project classpath have the same name, only the first
22 | JAR file is copied to the lib folder.
23 | * Only JAR files are copied to the lib folder.
24 | If the classpath contains other types of files or folders, these files (folders)
25 | are not copied.
26 | * If a library on the projects classpath also has a Class-Path element
27 | specified in the manifest,the content of the Class-Path element has to be on
28 | the projects runtime path.
29 | * To set a main class in a standard Java project, right-click the project node
30 | in the Projects window and choose Properties. Then click Run and enter the
31 | class name in the Main Class field. Alternatively, you can manually type the
32 | class name in the manifest Main-Class element.
33 |
--------------------------------------------------------------------------------
/dist/lib/opencv-246.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrewssobral/java_motion_detection/74b4644da46c0bb8b78d936ffd622a90a970794e/dist/lib/opencv-246.jar
--------------------------------------------------------------------------------
/doc/images/java_motion_detection.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrewssobral/java_motion_detection/74b4644da46c0bb8b78d936ffd622a90a970794e/doc/images/java_motion_detection.png
--------------------------------------------------------------------------------
/figs/320x240.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrewssobral/java_motion_detection/74b4644da46c0bb8b78d936ffd622a90a970794e/figs/320x240.gif
--------------------------------------------------------------------------------
/lib/opencv-246.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrewssobral/java_motion_detection/74b4644da46c0bb8b78d936ffd622a90a970794e/lib/opencv-246.jar
--------------------------------------------------------------------------------
/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/nbproject/build-impl.xml:
--------------------------------------------------------------------------------
1 |
2 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
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 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 | Must set src.dir
225 | Must set build.dir
226 | Must set dist.dir
227 | Must set build.classes.dir
228 | Must set dist.javadoc.dir
229 | Must set build.test.classes.dir
230 | Must set build.test.results.dir
231 | Must set build.classes.excludes
232 | Must set dist.jar
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 | Must set javac.includes
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 | No tests executed.
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 | Must set JVM to use for profiling in profiler.info.jvm
703 | Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
704 |
705 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 |
719 |
720 |
721 |
722 |
723 |
724 |
725 |
726 |
727 |
728 |
729 |
730 |
731 |
732 |
733 |
734 |
735 |
736 |
737 |
738 |
739 |
740 |
741 |
742 |
743 |
744 |
745 |
746 |
747 |
748 |
749 |
750 |
751 |
752 |
753 |
754 |
755 |
756 |
757 |
758 |
759 |
760 |
761 |
762 |
763 |
764 |
765 |
766 |
767 |
768 |
769 |
770 |
771 |
772 |
773 |
774 |
775 |
776 |
777 |
778 |
779 |
780 |
781 |
782 |
783 |
784 |
785 |
786 |
787 |
788 |
789 |
790 |
791 |
792 |
793 |
794 |
795 |
796 |
797 |
798 |
799 |
800 |
801 |
802 |
803 |
804 |
805 |
806 |
807 |
808 |
809 |
810 |
811 |
812 |
813 |
814 |
815 |
816 |
817 |
818 |
819 |
820 |
821 |
822 |
823 |
824 |
825 |
826 |
827 |
828 |
829 |
830 |
831 |
832 |
833 |
834 |
835 |
836 |
837 |
838 |
839 |
840 |
841 |
842 |
843 |
844 |
845 |
846 |
847 |
848 |
849 |
850 |
851 |
852 |
853 |
854 |
855 |
856 |
857 |
858 |
859 |
860 |
861 |
862 |
863 |
864 |
865 |
866 |
871 |
872 |
873 |
874 |
875 |
876 |
877 |
878 |
879 |
880 |
881 |
882 |
883 |
884 |
885 |
886 |
887 |
888 |
889 |
890 |
891 |
892 |
893 |
894 |
895 |
896 |
897 |
898 |
899 |
900 |
901 |
902 |
903 |
904 |
905 |
906 |
907 |
908 |
909 |
910 |
911 |
912 |
913 |
914 |
915 |
916 |
917 |
918 |
919 |
920 |
921 |
922 |
923 |
924 |
925 |
926 |
927 |
928 |
929 |
930 |
931 | Must select some files in the IDE or set javac.includes
932 |
933 |
934 |
935 |
936 |
937 |
938 |
939 |
940 |
945 |
946 |
947 |
948 |
949 |
950 |
951 |
952 |
953 |
954 |
955 |
956 |
957 |
958 |
959 |
960 |
961 |
962 |
963 |
964 |
965 |
966 |
967 |
968 |
969 |
970 |
971 |
972 |
973 |
974 |
975 |
976 |
977 |
978 |
979 |
980 |
981 | To run this application from the command line without Ant, try:
982 |
983 | java -jar "${dist.jar.resolved}"
984 |
985 |
986 |
987 |
988 |
989 |
990 |
991 |
992 |
993 |
994 |
995 |
996 |
997 |
998 |
999 |
1000 |
1001 |
1002 |
1003 |
1004 |
1005 |
1006 |
1007 |
1008 |
1009 |
1010 |
1011 |
1012 |
1013 |
1014 |
1019 |
1020 |
1021 |
1022 |
1023 |
1024 |
1025 |
1026 |
1027 |
1028 |
1029 |
1030 | Must select one file in the IDE or set run.class
1031 |
1032 |
1033 |
1034 | Must select one file in the IDE or set run.class
1035 |
1036 |
1037 |
1042 |
1043 |
1044 |
1045 |
1046 |
1047 |
1048 |
1049 |
1050 |
1051 |
1052 |
1053 |
1054 |
1055 |
1056 |
1057 |
1058 |
1059 |
1060 |
1061 | Must select one file in the IDE or set debug.class
1062 |
1063 |
1064 |
1065 |
1066 | Must select one file in the IDE or set debug.class
1067 |
1068 |
1069 |
1070 |
1071 | Must set fix.includes
1072 |
1073 |
1074 |
1075 |
1076 |
1077 |
1078 |
1083 |
1086 |
1087 | This target only works when run from inside the NetBeans IDE.
1088 |
1089 |
1090 |
1091 |
1092 |
1093 |
1094 |
1095 |
1096 | Must select one file in the IDE or set profile.class
1097 | This target only works when run from inside the NetBeans IDE.
1098 |
1099 |
1100 |
1101 |
1102 |
1103 |
1104 |
1105 |
1106 | This target only works when run from inside the NetBeans IDE.
1107 |
1108 |
1109 |
1110 |
1111 |
1112 |
1113 |
1114 |
1115 |
1116 |
1117 |
1118 |
1119 | This target only works when run from inside the NetBeans IDE.
1120 |
1121 |
1122 |
1123 |
1124 |
1125 |
1126 |
1127 |
1128 |
1129 |
1130 |
1131 |
1132 |
1133 |
1134 |
1135 |
1136 |
1137 |
1138 |
1139 |
1140 |
1141 |
1144 |
1145 |
1146 |
1147 |
1148 |
1149 |
1150 |
1151 |
1152 |
1153 |
1154 |
1155 |
1156 |
1157 | Must select one file in the IDE or set run.class
1158 |
1159 |
1160 |
1161 |
1162 |
1163 | Must select some files in the IDE or set test.includes
1164 |
1165 |
1166 |
1167 |
1168 | Must select one file in the IDE or set run.class
1169 |
1170 |
1171 |
1172 |
1173 | Must select one file in the IDE or set applet.url
1174 |
1175 |
1176 |
1177 |
1182 |
1183 |
1184 |
1185 |
1186 |
1187 |
1188 |
1189 |
1190 |
1191 |
1192 |
1193 |
1194 |
1195 |
1196 |
1197 |
1198 |
1199 |
1200 |
1201 |
1202 |
1203 |
1204 |
1205 |
1206 |
1207 |
1208 |
1209 |
1210 |
1211 |
1212 |
1213 |
1214 |
1215 |
1216 |
1217 |
1218 |
1219 |
1220 |
1221 |
1226 |
1227 |
1228 |
1229 |
1230 |
1231 |
1232 |
1233 |
1234 |
1235 |
1236 |
1237 |
1238 |
1239 |
1240 |
1241 |
1242 |
1243 |
1244 |
1245 |
1246 |
1247 |
1248 |
1249 |
1250 | Must select some files in the IDE or set javac.includes
1251 |
1252 |
1253 |
1254 |
1255 |
1256 |
1257 |
1258 |
1259 |
1260 |
1265 |
1266 |
1267 |
1268 |
1269 |
1270 |
1271 |
1272 | Some tests failed; see details above.
1273 |
1274 |
1275 |
1276 |
1277 |
1278 |
1279 |
1280 |
1281 | Must select some files in the IDE or set test.includes
1282 |
1283 |
1284 |
1285 | Some tests failed; see details above.
1286 |
1287 |
1288 |
1289 | Must select some files in the IDE or set test.class
1290 | Must select some method in the IDE or set test.method
1291 |
1292 |
1293 |
1294 | Some tests failed; see details above.
1295 |
1296 |
1297 |
1302 |
1303 | Must select one file in the IDE or set test.class
1304 |
1305 |
1306 |
1307 | Must select one file in the IDE or set test.class
1308 | Must select some method in the IDE or set test.method
1309 |
1310 |
1311 |
1312 |
1313 |
1314 |
1315 |
1316 |
1317 |
1318 |
1319 |
1320 |
1325 |
1326 | Must select one file in the IDE or set applet.url
1327 |
1328 |
1329 |
1330 |
1331 |
1332 |
1333 |
1338 |
1339 | Must select one file in the IDE or set applet.url
1340 |
1341 |
1342 |
1343 |
1344 |
1345 |
1346 |
1347 |
1352 |
1353 |
1354 |
1355 |
1356 |
1357 |
1358 |
1359 |
1360 |
1361 |
1362 |
1363 |
1364 |
1365 |
1366 |
1367 |
1368 |
1369 |
1370 |
1371 |
1372 |
1373 |
1374 |
1375 |
1376 |
1377 |
1378 |
1379 |
1380 |
1381 |
1382 |
1383 |
1384 |
1385 |
1386 |
1387 |
1388 |
1389 |
1390 |
1391 |
1392 |
1393 |
1394 |
1395 |
1396 |
1397 |
--------------------------------------------------------------------------------
/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=504fb424
2 | build.xml.script.CRC32=4aae3325
3 | build.xml.stylesheet.CRC32=8064a381@1.75.2.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=504fb424
7 | nbproject/build-impl.xml.script.CRC32=b25d6496
8 | nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48
9 |
--------------------------------------------------------------------------------
/nbproject/private/config.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrewssobral/java_motion_detection/74b4644da46c0bb8b78d936ffd622a90a970794e/nbproject/private/config.properties
--------------------------------------------------------------------------------
/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | do.depend=false
3 | do.jar=true
4 | javac.debug=true
5 | javadoc.preview=true
6 | user.properties.file=C:\\Users\\asobra01\\AppData\\Roaming\\NetBeans\\8.0.2\\build.properties
7 |
--------------------------------------------------------------------------------
/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/E:/java_opencv_webcam/src/javaopencv/Main.java
7 | file:/E:/java_opencv_webcam/src/javaopencv/ImagePanel.java
8 | file:/E:/java_opencv_webcam/src/javaopencv/MainFrame.java
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processors.list=
4 | annotation.processing.run.all.processors=true
5 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
6 | application.title=JavaOpenCV
7 | application.vendor=Andrews
8 | build.classes.dir=${build.dir}/classes
9 | build.classes.excludes=**/*.java,**/*.form
10 | # This directory is removed when the project is cleaned:
11 | build.dir=build
12 | build.generated.dir=${build.dir}/generated
13 | build.generated.sources.dir=${build.dir}/generated-sources
14 | # Only compile against the classpath explicitly listed here:
15 | build.sysclasspath=ignore
16 | build.test.classes.dir=${build.dir}/test/classes
17 | build.test.results.dir=${build.dir}/test/results
18 | # Uncomment to specify the preferred debugger connection transport:
19 | #debug.transport=dt_socket
20 | debug.classpath=\
21 | ${run.classpath}
22 | debug.test.classpath=\
23 | ${run.test.classpath}
24 | # This directory is removed when the project is cleaned:
25 | dist.dir=dist
26 | dist.jar=${dist.dir}/JavaOpenCV.jar
27 | dist.javadoc.dir=${dist.dir}/javadoc
28 | endorsed.classpath=
29 | excludes=
30 | file.reference.opencv-246.jar=lib/opencv-246.jar
31 | includes=**
32 | jar.archive.disabled=${jnlp.enabled}
33 | jar.compress=false
34 | jar.index=${jnlp.enabled}
35 | javac.classpath=\
36 | ${file.reference.opencv-246.jar}
37 | # Space-separated list of extra javac options
38 | javac.compilerargs=
39 | javac.deprecation=false
40 | javac.processorpath=\
41 | ${javac.classpath}
42 | javac.source=1.7
43 | javac.target=1.7
44 | javac.test.classpath=\
45 | ${javac.classpath}:\
46 | ${build.classes.dir}
47 | javac.test.processorpath=\
48 | ${javac.test.classpath}
49 | javadoc.additionalparam=
50 | javadoc.author=false
51 | javadoc.encoding=${source.encoding}
52 | javadoc.noindex=false
53 | javadoc.nonavbar=false
54 | javadoc.notree=false
55 | javadoc.private=false
56 | javadoc.splitindex=true
57 | javadoc.use=true
58 | javadoc.version=false
59 | javadoc.windowtitle=
60 | jnlp.codebase.type=no.codebase
61 | jnlp.descriptor=application
62 | jnlp.enabled=false
63 | jnlp.mixed.code=default
64 | jnlp.offline-allowed=false
65 | jnlp.signed=false
66 | jnlp.signing=
67 | jnlp.signing.alias=
68 | jnlp.signing.keystore=
69 | main.class=javaopencv.MainFrame
70 | manifest.file=manifest.mf
71 | meta.inf.dir=${src.dir}/META-INF
72 | mkdist.disabled=false
73 | platform.active=default_platform
74 | run.classpath=\
75 | ${javac.classpath}:\
76 | ${build.classes.dir}
77 | # Space-separated list of JVM arguments used when running the project.
78 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
79 | # To set system properties for unit tests define test-sys-prop.name=value:
80 | run.jvmargs=
81 | run.test.classpath=\
82 | ${javac.test.classpath}:\
83 | ${build.test.classes.dir}
84 | source.encoding=UTF-8
85 | src.dir=src
86 |
--------------------------------------------------------------------------------
/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | JavaOpenCV
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/opencv_java246.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrewssobral/java_motion_detection/74b4644da46c0bb8b78d936ffd622a90a970794e/opencv_java246.dll
--------------------------------------------------------------------------------
/opencv_java246.x64.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrewssobral/java_motion_detection/74b4644da46c0bb8b78d936ffd622a90a970794e/opencv_java246.x64.dll
--------------------------------------------------------------------------------
/opencv_java246.x86.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrewssobral/java_motion_detection/74b4644da46c0bb8b78d936ffd622a90a970794e/opencv_java246.x86.dll
--------------------------------------------------------------------------------
/run.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | if %PROCESSOR_ARCHITECTURE%==x86 (
4 | copy /Y opencv_java246.x86.dll opencv_java246.dll
5 | ) else (
6 | copy /Y opencv_java246.x64.dll opencv_java246.dll
7 | )
8 |
9 | @start javaw -jar dist/JavaOpenCV.jar
--------------------------------------------------------------------------------
/run_console.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | if %PROCESSOR_ARCHITECTURE%==x86 (
4 | copy /Y opencv_java246.x86.dll opencv_java246.dll
5 | ) else (
6 | copy /Y opencv_java246.x64.dll opencv_java246.dll
7 | )
8 |
9 | java -jar dist/JavaOpenCV.jar
10 | ::pause
--------------------------------------------------------------------------------
/src/javaopencv/ImagePanel.java:
--------------------------------------------------------------------------------
1 | package javaopencv;
2 |
3 | import java.awt.Color;
4 | import java.awt.Dimension;
5 | import java.awt.Graphics;
6 | import java.awt.Image;
7 | import javax.swing.BorderFactory;
8 | import javax.swing.ImageIcon;
9 | import javax.swing.JPanel;
10 |
11 | class ImagePanel extends JPanel
12 | {
13 | private Image img;
14 |
15 | public ImagePanel(String img)
16 | {
17 | this(new ImageIcon(img).getImage());
18 | }
19 |
20 | public ImagePanel(Image img)
21 | {
22 | this.img = img;
23 | Dimension size = new Dimension(img.getWidth(null), img.getHeight(null));
24 | setPreferredSize(size);
25 | setMinimumSize(size);
26 | setMaximumSize(size);
27 | setSize(size);
28 | setLayout(null);
29 | setBorder(BorderFactory.createLineBorder(Color.black));
30 | }
31 |
32 | public void updateImage(Image img)
33 | {
34 | this.img = img;
35 | validate();
36 | repaint();
37 | }
38 |
39 | @Override
40 | public void paintComponent(Graphics g)
41 | {
42 | g.drawImage(img, 0, 0, null);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/javaopencv/Main.java:
--------------------------------------------------------------------------------
1 | package javaopencv;
2 |
3 | import java.awt.BorderLayout;
4 | import java.awt.event.ActionEvent;
5 | import java.awt.event.ActionListener;
6 | import java.awt.image.BufferedImage;
7 | import java.io.ByteArrayInputStream;
8 | import java.io.InputStream;
9 | import javax.imageio.ImageIO;
10 | import javax.swing.ImageIcon;
11 | import javax.swing.JButton;
12 | import javax.swing.JFrame;
13 | import org.opencv.core.Core;
14 | import org.opencv.core.CvType;
15 | import org.opencv.core.Mat;
16 | import org.opencv.core.MatOfByte;
17 | import org.opencv.highgui.Highgui;
18 | import org.opencv.highgui.VideoCapture;
19 | import org.opencv.imgproc.Imgproc;
20 |
21 | public final class Main
22 | {
23 | static { System.loadLibrary(Core.NATIVE_LIBRARY_NAME); }
24 |
25 | private JFrame window;
26 | private JButton startButton, stopButton;
27 | private ImagePanel image;
28 |
29 | public Main()
30 | {
31 | buildGUI();
32 | }
33 |
34 | private void buildGUI()
35 | {
36 | window = new JFrame("Test Webcam Panel");
37 |
38 | startButton = new JButton("Start");
39 | stopButton = new JButton("Stop");
40 |
41 | window.add(startButton, BorderLayout.WEST);
42 | window.add(stopButton, BorderLayout.EAST);
43 |
44 | image = new ImagePanel(new ImageIcon("figs/320x240.gif").getImage());
45 | window.add(image, BorderLayout.CENTER);
46 |
47 | window.setSize(449, 268); //window.pack();
48 | window.setLocationRelativeTo(null);
49 | window.setVisible(true);
50 | window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
51 | window.setResizable(false);
52 |
53 | startButton.addActionListener(new ActionListener(){
54 | @Override
55 | public void actionPerformed(ActionEvent e){
56 | start();
57 | }
58 | });
59 |
60 | stopButton.addActionListener(new ActionListener(){
61 | @Override
62 | public void actionPerformed(ActionEvent e){
63 | stop();
64 | }
65 | });
66 | }
67 |
68 | private Boolean begin = false;
69 | private VideoCapture video = null;
70 | private CaptureThread thread = null;
71 |
72 | private void start()
73 | {
74 | System.out.println("You clicked the start button!");
75 |
76 | if(begin == false)
77 | {
78 | video = new VideoCapture(0);
79 |
80 | if(video.isOpened())
81 | {
82 | thread = new CaptureThread();
83 | thread.start();
84 | begin = true;
85 | }
86 | }
87 | }
88 |
89 | private MatOfByte matOfByte = new MatOfByte();
90 | private BufferedImage bufImage = null;
91 | private InputStream in;
92 | private Mat frameaux = new Mat();
93 | private Mat frame = new Mat(240,320,CvType.CV_8UC3);
94 |
95 | class CaptureThread extends Thread
96 | {
97 | @Override
98 | public void run()
99 | {
100 | if(video.isOpened())
101 | {
102 | while(begin == true)
103 | {
104 | //video.read(frameaux);
105 | video.retrieve(frameaux);
106 | Imgproc.resize(frameaux, frame, frame.size());
107 |
108 | Highgui.imencode(".jpg", frame, matOfByte);
109 | byte[] byteArray = matOfByte.toArray();
110 |
111 | try
112 | {
113 | in = new ByteArrayInputStream(byteArray);
114 | bufImage = ImageIO.read(in);
115 | }
116 | catch(Exception ex)
117 | {
118 | ex.printStackTrace();
119 | }
120 |
121 | //image.updateImage(new ImageIcon("figs/lena.png").getImage());
122 | image.updateImage(bufImage);
123 |
124 | try{ Thread.sleep(5); } catch(Exception ex){}
125 | }
126 | }
127 | }
128 | }
129 |
130 | private void stop()
131 | {
132 | System.out.println("You clicked the stop button!");
133 | begin = false;
134 | try{ Thread.sleep(1000); } catch(Exception ex){}
135 | video.release();
136 | }
137 |
138 | public static void main(String[] args)
139 | {
140 | new Main();
141 | }
142 | }
143 |
--------------------------------------------------------------------------------
/src/javaopencv/MainFrame.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
223 |
--------------------------------------------------------------------------------
/src/javaopencv/MainFrame.java:
--------------------------------------------------------------------------------
1 | package javaopencv;
2 |
3 | import java.awt.BorderLayout;
4 | import java.awt.image.BufferedImage;
5 | import java.io.ByteArrayInputStream;
6 | import java.io.File;
7 | import java.io.InputStream;
8 | import java.nio.file.Paths;
9 | import java.text.SimpleDateFormat;
10 | import java.util.ArrayList;
11 | import java.util.Date;
12 | import java.util.Iterator;
13 | import java.util.List;
14 | import javax.imageio.ImageIO;
15 | import javax.swing.ImageIcon;
16 | import org.opencv.core.Core;
17 | import org.opencv.core.CvType;
18 | import org.opencv.core.Mat;
19 | import org.opencv.core.MatOfByte;
20 | import org.opencv.core.MatOfPoint;
21 | import org.opencv.core.Point;
22 | import org.opencv.core.Rect;
23 | import org.opencv.core.Scalar;
24 | import org.opencv.core.Size;
25 | import org.opencv.highgui.Highgui;
26 | import org.opencv.highgui.VideoCapture;
27 | import org.opencv.imgproc.Imgproc;
28 | import org.opencv.video.BackgroundSubtractorMOG;
29 |
30 | public class MainFrame extends javax.swing.JFrame
31 | {
32 | static
33 | {
34 | System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
35 | }
36 |
37 | private Boolean begin = false;
38 | private Boolean firstFrame = true;
39 | private VideoCapture video = null;
40 | private CaptureThread thread = null;
41 | private MatOfByte matOfByte = new MatOfByte();
42 | private BufferedImage bufImage = null;
43 | private InputStream in;
44 | private Mat frameaux = new Mat();
45 | private Mat frame = new Mat(240, 320, CvType.CV_8UC3);
46 | private Mat lastFrame = new Mat(240, 320, CvType.CV_8UC3);
47 | private Mat currentFrame = new Mat(240, 320, CvType.CV_8UC3);
48 | private Mat processedFrame = new Mat(240, 320, CvType.CV_8UC3);
49 | private ImagePanel image;
50 | private BackgroundSubtractorMOG bsMOG = new BackgroundSubtractorMOG();
51 | private int savedelay = 0;
52 | String currentDir = "";
53 | String detectionsDir = "detections";
54 |
55 | public MainFrame()
56 | {
57 | initComponents();
58 | image = new ImagePanel(new ImageIcon("figs/320x240.gif").getImage());
59 | jPanelSource1.add(image, BorderLayout.CENTER);
60 |
61 | currentDir = Paths.get(".").toAbsolutePath().normalize().toString();
62 | detectionsDir = currentDir + File.separator + detectionsDir;
63 | // new java.io.File( "." ).getCanonicalPath();
64 | //System.out.println("Current dir: " + currentDir);
65 | //System.out.println("Detections dir: " + detectionsDir);
66 | jTextFieldSaveLocation.setText(detectionsDir);
67 | }
68 |
69 | private void start()
70 | {
71 | //System.out.println("You clicked the start button!");
72 |
73 | if(!begin)
74 | {
75 | int sourcen = Integer.parseInt(jTextFieldSource1.getText());
76 | System.out.println("Opening source: " + sourcen);
77 |
78 | video = new VideoCapture(sourcen);
79 |
80 | if(video.isOpened())
81 | {
82 | thread = new CaptureThread();
83 | thread.start();
84 | begin = true;
85 | firstFrame = true;
86 | }
87 | }
88 | }
89 |
90 | private void stop()
91 | {
92 | //System.out.println("You clicked the stop button!");
93 |
94 | if(begin)
95 | {
96 | try
97 | {
98 | Thread.sleep(500);
99 | }
100 | catch(Exception ex)
101 | {
102 | }
103 | video.release();
104 | begin = false;
105 | }
106 | }
107 |
108 | public static String getCurrentTimeStamp()
109 | {
110 | SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");//dd/MM/yyyy
111 | Date now = new Date();
112 | String strDate = sdfDate.format(now);
113 | return strDate;
114 | }
115 |
116 | public ArrayList detection_contours(Mat frame, Mat outmat)
117 | {
118 | Mat v = new Mat();
119 | Mat vv = outmat.clone();
120 | List contours = new ArrayList();
121 | Imgproc.findContours(vv, contours, v, Imgproc.RETR_LIST, Imgproc.CHAIN_APPROX_SIMPLE);
122 |
123 | double maxArea = 100;
124 | int maxAreaIdx;
125 | Rect r;
126 | ArrayList rect_array = new ArrayList();
127 |
128 | for(int idx = 0; idx < contours.size(); idx++)
129 | {
130 | Mat contour = contours.get(idx);
131 | double contourarea = Imgproc.contourArea(contour);
132 | if(contourarea > maxArea)
133 | {
134 | // maxArea = contourarea;
135 | maxAreaIdx = idx;
136 | r = Imgproc.boundingRect(contours.get(maxAreaIdx));
137 | rect_array.add(r);
138 | Imgproc.drawContours(frame, contours, maxAreaIdx, new Scalar(0, 0, 255));
139 | }
140 | }
141 |
142 | v.release();
143 | return rect_array;
144 | }
145 |
146 | class CaptureThread extends Thread
147 | {
148 | @Override
149 | public void run()
150 | {
151 | if(video.isOpened())
152 | {
153 | while(begin == true)
154 | {
155 | //video.read(frameaux);
156 | video.retrieve(frameaux);
157 | Imgproc.resize(frameaux, frame, frame.size());
158 | frame.copyTo(currentFrame);
159 |
160 | if(firstFrame)
161 | {
162 | frame.copyTo(lastFrame);
163 | firstFrame = false;
164 | continue;
165 | }
166 |
167 | if(jCheckBoxMotionDetection.isSelected())
168 | {
169 | Imgproc.GaussianBlur(currentFrame, currentFrame, new Size(3, 3), 0);
170 | Imgproc.GaussianBlur(lastFrame, lastFrame, new Size(3, 3), 0);
171 |
172 | //bsMOG.apply(frame, processedFrame, 0.005);
173 | Core.subtract(currentFrame, lastFrame, processedFrame);
174 | //Core.absdiff(frame,lastFrame,processedFrame);
175 |
176 | Imgproc.cvtColor(processedFrame, processedFrame, Imgproc.COLOR_RGB2GRAY);
177 | //
178 |
179 | int threshold = jSliderThreshold.getValue();
180 | //Imgproc.adaptiveThreshold(processedFrame, processedFrame, 255, Imgproc.ADAPTIVE_THRESH_MEAN_C, Imgproc.THRESH_BINARY_INV, 5, 2);
181 | Imgproc.threshold(processedFrame, processedFrame, threshold, 255, Imgproc.THRESH_BINARY);
182 |
183 | ArrayList array = detection_contours(currentFrame, processedFrame);
184 | ///*
185 | if(array.size() > 0)
186 | {
187 | Iterator it2 = array.iterator();
188 | while(it2.hasNext())
189 | {
190 | Rect obj = it2.next();
191 | Core.rectangle(currentFrame, obj.br(), obj.tl(),
192 | new Scalar(0, 255, 0), 1);
193 | }
194 | }
195 | //*/
196 |
197 | if(jCheckBoxAlarm.isSelected())
198 | {
199 | double sensibility = jSliderSensibility.getValue();
200 | //System.out.println(sensibility);
201 | double nonZeroPixels = Core.countNonZero(processedFrame);
202 | //System.out.println("nonZeroPixels: " + nonZeroPixels);
203 |
204 | double nrows = processedFrame.rows();
205 | double ncols = processedFrame.cols();
206 | double total = nrows * ncols / 10;
207 |
208 | double detections = (nonZeroPixels / total) * 100;
209 | //System.out.println(detections);
210 | if(detections >= sensibility)
211 | {
212 | //System.out.println("ALARM ENABLED!");
213 | Core.putText(currentFrame, "MOTION DETECTED",
214 | new Point(5,currentFrame.cols()/2), //currentFrame.rows()/2 currentFrame.cols()/2
215 | Core.FONT_HERSHEY_TRIPLEX , new Double(1), new Scalar(0,0,255));
216 |
217 | if(jCheckBoxSave.isSelected())
218 | {
219 | if(savedelay == 2)
220 | {
221 | String filename = jTextFieldSaveLocation.getText() + File.separator + "capture_" + getCurrentTimeStamp() + ".jpg";
222 | System.out.println("Saving results in: " + filename);
223 | Highgui.imwrite(filename, processedFrame);
224 | savedelay = 0;
225 | }
226 | else
227 | savedelay = savedelay + 1;
228 | }
229 | }
230 | else
231 | {
232 | savedelay = 0;
233 | //System.out.println("");
234 | }
235 | }
236 | //currentFrame.copyTo(processedFrame);
237 | }
238 | else
239 | {
240 | //frame.copyTo(processedFrame);
241 | }
242 |
243 | currentFrame.copyTo(processedFrame);
244 |
245 | Highgui.imencode(".jpg", processedFrame, matOfByte);
246 | byte[] byteArray = matOfByte.toArray();
247 |
248 | try
249 | {
250 | in = new ByteArrayInputStream(byteArray);
251 | bufImage = ImageIO.read(in);
252 | }
253 | catch(Exception ex)
254 | {
255 | ex.printStackTrace();
256 | }
257 |
258 | //image.updateImage(new ImageIcon("figs/lena.png").getImage());
259 | image.updateImage(bufImage);
260 |
261 | frame.copyTo(lastFrame);
262 |
263 | try
264 | {
265 | Thread.sleep(1);
266 | }
267 | catch(Exception ex)
268 | {
269 | }
270 | }
271 | }
272 | }
273 | }
274 |
275 | /**
276 | * This method is called from within the constructor to initialize the form.
277 | * WARNING: Do NOT modify this code. The content of this method is always
278 | * regenerated by the Form Editor.
279 | */
280 | @SuppressWarnings("unchecked")
281 | // //GEN-BEGIN:initComponents
282 | private void initComponents()
283 | {
284 |
285 | jPanelSource1 = new javax.swing.JPanel();
286 | jLabelSource1 = new javax.swing.JLabel();
287 | jTextFieldSource1 = new javax.swing.JTextField();
288 | jButtonStart = new javax.swing.JButton();
289 | jButtonStop = new javax.swing.JButton();
290 | jCheckBoxMotionDetection = new javax.swing.JCheckBox();
291 | jSliderThreshold = new javax.swing.JSlider();
292 | jLabel1 = new javax.swing.JLabel();
293 | jLabel2 = new javax.swing.JLabel();
294 | jCheckBoxAlarm = new javax.swing.JCheckBox();
295 | jLabel3 = new javax.swing.JLabel();
296 | jSliderSensibility = new javax.swing.JSlider();
297 | jTextFieldSaveLocation = new javax.swing.JTextField();
298 | jCheckBoxSave = new javax.swing.JCheckBox();
299 |
300 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
301 | setTitle("Java OpenCV Webcam");
302 |
303 | jPanelSource1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
304 |
305 | javax.swing.GroupLayout jPanelSource1Layout = new javax.swing.GroupLayout(jPanelSource1);
306 | jPanelSource1.setLayout(jPanelSource1Layout);
307 | jPanelSource1Layout.setHorizontalGroup(
308 | jPanelSource1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
309 | .addGap(0, 318, Short.MAX_VALUE)
310 | );
311 | jPanelSource1Layout.setVerticalGroup(
312 | jPanelSource1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
313 | .addGap(0, 238, Short.MAX_VALUE)
314 | );
315 |
316 | jLabelSource1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
317 | jLabelSource1.setText("Source 1:");
318 |
319 | jTextFieldSource1.setText("0");
320 |
321 | jButtonStart.setText("Start");
322 | jButtonStart.addActionListener(new java.awt.event.ActionListener()
323 | {
324 | public void actionPerformed(java.awt.event.ActionEvent evt)
325 | {
326 | jButtonStartActionPerformed(evt);
327 | }
328 | });
329 |
330 | jButtonStop.setText("Stop");
331 | jButtonStop.addActionListener(new java.awt.event.ActionListener()
332 | {
333 | public void actionPerformed(java.awt.event.ActionEvent evt)
334 | {
335 | jButtonStopActionPerformed(evt);
336 | }
337 | });
338 |
339 | jCheckBoxMotionDetection.setText("Motion Detection");
340 |
341 | jSliderThreshold.setMaximum(255);
342 | jSliderThreshold.setPaintLabels(true);
343 | jSliderThreshold.setPaintTicks(true);
344 | jSliderThreshold.setValue(15);
345 |
346 | jLabel1.setText("Threshold:");
347 |
348 | jLabel2.setText("(zero for local webcamera)");
349 |
350 | jCheckBoxAlarm.setText("Alarm");
351 |
352 | jLabel3.setText("Sensibility:");
353 |
354 | jSliderSensibility.setMinimum(1);
355 | jSliderSensibility.setPaintLabels(true);
356 | jSliderSensibility.setPaintTicks(true);
357 | jSliderSensibility.setValue(10);
358 |
359 | jCheckBoxSave.setText("Save detections in:");
360 |
361 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
362 | getContentPane().setLayout(layout);
363 | layout.setHorizontalGroup(
364 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
365 | .addGroup(layout.createSequentialGroup()
366 | .addContainerGap()
367 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
368 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
369 | .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
370 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
371 | .addGroup(layout.createSequentialGroup()
372 | .addComponent(jCheckBoxMotionDetection)
373 | .addGap(18, 18, 18)
374 | .addComponent(jLabel1))
375 | .addGroup(layout.createSequentialGroup()
376 | .addComponent(jCheckBoxAlarm)
377 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
378 | .addComponent(jLabel3)))
379 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
380 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
381 | .addComponent(jSliderThreshold, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
382 | .addComponent(jSliderSensibility, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))
383 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
384 | .addComponent(jPanelSource1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
385 | .addGroup(layout.createSequentialGroup()
386 | .addComponent(jLabelSource1)
387 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
388 | .addComponent(jTextFieldSource1, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
389 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
390 | .addComponent(jLabel2)))
391 | .addGroup(layout.createSequentialGroup()
392 | .addComponent(jCheckBoxSave)
393 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
394 | .addComponent(jTextFieldSaveLocation, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE)))
395 | .addGroup(layout.createSequentialGroup()
396 | .addComponent(jButtonStart, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
397 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
398 | .addComponent(jButtonStop, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)))
399 | .addContainerGap(27, Short.MAX_VALUE))
400 | );
401 | layout.setVerticalGroup(
402 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
403 | .addGroup(layout.createSequentialGroup()
404 | .addContainerGap()
405 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
406 | .addComponent(jLabelSource1)
407 | .addComponent(jTextFieldSource1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
408 | .addComponent(jLabel2))
409 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
410 | .addComponent(jPanelSource1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
411 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
412 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
413 | .addComponent(jSliderThreshold, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
414 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
415 | .addComponent(jCheckBoxMotionDetection)
416 | .addComponent(jLabel1)))
417 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
418 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
419 | .addGroup(layout.createSequentialGroup()
420 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
421 | .addComponent(jSliderSensibility, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
422 | .addComponent(jLabel3))
423 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 6, Short.MAX_VALUE)
424 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
425 | .addComponent(jTextFieldSaveLocation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
426 | .addComponent(jCheckBoxSave))
427 | .addGap(18, 18, 18)
428 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
429 | .addComponent(jButtonStart)
430 | .addComponent(jButtonStop)))
431 | .addGroup(layout.createSequentialGroup()
432 | .addComponent(jCheckBoxAlarm)
433 | .addGap(0, 0, Short.MAX_VALUE)))
434 | .addContainerGap())
435 | );
436 |
437 | pack();
438 | }// //GEN-END:initComponents
439 |
440 | private void jButtonStartActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButtonStartActionPerformed
441 | {//GEN-HEADEREND:event_jButtonStartActionPerformed
442 | start();
443 | }//GEN-LAST:event_jButtonStartActionPerformed
444 |
445 | private void jButtonStopActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButtonStopActionPerformed
446 | {//GEN-HEADEREND:event_jButtonStopActionPerformed
447 | stop();
448 | }//GEN-LAST:event_jButtonStopActionPerformed
449 |
450 | public static void main(String args[])
451 | {
452 | /* Set the Nimbus look and feel */
453 | //
454 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
455 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
456 | */
457 | try
458 | {
459 | for(javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels())
460 | {
461 | if("Windows".equals(info.getName()))
462 | {
463 | javax.swing.UIManager.setLookAndFeel(info.getClassName());
464 | break;
465 | }
466 | }
467 | }
468 | catch(ClassNotFoundException ex)
469 | {
470 | java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
471 | }
472 | catch(InstantiationException ex)
473 | {
474 | java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
475 | }
476 | catch(IllegalAccessException ex)
477 | {
478 | java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
479 | }
480 | catch(javax.swing.UnsupportedLookAndFeelException ex)
481 | {
482 | java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
483 | }
484 | //
485 |
486 | /* Create and display the form */
487 | java.awt.EventQueue.invokeLater(new Runnable()
488 | {
489 | public void run()
490 | {
491 | MainFrame mainFrame = new MainFrame();
492 | mainFrame.setVisible(true);
493 | mainFrame.setLocationRelativeTo(null);
494 | }
495 | });
496 | }
497 |
498 | // Variables declaration - do not modify//GEN-BEGIN:variables
499 | private javax.swing.JButton jButtonStart;
500 | private javax.swing.JButton jButtonStop;
501 | private javax.swing.JCheckBox jCheckBoxAlarm;
502 | private javax.swing.JCheckBox jCheckBoxMotionDetection;
503 | private javax.swing.JCheckBox jCheckBoxSave;
504 | private javax.swing.JLabel jLabel1;
505 | private javax.swing.JLabel jLabel2;
506 | private javax.swing.JLabel jLabel3;
507 | private javax.swing.JLabel jLabelSource1;
508 | private javax.swing.JPanel jPanelSource1;
509 | private javax.swing.JSlider jSliderSensibility;
510 | private javax.swing.JSlider jSliderThreshold;
511 | private javax.swing.JTextField jTextFieldSaveLocation;
512 | private javax.swing.JTextField jTextFieldSource1;
513 | // End of variables declaration//GEN-END:variables
514 | }
515 |
--------------------------------------------------------------------------------