Compare commits
2 Commits
7dee124378
...
5d31f0bb46
Author | SHA1 | Date | |
---|---|---|---|
5d31f0bb46 | |||
ea0e88ed89 |
@ -79,9 +79,11 @@ public class VideoDetector extends Detector {
|
|||||||
|
|
||||||
|
|
||||||
// Parameters
|
// Parameters
|
||||||
private static final float ALARM_THRESHOLD = 0.5f; // Percent of pixels changed
|
private static final float ALARM_THRESHOLD = 0f; // Percent of pixels changed
|
||||||
|
private static final float AREA_THRESHOLD = 10f;
|
||||||
|
private static final int DILATE_ITERATIONS = 2;
|
||||||
private static final float START_DELAY = 20000; // milliseconds
|
private static final float START_DELAY = 20000; // milliseconds
|
||||||
private static final android.util.Size IMAGE_RES = new android.util.Size(480, 360);
|
private static final android.util.Size IMAGE_RES = new android.util.Size(640, 480);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -141,7 +143,6 @@ public class VideoDetector extends Detector {
|
|||||||
public void startRecording() {
|
public void startRecording() {
|
||||||
// Check States
|
// Check States
|
||||||
if (isRecording){
|
if (isRecording){
|
||||||
extendViolation();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Return On Request Permissions
|
// Return On Request Permissions
|
||||||
@ -237,7 +238,7 @@ public class VideoDetector extends Detector {
|
|||||||
// Violation Condition
|
// Violation Condition
|
||||||
if (percentChanged * 100 > ALARM_THRESHOLD) {
|
if (percentChanged * 100 > ALARM_THRESHOLD) {
|
||||||
if (allowReportViolation)
|
if (allowReportViolation)
|
||||||
reportViolation("Video", n);
|
reportViolation("Video", percentChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
imageProxy.close();
|
imageProxy.close();
|
||||||
@ -274,9 +275,11 @@ public class VideoDetector extends Detector {
|
|||||||
// Process Image
|
// Process Image
|
||||||
Mat processed = preprocessed.clone();
|
Mat processed = preprocessed.clone();
|
||||||
processed = OpenCVHelper.thresholdPixels(processed, previousImage, 25);
|
processed = OpenCVHelper.thresholdPixels(processed, previousImage, 25);
|
||||||
processed = OpenCVHelper.dilateBinaryMat(processed, new Size(3,3));
|
|
||||||
processed = OpenCVHelper.dilateBinaryMat(processed, new Size(3,3));
|
for(int i = 0; i < DILATE_ITERATIONS; i++)
|
||||||
processed = OpenCVHelper.thresholdContourArea(processed, 500);
|
processed = OpenCVHelper.dilateBinaryMat(processed, new Size(3,3));
|
||||||
|
|
||||||
|
processed = OpenCVHelper.thresholdContourArea(processed, AREA_THRESHOLD);
|
||||||
// Output
|
// Output
|
||||||
previousImage = preprocessed.clone();
|
previousImage = preprocessed.clone();
|
||||||
// Show Output Image
|
// Show Output Image
|
||||||
|
Loading…
x
Reference in New Issue
Block a user