Browse Source

Adapted Parameters

bk_video
Bastian Kohler 1 year ago
parent
commit
5d31f0bb46

+ 10
- 6
app/src/main/java/com/example/ueberwachungssystem/Detection/VideoDetector.java View File

@@ -79,9 +79,11 @@ public class VideoDetector extends Detector {


// 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 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);



@@ -236,7 +238,7 @@ public class VideoDetector extends Detector {
// Violation Condition
if (percentChanged * 100 > ALARM_THRESHOLD) {
if (allowReportViolation)
reportViolation("Video", n);
reportViolation("Video", percentChanged);
}
}
imageProxy.close();
@@ -273,9 +275,11 @@ public class VideoDetector extends Detector {
// Process Image
Mat processed = preprocessed.clone();
processed = OpenCVHelper.thresholdPixels(processed, previousImage, 25);
processed = OpenCVHelper.dilateBinaryMat(processed, new Size(3,3));
processed = OpenCVHelper.dilateBinaryMat(processed, new Size(3,3));
processed = OpenCVHelper.thresholdContourArea(processed, 500);

for(int i = 0; i < DILATE_ITERATIONS; i++)
processed = OpenCVHelper.dilateBinaryMat(processed, new Size(3,3));

processed = OpenCVHelper.thresholdContourArea(processed, AREA_THRESHOLD);
// Output
previousImage = preprocessed.clone();
// Show Output Image

Loading…
Cancel
Save