AR with MOGRE

mira

31-07-2013 17:30:51

Hello, a beginner here.

So, I have a project to do with MOGRE, which includes Augmented Reality.
I have problems with getting input from the webcam, i.e. the real image from the camera to be the background. I found a thread about a webcam plugin, but I can't compile it somehow. And I read that ARTollkitPlus is used as well, but the library is in C++.

Does anyone have any idea what to do, where to look ?Is there any function in MOGRE that allows to have the camera image as background? Any help is appreciated.

Thanks!

smiley80

31-07-2013 18:13:09

Take a look at this thread:
viewtopic.php?f=8&t=12812

The webcam demo code is here:
http://code.google.com/p/mogresdk/sourc ... WebcamDemo

mira

02-08-2013 13:06:56

Hi, thanks for this instruction. I've been trying to put together the demo, but I get some errors... can you take a look at it?
http://sdrv.ms/1bROwXQ

mira

02-08-2013 13:14:44

Hi, thanks for the instructions. I tried to make the Demo work, but I get errors that cant seem to find the solution... Can you take a look at it ?

tafkag

05-08-2013 10:21:50

Hi mira,

can you post the errors you're getting?

mira

05-08-2013 12:52:31

Yeah.

I get the "namespace cannot be found" , 8 of them, for Mogre,Camera, Roor, SceneManager, Viewport, RenderWindow,FrameEvent, even though I've added Mogre to the references.

smiley80

05-08-2013 18:59:49

You have to convert the project to .Net 4.0.

mira

06-08-2013 14:18:24

Yep, that did it. THANKS

Troubles continue.
I get a file not found exception when I choose the camera. There are two listed in the console : 1. Sample video and 2. Logitech ... (my webcam). I choose the second by pressing '2', and this exception shows up. What kind of file? if it's for the first one, I never need to use the first one.
Here is a screen shot.

Beauty

09-08-2013 06:27:00

Are there errors listed in the file ogre.log?
Do you have the needed Ogre depencies in your binary output directory?
Ogre.dll, plugin dll files, both Ogre config files.
Additionally check the content of the config files. (paths, comments)

Did you try to run any other Mogre application?
For example the tutorial stuff?

mira

09-08-2013 12:58:30

Yeah, as for Ogre dll-s everything is fine.
I did, i can run them.

Beauty

26-10-2013 13:28:30

You can use the useful tool Process Monitor to find out the name of the missing file(s).
Run it and create a filter to see only file not found problems. (Otherwise you will be killed by all logged information).
Then try to build your Mogre application and see, what's needed.

Alex92

04-04-2014 17:03:51

I ran this example, but I need to modify it to change the background in real time.

In Webcam.cs file I replaced following code


using (MaterialPtr mat = MaterialManager.Singleton.Create("vidmat", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME))
{
mat.GetTechnique(0).CreatePass().CreateTextureUnitState(tex.Name);
Entity e = this.sceneMgr.CreateEntity("ogrehead", "ogrehead.mesh");
//e.SetMaterial(mat);
this.sceneMgr.RootSceneNode.CreateChildSceneNode().AttachObject(e);
}


on this code

using (MaterialPtr mat = MaterialManager.Singleton.Create("Background", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME))
{
mat.GetTechnique(0).CreatePass().CreateTextureUnitState(tex.Name);
mat.GetTechnique(0).GetPass(0).DepthCheckEnabled = false;
mat.GetTechnique(0).GetPass(0).DepthWriteEnabled = false;
mat.GetTechnique(0).GetPass(0).LightingEnabled = false;

// Create background rectangle covering the whole screen
Rectangle2D rect = new Rectangle2D(true);
rect.SetCorners(0.0f, 0.0f, 0.0f, 0.0f);
rect.SetMaterial(mat.Name);

// Render the background before everything else
rect.RenderQueueGroup = (byte)RenderQueueGroupID.RENDER_QUEUE_BACKGROUND;

// Use infinite AAB to always stay visible
AxisAlignedBox aab = new AxisAlignedBox();
aab.SetInfinite();
rect.BoundingBox = aab;

this.sceneMgr.RootSceneNode.CreateChildSceneNode().AttachObject(rect);
}


It doesn't work. Background still white. Please tell me what is wrong.