Exemplo n.º 1
0
 void DetectFingers(Canvas canvas)
 {
     BoundingRect[] drawRects = GetCameraDrawBoxes();
     fingersA    = DetectFingersFromImage(canvas, cameraA.GetCameraImage());
     fingersB    = DetectFingersFromImage(canvas, cameraB.GetCameraImage());
     fingerPairs = DetectFingerPairs();
     ComputeDetectionPoints();
 }
Exemplo n.º 2
0
        void UndistortCameraImages(Canvas canvas)
        {
            GraphicsDevice device = canvas.GetDevice();

            undistortShader.SetupShader(canvas);
            device.Textures[0] = cameraA.GetCameraImage();
            device.SetPixelShaderConstant(0, new Vector4((float)DistortParamsA[0],
                                                         (float)DistortParamsA[1], (float)DistortParamsA[2], (float)DistortParamsA[3]));
            device.SetPixelShaderConstant(1, new Vector4((float)CameraParamsA[0],
                                                         (float)CameraParamsA[1], (float)CameraParamsA[2], (float)CameraParamsA[3])
                                          / new Vector4(cameraA.Width, cameraA.Height, cameraA.Width, cameraA.Height));

            DepthStencilBuffer dsOld = device.DepthStencilBuffer;

            device.DepthStencilBuffer = canvas.GetDepthStencil();
            device.SetRenderTarget(0, renderTarget);
            CanvasPrimitives.Quad.Render(canvas);
            device.SetRenderTarget(0, null);
            device.DepthStencilBuffer = dsOld;

            cameraAImage = renderTarget.GetTexture();
        }