Compare commits

..

No commits in common. "5d31f0bb465fba4b73da19e2b425ad6cdd7f24dc" and "7dee1243788342386191a1415b06e207fa4c9ba2" have entirely different histories.

View File

@ -79,11 +79,9 @@ public class VideoDetector extends Detector {
// Parameters // Parameters
private static final float ALARM_THRESHOLD = 0f; // Percent of pixels changed private static final float ALARM_THRESHOLD = 0.5f; // 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(640, 480); private static final android.util.Size IMAGE_RES = new android.util.Size(480, 360);
@ -143,6 +141,7 @@ 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
@ -238,7 +237,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", percentChanged); reportViolation("Video", n);
} }
} }
imageProxy.close(); imageProxy.close();
@ -275,11 +274,9 @@ 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);
for(int i = 0; i < DILATE_ITERATIONS; i++)
processed = OpenCVHelper.dilateBinaryMat(processed, new Size(3,3)); processed = OpenCVHelper.dilateBinaryMat(processed, new Size(3,3));
processed = OpenCVHelper.dilateBinaryMat(processed, new Size(3,3));
processed = OpenCVHelper.thresholdContourArea(processed, AREA_THRESHOLD); processed = OpenCVHelper.thresholdContourArea(processed, 500);
// Output // Output
previousImage = preprocessed.clone(); previousImage = preprocessed.clone();
// Show Output Image // Show Output Image