Example #1
0
 public CameraController(CameraSurfaceView surfaceView, CameraEventsListener cameraEventListener)
 {
     this.context = surfaceView.Context;
     //this.holder = surfaceView.Holder;
     this.surfaceView         = surfaceView;
     this.cameraEventListener = cameraEventListener;
 }
Example #2
0
        public CameraAnalyzer(CameraSurfaceView surfaceView)
        {
            cameraController = new CameraController2();
            cameraController.Init(surfaceView);

            cameraController.mSurfaceTextureListener.OnPreviewFrameReady += HandleOnPreviewFrameReady;

            InitTensorflowLineService();

            var outputInfo = new SKImageInfo(
                TensorflowLiteService.ModelInputSize_PlateAndMoto,
                TensorflowLiteService.ModelInputSize_PlateAndMoto,
                SKColorType.Bgra8888);

            inputScaled_PlateAndMoto = new SKBitmap(outputInfo);

            colors_PlateAndMoto     = inputScaled_PlateAndMoto.GetPixels();
            colorCount_PlateAndMoto = TensorflowLiteService.ModelInputSize_PlateAndMoto * TensorflowLiteService.ModelInputSize_PlateAndMoto;

            var outputInfo2 = new SKImageInfo(
                TensorflowLiteService.ModelInputSize_MotoModel,
                TensorflowLiteService.ModelInputSize_MotoModel,
                SKColorType.Bgra8888);

            inputScaled_MotoModel = new SKBitmap(outputInfo2);

            colors_MotoModel     = inputScaled_MotoModel.GetPixels();
            colorCount_MotoModel = TensorflowLiteService.ModelInputSize_MotoModel * TensorflowLiteService.ModelInputSize_MotoModel;

            stopwatch = new Stopwatch();

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

            processingFPSCounter = new FPSCounter((x) =>
            {
                MainActivity.PlateAndMotoStats.ProcessingFps = x.fps;
                MainActivity.PlateAndMotoStats.ProcessingMs  = x.ms;
                MainActivity.MotoModelStats.ProcessingFps    = x.fps;
                MainActivity.MotoModelStats.ProcessingMs     = x.ms;
            });
        }