Exemplo n.º 1
0
        private void setFrameSource(CameraFrameSource cameraFrameSource)
        {
            if (_frameSource == cameraFrameSource)
                return;

            _frameSource = cameraFrameSource;
        }
Exemplo n.º 2
0
        public async Task<List<Bitmap>> GetNBitMaps(int n)
        {
            this._frameSource = new CameraFrameSource(this.Camera);
            _frameSource.Camera.CaptureWidth = 640;
            _frameSource.Camera.CaptureHeight = 480;
            _frameSource.Camera.Fps = 50;
            this._frameSource.NewFrame += _frameSource_NewFrame;

            this._frameSource.StartFrameCapture();

            while (n > BitMaps.Count)
                System.Threading.Thread.Sleep(100);

            this._frameSource.NewFrame -= _frameSource_NewFrame;

            Camera.Dispose();

            return BitMaps;
        }
Exemplo n.º 3
0
        public static Camera GetActiveCamera()
        {
            foreach (Camera cam in CameraService.AvailableCameras)
            {
                var source = new CameraFrameSource(cam);
                source.Camera.CaptureWidth  = 640;
                source.Camera.CaptureHeight = 480;
                source.Camera.Fps           = 50;

                var captureSuccessful = source.StartFrameCapture();

                if (captureSuccessful)
                {
                    source.StopFrameCapture();
                }
                else
                {
                    return(cam);
                }
            }

            return(null);
        }
Exemplo n.º 4
0
        public void CameraHelper(Camera camera, int width, int height, int fps)
        {
            try
            {
                _frameSource = new CameraFrameSource(camera)
                {
                    Camera =
                    {
                        CaptureWidth = width,
                        CaptureHeight = height,
                        Fps = fps
                    }
                };
                _frameSource.NewFrame += OnImageCaptured;                
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }