This project is read-only.

A first chance exception of type 'System.AccessViolationException' occurred in GoblinXNA.dll

Apr 24, 2009 at 10:12 PM
Hey, I'm currently trying to find out where a marker is located.
I've defined an array - like the "ground" one - and need to discover where a marker is relativelly to that array.
 in Initialize I run the following code:

captureDevice = new DirectShowCapture();
captureDevice.InitVideoCapture(0, 0, FrameRate._30Hz, Resolution._640x480, false);          
scene.AddVideoCaptureDevice(captureDevice);           
tracker = new ARTagTracker();  
tracker.InitTracker(638.052f, 633.673f, captureDevice.Width,captureDevice.Height, false, "ARTag.cf");
scene.MarkerTracker = tracker;       
toolbarMarkerNode = new MarkerNode(scene.MarkerTracker, "toolbar0");           
scene.ShowCameraImage = true;           
scene.RootNode.AddChild(toolbarMarkerNode);

all variables are defined for the class.

in draw() i tried to run the code:

if (toolbarMarkerNode.MarkerFound)
            {
                tracker.ProcessImage(captureDevice);
               
            }
but I'm getting the exception:

A first chance exception of type 'System.AccessViolationException' occurred in GoblinXNA.dll
An unhandled exception of type 'System.AccessViolationException' occurred in GoblinXNA.dll

Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

The program '[6736] test.exe: Managed' has exited with code 0 (0x0).

in the line  ARTagDllBridge.artag_find_objects_wrapped(captureDevice.ImagePtr, rgb_greybar);
of ARTagTracker.cs

Does anyone have an idea of what is causing this exception??
Thanks,

Laetitia Mendes

Coordinator
Apr 26, 2009 at 6:02 PM
Hi Laetitia,

I've never encountered first chance exception. Maybe there is a problem with the XNA installation?

Regarding your code, you're not supposed to call tracker.ProcessImage(...) yourself. It's done automatically by the Scene class. You should take look at Tutorial8 to see how you should find the location of a marker.

Ohan
Apr 28, 2009 at 2:07 PM
Hi Ohan, thanks so much for yout time and patience.

Okay, then probably the problem is calling the function, without having to, and accessing some memory zone I shouldn't.
I've analyzed tut8, but probably not very well, cause I cant find a way to get the marker's position.

Is it with the geometry node ? Cause I don't need one, only a marker..

I now have 4 markers in the corners of a paper sheet, and need to find the relative position of a marker inside those four. What funciton can i use to find the pos of a marker wihtout having a geometry node associated.?

Thanks a lot!

Laetitia Mendes
Coordinator
Apr 29, 2009 at 6:33 PM
You don't need a GeometryNode to get the transformation of a marker. MarkerNode itself has WorldTransformation property, and that tells you the transformation of the marker array you associated with the MarkerNode.

Ohan
Apr 29, 2009 at 9:53 PM
Hi Ohan,

I've been studying tutorial8, but still can't see how to find the distance between 2 markers. The only think I've found is the collision detector, but what i really need is the distance.
I've defined, in ARTag.cf two arrays, one has the ground (4 markers in the corners), with the real coordinates, and other array which has other markers, which starts in 0,0,0.

I'm really sorry for the insistence, but i cant find a way to get the distance (or, by the way, the real position of a marker).

The world transformation gives me what? position relative to what point ? I also has rotation, translation, etc.. no ?
Coordinator
Apr 29, 2009 at 10:06 PM
The transformation of the marker array is relative to your camera's transformation (if your camera is at (0,0,0), then it's relative to (0,0,0) and the orientation of your camera). If you only need the distance between two marker arrays, then it's simply Vector3.Distance(MarkerNode1.WorldTransformation.Translation, MarkerNode2.WorldTransformation.Translation). There is no "real" position. It's always relative to your camera.

Ohan