How should I prevent camera image showing correctly?

May 2, 2010 at 7:41 AM

Hello.

I am trying to make an application which will show only a 3D model controlled by a marker. But I don't want to show an image from my webcam. How can I do this?

I just tried to  set Scene's ShowCameraImage property to false, but my app stopped with exception:

System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
Source="GoblinXNA"
StackTrace:
at GoblinXNA.Device.Capture.DirectShowCapture.GetImageTexture(Int32[] returnImage, IntPtr& imagePtr)
at GoblinXNA.SceneGraph.Scene.UpdateTrackerAndImage()
at GoblinXNA.SceneGraph.Scene.UpdateTracker()
at GoblinXNA.SceneGraph.Scene.Draw(GameTime gameTime)
at Microsoft.Xna.Framework.Game.Draw(GameTime gameTime)

 

Editor
May 2, 2010 at 5:58 PM
Edited May 2, 2010 at 5:59 PM

You can change this - 

bool useStaticImage = false;

- to true, and then change the name of the image used to a static image of your own making. Don't forget to make the static image the same size as your camera resolution.

Colin

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Editor
May 2, 2010 at 6:00 PM
dcoli wrote:

You can change this - 

bool useStaticImage = false;

- to true, and then change the name of the image used to a static image of your own making. Don't forget to make the static image the same size as your camera resolution.

Colin

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 Oops, I think the static image is already set to true, so you just need to change the name of the image.

Coordinator
May 2, 2010 at 10:07 PM

Hi,

Thanks for pointing this out. I just found out that I forgot one line of code:

Please add the following if condition right before Marsha.Copy(grabbededImage, ....) on line 253 in DirectShowCapture.cs:

if(returnedImage != null)

Then, recompile Goblin XNA.

This will fix the problem.

Ohan