bk_video #4

Manually merged
kohlerba68671 merged 30 commits from bk_video into master 2023-06-02 15:51:57 +00:00
4 changed files with 32 additions and 3 deletions
Showing only changes of commit f9797f2dca - Show all commits

View File

@ -1,4 +1,4 @@
package com.example.ueberwachungssystem.VideoDetection;
package com.example.ueberwachungssystem;
import android.util.Log;

View File

@ -0,0 +1,30 @@
package com.example.ueberwachungssystem;
import android.content.Context;
import androidx.annotation.NonNull;
abstract public class Detector {
private OnDetectionListener listener;
public Detector(Context context) {};
public interface OnDetectionListener {
void onDetection(@NonNull DetectionReport detectionReport);
}
public void setOnDetectionListener(@NonNull OnDetectionListener listener) {
this.listener = listener;
}
private void reportViolation(String detectorID, String detectionType, float amplitude) {
if (listener != null) {
DetectionReport detectionReport = new DetectionReport(detectorID, detectionType, amplitude);
listener.onDetection(detectionReport);
} else {
throw new IllegalStateException("No listener set for violation reporting");
}
}
public abstract void startDetection();
public abstract void stopDetection();
}

View File

@ -9,14 +9,12 @@ import androidx.camera.core.ExperimentalGetImage;
import android.Manifest;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ToggleButton;
import com.example.ueberwachungssystem.VideoDetection.DetectionReport;
import com.example.ueberwachungssystem.VideoDetection.VideoDetector;
@ExperimentalGetImage

View File

@ -17,6 +17,7 @@ import androidx.camera.view.PreviewView;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.LifecycleOwner;
import com.example.ueberwachungssystem.DetectionReport;
import com.google.common.util.concurrent.ListenableFuture;
import java.nio.ByteBuffer;