Exemplo n.º 1
0
 public void StopCapture()
 {
     if (_cameraManager != null)
     {
         _cameraManager.CloseCamera();
         _cameraManager.StopBackgroundThread();
         _cameraManager = null;
     }
 }
Exemplo n.º 2
0
        public void StartCapture(EventHandler <Bitmap> matHandler, int preferredPreviewImageSize = -1)
        {
            if (_cameraManager == null)
            {
                if (preferredPreviewImageSize <= 0)
                {
                    //prefer preview image that is slightly smaller than the screen resolution
                    preferredPreviewImageSize = (int)Math.Round(MainLayout.Width * MainLayout.Width) / 2;
                    preferredPreviewImageSize = Math.Max(preferredPreviewImageSize, 480 * 600);
                }

                _cameraManager = new AndroidCameraManager(preferredPreviewImageSize);
                _cameraManager.OnImageCaptured += matHandler;
                _cameraManager.StartBackgroundThread();
            }
            _cameraManager.CreateCaptureSession();
        }