Need Help With camera issues

Jun 5, 2011 at 7:59 PM

Hi, i'm doing a project with the SLARToolKit and the ArcGIS API for Microsoft Silverlight, and i'm having a few issues with my camera.

When i point my webcan to the marker, the map starts to randomly jump on the screen. i dont know if i have to calibrate it somehow. The idea was to use the tag just to give some projection and maybe rotation on the map with the tags movement, but it didn't work well.

The other use to the tags would be control witch layers of the map would be shown, but i found another problem: the CaptureSourceMarkerDetector has the method MarkersDetected, that triggers when the marker is shown on the webcan. Is there any way to define what happens when the marker stops been detected?

void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            detectorDoMarcadorPadrao = new CaptureSourceMarkerDetector();
            detectorDoMarcadorEsquerda = new CaptureSourceMarkerDetector();
        
            // Get the list of available cameras , selects the MS Lifecan
            IEnumerable<VideoCaptureDevice> listaDeCameras = CaptureDeviceConfiguration.GetAvailableVideoCaptureDevices();
            
            foreach (VideoCaptureDevice cameraDaLista in listaDeCameras)
            {
                if (cameraDaLista.FriendlyName.Contains("Microsoft")) cameraSelecionada.VideoCaptureDevice = cameraDaLista;
            }

            Marker marcadorPadrao = new Marker();
            marcadorPadrao = Marker.LoadFromResource("Patterns/4x4_1.patt", 16, 16, 80);
            detectorDoMarcadorPadrao.Initialize(cameraSelecionada, 1, 10, marcadorPadrao);

            detectorDoMarcadorPadrao.MarkersDetected += (s, me) =>
            {
                Dispatcher.BeginInvoke(() =>
                {
                    var dr = me.DetectionResults;
                    if (dr.HasResults)
                    {
                        Mapa.Visibility = Visibility.Visible;
                        var centerAtOrigin = Matrix3DFactory.CreateTranslation(-Mapa.ActualHeight * 0.5, -Mapa.ActualWidth * 0.5, 0);
                        var scale = Matrix3DFactory.CreateScale(0.5, -0.5, 0.5);
                        var world = centerAtOrigin * scale * dr[0].Transformation;
                        var vp = Matrix3DFactory.CreateViewportTransformation(LayoutRoot.ActualWidth, LayoutRoot.ActualHeight);
                        var m = Matrix3DFactory.CreateViewportProjection(world, Matrix3D.Identity, detectorDoMarcadorPadrao.Projection, vp);
                        Mapa.Projection = new Matrix3DProjection { ProjectionMatrix = m };
                    }
                });
            };