Exemplo n.º 1
0
        void InitializeCameras(Canvas canvas)
        {
            camerasInitialized = true;
            cameraA            = new CameraDevice(canvas, 0, 640, 480, 24);
            cameraA.Play();
            SetupCameraParameters(cameraA);
            cameraB = new CameraDevice(canvas, 1, 640, 480, 24);
            cameraB.Play();
            SetupCameraParameters(cameraB);
            GraphicsDevice device = canvas.GetDevice();
            int            width  = device.PresentationParameters.BackBufferWidth / 2;
            int            height = device.PresentationParameters.BackBufferHeight;

            renderLayerA = new RenderLayer(canvas, width, height);
            renderLayerB = new RenderLayer(canvas, width, height);
        }
Exemplo n.º 2
0
        void SetupCameraParameters(CameraDevice camera)
        {
            int curr;
            int max;
            int min;
            int def;

            DirectShowLib.CameraControlFlags flag;

            camera.Camera.GetRange(DirectShowLib.CameraControlProperty.Exposure, out min, out max, out curr, out def, out flag);
            camera.Camera.Set(DirectShowLib.CameraControlProperty.Exposure, min + curr * 2, DirectShowLib.CameraControlFlags.Manual);

            camera.Camera.GetRange(DirectShowLib.CameraControlProperty.Focus, out min, out max, out curr, out def, out flag);
            camera.Camera.Set(DirectShowLib.CameraControlProperty.Focus, min, DirectShowLib.CameraControlFlags.Manual);

            DirectShowLib.VideoProcAmpFlags vidFlag;
            camera.Video.GetRange(DirectShowLib.VideoProcAmpProperty.WhiteBalance, out min, out max, out curr, out def, out vidFlag);
            camera.Video.Set(DirectShowLib.VideoProcAmpProperty.WhiteBalance, min, DirectShowLib.VideoProcAmpFlags.Manual);
        }
        void SetupCameraParameters(CameraDevice camera)
        {
            int curr;
            int max;
            int min;
            int def;
            DirectShowLib.CameraControlFlags flag;

            camera.Camera.GetRange(DirectShowLib.CameraControlProperty.Exposure, out min, out max, out curr, out def, out flag);
            camera.Camera.Set(DirectShowLib.CameraControlProperty.Exposure, min+curr*2, DirectShowLib.CameraControlFlags.Manual);

            camera.Camera.GetRange(DirectShowLib.CameraControlProperty.Focus, out min, out max, out curr, out def, out flag);
            camera.Camera.Set(DirectShowLib.CameraControlProperty.Focus, min, DirectShowLib.CameraControlFlags.Manual);

            DirectShowLib.VideoProcAmpFlags vidFlag;
            camera.Video.GetRange(DirectShowLib.VideoProcAmpProperty.WhiteBalance, out min, out max, out curr, out def, out vidFlag);
            camera.Video.Set(DirectShowLib.VideoProcAmpProperty.WhiteBalance, min, DirectShowLib.VideoProcAmpFlags.Manual);
        }
 void InitializeCameras(Canvas canvas)
 {
     camerasInitialized = true;
     cameraA = new CameraDevice(canvas, 0, 640, 480, 24);
     cameraA.Play();
     SetupCameraParameters(cameraA);
     cameraB = new CameraDevice(canvas, 1, 640, 480, 24);
     cameraB.Play();
     SetupCameraParameters(cameraB);
     GraphicsDevice device = canvas.GetDevice();
     int width = device.PresentationParameters.BackBufferWidth/2;
     int height = device.PresentationParameters.BackBufferHeight;
     renderLayerA = new RenderLayer(canvas, width, height);
     renderLayerB = new RenderLayer(canvas, width, height);
 }