コード例 #1
0
        private void UserControlLoaded(object sender, RoutedEventArgs e)
        {
            // Initialize the webcam
            captureSource = new CaptureSource();
            captureSource.VideoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();

            // Desired format is 640 x 480 (good tracking results and performance)
            captureSource.VideoCaptureDevice.DesiredFormat = new VideoFormat(PixelFormatType.Unknown, 640, 480, 60);
            captureSource.CaptureImageCompleted           += CaptureSourceCaptureImageCompleted;

            // Fill the Viewport Rectangle with the VideoBrush
            var vidBrush = new VideoBrush();

            vidBrush.SetSource(captureSource);
            Viewport.Fill = vidBrush;

            //  Conctruct the Detector
            arDetector = new BitmapMarkerDetector {
                Threshold = 200, JitteringThreshold = 1
            };

            // Load the marker patterns. It has 16x16 segments and a width of 80 millimeters
            slarMarker = Marker.LoadFromResource("data/Marker_SLAR_16x16segments_80width.pat", 16, 16, 80);
            lMarker    = Marker.LoadFromResource("data/Marker_L_16x16segments_80width.pat", 16, 16, 80);
        }
コード例 #2
0
        private void InitializeDetector(int width, int height)
        {
            // Load App resources and init AR
            arDetector = new BitmapMarkerDetector();
            var marker = Marker.LoadFromResource("data/Marker_SLAR_16x16segments_80width.pat", 16, 16, 80.0);

            arDetector.Initialize(width, height, Game.Camera.Near, Game.Camera.Far, new List <Marker> {
                marker
            });
            //    Camera.CustomProjectionMatrix = arDetector.Projection.ToBalderMatrix();
        }
コード例 #3
0
        private void InitializeARDetector()
        {
            //  Initialize the Detector

            // Load the marker pattern. It has 16x16 segments and a width of 80 millimeters
            //creating a marker list
            markerList = new List <Marker>();
            for (int i = 0; i <= 2; i++)
            {
                Marker marker = new Marker();
                string url    = "Resources/Marker/marker" + i + ".pat";
                marker = Marker.LoadFromResource(url, 16, 16, 80);
                markerList.Add(marker);
            }
            // The perspective projection has the near plane at 1 and the far plane at 4000

            bmdList = new BitmapMarkerDetector();
            bmdList.Initialize(640, 480, 1, 4000, markerList);
        }
コード例 #4
0
        private void UserControlLoaded(object sender, RoutedEventArgs e)
        {
            // Initialize the webcam
            captureSource = new CaptureSource {
                VideoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice()
            };

            // Desired format is 640 x 480 (good tracking results and performance)
            captureSource.VideoCaptureDevice.DesiredFormat = new VideoFormat(PixelFormatType.Unknown, 640, 480, 60);
            captureSource.CaptureImageCompleted           += CaptureSourceCaptureImageCompleted;

            // Fill the Viewport Rectangle with the VideoBrush
            var vidBrush = new VideoBrush();

            vidBrush.SetSource(captureSource);
            Viewport.Fill = vidBrush;

            //  Conctruct the Detector
            arDetector = new BitmapMarkerDetector {
                Threshold = 200, JitteringThreshold = 1
            };

            // Load the marker patterns. It has 16x16 segments and a width of 80 millimeters
            slarMarker = Marker.LoadFromResource("data/Marker_SLAR_16x16segments_80width.pat", 16, 16, 80);

            // Capture or transform periodically
            CompositionTarget.Rendering += (s, e2) =>
            {
                if (captureSource.State == CaptureState.Started)
                {
                    captureSource.CaptureImageAsync();
                }
                else
                {
                    Game.SetWorldMatrix(Balder.Math.Matrix.Identity);
                }
                if (Game.ParticleSystem.Particles != null && Game.ParticleSystem.Particles.Count > 0)
                {
                }
            };
        }