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





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






// 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();
// 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));
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 // Output
previousImage = preprocessed.clone(); previousImage = preprocessed.clone();
// Show Output Image // Show Output Image

Loading…
Cancel
Save