Exemplo n.º 1
0
        public CameraAnalyzer(SurfaceView surfaceView)
        {
            cameraEventListener = new CameraEventsListener();
            cameraController    = new CameraController(surfaceView, cameraEventListener);

            InitTensorflowLineService();

            var outputInfo = new SKImageInfo(
                TensorflowLiteService.ModelInputSize,
                TensorflowLiteService.ModelInputSize,
                SKColorType.Rgba8888);

            inputScaled        = new SKBitmap(outputInfo);
            inputScaledRotated = new SKBitmap(outputInfo);

            colors     = inputScaledRotated.GetPixels();
            colorCount = TensorflowLiteService.ModelInputSize * TensorflowLiteService.ModelInputSize;

            stopwatch = new Stopwatch();

            cameraFPSCounter = new FPSCounter((x) => {
                Stats.CameraFps = x.fps;
                Stats.CameraMs  = x.ms;
            });

            processingFPSCounter = new FPSCounter((x) => {
                Stats.ProcessingFps = x.fps;
                Stats.ProcessingMs  = x.ms;
            });
        }
Exemplo n.º 2
0
 public CameraController(SurfaceView surfaceView, CameraEventsListener cameraEventListener)
 {
     this.context             = surfaceView.Context;
     this.holder              = surfaceView.Holder;
     this.surfaceView         = surfaceView;
     this.cameraEventListener = cameraEventListener;
 }