private void canvas_Loaded(object sender, RoutedEventArgs e)
        {
            texInterop = new TextureGraphInterop();

            // Set window bounds in dips
            texInterop.WindowBounds = new Windows.Foundation.Size(
                (float)canvas.ActualWidth,
                (float)canvas.ActualHeight
                );

            // Set native resolution in pixels
            texInterop.NativeResolution = new Windows.Foundation.Size(
                (float)Math.Floor(canvas.ActualWidth * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f),
                (float)Math.Floor(canvas.ActualHeight * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f)
                );

            // Set render resolution to the full native resolution
            texInterop.RenderResolution = texInterop.NativeResolution;

            // Hook-up native component to DrawingSurface
            canvas.SetContentProvider(texInterop.CreateContentProvider());
            canvas.SetManipulationHandler(texInterop);

            var previewSize = new Windows.Foundation.Size(800, 448);

            cam = new Camera(previewSize, CameraSensorLocation.Back);
            im = new ImageProcessing(detector);

            // When we have an input frame, call ImageProcessing::processFrame
            cam.OnFrameReady += im.processFrame;

            // When we have processed a frame, output it to the textureInterop
            im.frameProcessed += texInterop.setTexturePtr;
        }
Exemple #2
0
        // Just like last time with the LineGraph, we need to hook up our TextureGraph
        private void videoCanvas_Loaded(object sender, RoutedEventArgs e)
        {
            texGraph = new TextureGraphInterop();

            // Set window bounds in dips
            texGraph.WindowBounds = new Windows.Foundation.Size(
                (float)videoCanvas.ActualWidth,
                (float)videoCanvas.ActualHeight
                );

            // Set native resolution in pixels
            texGraph.NativeResolution = new Windows.Foundation.Size(
                (float)Math.Floor(videoCanvas.ActualWidth * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f),
                (float)Math.Floor(videoCanvas.ActualHeight * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f)
                );

            // Set render resolution to the full native resolution
            texGraph.RenderResolution = texGraph.NativeResolution;

            // Hook-up native component to DrawingSurface
            videoCanvas.SetContentProvider(texGraph.CreateContentProvider());
            videoCanvas.SetManipulationHandler(texGraph);

            // Set the capture size of libvideo
            Windows.Foundation.Size captureSize = new Windows.Foundation.Size(1280, 720);

            // Construct libvideo's Camera object
            cam = new Camera(captureSize, CameraSensorLocation.Back);

            // When we have an input frame, call TextureGraphInterop::setTexturePtr
            cam.OnFrameReady += texGraph.setTexturePtr;
        }
        // Just like last time with the LineGraph, we need to hook up our TextureGraph
        private void videoCanvas_Loaded(object sender, RoutedEventArgs e)
        {
            texGraph = new TextureGraphInterop();

            // Set window bounds in dips
            texGraph.WindowBounds = new Windows.Foundation.Size(
                (float)videoCanvas.ActualWidth,
                (float)videoCanvas.ActualHeight
                );

            // Set native resolution in pixels
            texGraph.NativeResolution = new Windows.Foundation.Size(
                (float)Math.Floor(videoCanvas.ActualWidth * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f),
                (float)Math.Floor(videoCanvas.ActualHeight * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f)
                );

            // Set render resolution to the full native resolution
            texGraph.RenderResolution = texGraph.NativeResolution;

            // Hook-up native component to DrawingSurface
            videoCanvas.SetContentProvider(texGraph.CreateContentProvider());
            videoCanvas.SetManipulationHandler(texGraph);

            // Set the capture size of libvideo
            Windows.Foundation.Size captureSize = new Windows.Foundation.Size(1280, 720);

            // Construct libvideo's Camera object
            cam = new Camera(captureSize, CameraSensorLocation.Back);

            // When we have an input frame, call TextureGraphInterop::setTexturePtr
            cam.OnFrameReady += texGraph.setTexturePtr;
        }
        private void canvas_Loaded(object sender, RoutedEventArgs e)
        {
            texInterop = new TextureGraphInterop();

            // Set window bounds in dips
            texInterop.WindowBounds = new Windows.Foundation.Size(
                (float)canvas.ActualWidth,
                (float)canvas.ActualHeight
                );

            // Set native resolution in pixels
            texInterop.NativeResolution = new Windows.Foundation.Size(
                (float)Math.Floor(canvas.ActualWidth * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f),
                (float)Math.Floor(canvas.ActualHeight * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f)
                );

            // Set render resolution to the full native resolution
            texInterop.RenderResolution = texInterop.NativeResolution;

            // Hook-up native component to DrawingSurface
            canvas.SetContentProvider(texInterop.CreateContentProvider());
            canvas.SetManipulationHandler(texInterop);
        }