diff --git a/app/src/main/java/com/example/ueberwachungssystem/MainActivity.java b/app/src/main/java/com/example/ueberwachungssystem/MainActivity.java
index 1173b49..0c2b517 100644
--- a/app/src/main/java/com/example/ueberwachungssystem/MainActivity.java
+++ b/app/src/main/java/com/example/ueberwachungssystem/MainActivity.java
@@ -31,6 +31,7 @@ public class MainActivity extends AppCompatActivity {
TextView textView = findViewById(R.id.textView);
PreviewView previewView = findViewById(R.id.previewView);
+ getCameraAccess();
VideoDetector vd = new VideoDetector(this);
vd.setPreviewView(previewView);
@@ -38,27 +39,11 @@ public class MainActivity extends AppCompatActivity {
@Override
public void onDetection(@NonNull DetectionReport detectionReport) {
detectionReport.log("OnDetection");
- textView.setText(detectionReport.toString());
+ textView.setText("Alarm:\t[" + String.valueOf(detectionReport.detectedValue) + "]");
}
});
- //vd.startDetection();
+ vd.startDetection();
-
- ToggleButton toggleButton = findViewById(R.id.previewButton);
- toggleButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- getCameraAccess();
- if (isCameraAccessAllowed() && toggleButton.isChecked())
- {
- vd.startDetection();
- }
- else {
- vd.stopDetection();
- textView.setText("");
- }
- }
- });
}
private boolean isCameraAccessAllowed() {
diff --git a/app/src/main/java/com/example/ueberwachungssystem/VideoDetection/VideoDetector.java b/app/src/main/java/com/example/ueberwachungssystem/VideoDetection/VideoDetector.java
index babb677..2742a15 100644
--- a/app/src/main/java/com/example/ueberwachungssystem/VideoDetection/VideoDetector.java
+++ b/app/src/main/java/com/example/ueberwachungssystem/VideoDetection/VideoDetector.java
@@ -33,7 +33,7 @@ public class VideoDetector extends Detector {
private PreviewView previewView = null;
// Detect Violation
private static final float PIXEL_THRESHOLD = 30f; // Luminosity (brightness channel of YUV_420_888)
- private static final float ALARM_THRESHOLD = 1f; // Percent of pixels changed
+ private static final float ALARM_THRESHOLD = 0.5f; // Percent of pixels changed
private ByteBuffer previousBuffer = null;
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 275c453..84b8959 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -14,18 +14,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
- android:textSize="20dp"
+ android:textSize="30sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
-