Finding tracker error

Apr 28, 2010 at 12:38 PM

Hello friends,

I have a problem with alvar and goblin xna.

see the following code

1-   if (markerNode.MarkerFound)
2-  {
3-          Console.WriteLine("Achou um marcador" );
4-          if (scene.MarkerTracker.FindMarker(0))
5-                    Console.WriteLine("Marcador 0"
6-   ); 
The line 1 found the marker, but the line 5 not execute because line 4 never return TRUE, the marker detected in line 1 is the marker with id 0.

 

the setupMarkerTracking code is :

            captureDevice = new DirectShowCapture();
       
            captureDevice.InitVideoCapture(0, FrameRate._30Hz, Resolution._640x480,
                ImageFormat.R8G8B8_24, false);
            scene.AddVideoCaptureDevice(captureDevice);
            tracker = null;
            
tracker = new ALVARMarkerTracker(); ((ALVARMarkerTracker)tracker).MaxMarkerError = 0.02f; tracker.InitTracker(captureDevice.Width, captureDevice.Height, "calib.xml", 9.0); scene.MarkerTracker = tracker; scene.ShowCameraImage = true; int[] ids = new int[4]; for (int i = 0; i < ids.Length; i++) ids[i] = i; markerNode= new MarkerNode(scene.MarkerTracker, "ALVARConfig.txt",ids);
scene.RootNode.AddChild(markerNode);

I'am from Brasil, so sorry my english.

 

Coordinator
Apr 30, 2010 at 12:31 AM

If you want to detect whether a single marker is in the image, then you need to first associate the ID with the marker tracker.

In your code, you're associating the 4 markers as a single multi-marker setting, so it won't tell you the individual marker.

If you want to detect ID 0, then you should insert the following line in your setup marker code:

scene.MarkerTracker.AssociateMarker(0);

Ohan



 

Apr 30, 2010 at 12:47 PM

Thanks, and congratulations your plataform is really great.