[WIP] Webcam Plugin

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
ShadeOgre
Gremlin
Posts: 158
Joined: Mon Mar 10, 2008 10:55 pm
Location: Budapest, Hungary
x 1

Post by ShadeOgre »

OgreSDK/Samples/Common/include (if you compile the source manually), but I think, if you use the precompiled SDK it's in the same dir (but im not sure). Anyway, this is in one of the ogreSDK's subdir, so search for it ;)
User avatar
westpointer
Halfling
Posts: 62
Joined: Fri May 23, 2008 9:29 am

Post by westpointer »

what the webcam is used for?
I downloaded Demo_Bin_WebcamPlugin, but have no idea how to use it, or how to make it works.
outdoors
Gnoblar
Posts: 2
Joined: Wed Nov 12, 2008 2:33 pm

Post by outdoors »

hi,

i'm trying to compile the source code with ming+ codeblocks but i get this error:

undefined reference to _imp___ZN4Ogre16WebcamController30getWebcamTextureByMaterialNameERKSs'

Someone knows what is this?

Thank you!
crownin110
Gnoblar
Posts: 1
Joined: Fri Nov 14, 2008 3:10 pm

Missing Plugin_Webcam.lib

Post by crownin110 »

I've been attempting to use the webcam plugin for OGRE but I can't seem to find the Plugin_Webcam.lib. I tried compiling the source for the project in hopes that it would create the missing library, but I haven't been able to compile that because of an error I have been receiving. The error is located in the OgreExport ExternalTextureSourceManager.h line 51 and reads "error C2504: 'ResourceAlloc' : base class undefined. If anyone could either send me a link to the Plugin_Webcam.lib or maybe help me out with the error that would be really appreciated.
DrScorpion
Gnoblar
Posts: 1
Joined: Mon Jun 29, 2009 4:46 pm

Re: [WIP] Webcam Plugin

Post by DrScorpion »

Hi all,

I have compiled the plugin in VS2005 - so that it refers to header files from Mogre and loaded it in a Mogre project.

1. When I add the plugin in the plugins.cfg - and launch the application, it crashes. I assume perhaps it's due to some references that the Plugin_Webcam.dll is making. From the log I get the following

17:26:12: Loading library .\Plugin_Webcam
17:26:12: OGRE EXCEPTION(7:InternalErrorException): Could not load dynamic library .\Plugin_Webcam. System Error: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. in DynLib::load at ..\src\OgreDynLib.cpp (line 80)


2. Assuming that this is resolved, how would I access the classes defined in the plugin?

For example, WebCamController object is required.
ExternalTextureSourceManager.Singleton.SetCurrentPlugIn("webcam_video");
WebCamController webcamc = (WebCamController)ExternalTextureSourceManager.Singleton.CurrentPlugin;

Translated from Demo
ExternalTextureSourceManager::getSingleton().setCurrentPlugIn("webcam_video");
WebcamController* WebcamCtrl = (WebcamController*)ExternalTextureSourceManager::getSingleton().getCurrentPlugIn();

Thanks a lot ;-)
magichere
Gnoblar
Posts: 2
Joined: Wed Dec 03, 2008 2:40 am

Re: [WIP] Webcam Plugin

Post by magichere »

I found out that The webcam plugin dosen`t work with the latest OGRE 1.6.3 , It`s work 1.4.9 .
Incepcionizta
Gnoblar
Posts: 1
Joined: Fri Apr 16, 2010 5:45 am

Just switched to Ogre

Post by Incepcionizta »

Hi guys! :D Any updates on the plugin yet? Tnx! :D
Shago
Gnoblar
Posts: 2
Joined: Thu May 13, 2010 7:53 pm

Re: [WIP] Webcam Plugin

Post by Shago »

I managed to make it work on Visual Studio 2008 with Ogre 1.7.1, Open CV 2.1 and PTypes 2.1.1 without much hazzle.
Great plugin.
bwillers
Kobold
Posts: 37
Joined: Mon Oct 26, 2009 11:08 pm

Re: [WIP] Webcam Plugin

Post by bwillers »

I'm trying to get this to build on VStudio 2010 but I keep getting bizarre errors seemingly coming from the standard libraries:

Code: Select all

1>  Webcam.cpp
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\complex(42): error C2039: '_C_double_complex' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\complex(42): error C2146: syntax error : missing ';' before identifier '_Dcomplex_value'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\complex(42): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
...
Anyone have any ideas on how to fix this?

Thanks
Wolf
Kobold
Posts: 28
Joined: Fri Jan 14, 2005 3:16 pm
Location: Switzerland
Contact:

Re: [WIP] Webcam Plugin

Post by Wolf »

I know this post is pretty old but if that can help someone :

CV:: seems to be releated to some complexvalue class or functions as written in the error messages. To compile you need to remove all the CV:: of the solution and of course remove the namespace CV { } in Webcam.h (just keep the includes outside of any namespace).

Haven't tested the lib yet but at least it compiles without any error.
aldofk
Gnoblar
Posts: 4
Joined: Thu Nov 18, 2010 3:38 pm

Re: [WIP] Webcam Plugin

Post by aldofk »

hi,
I'm a new developer.
I have downloaded the WebcamPluginDemo and managed to make it compile and run (under Linux kubuntu lucid).
the problem is:
the image from the webcam is just a blurred, uniform color, however the color changes if you show something else to the camera.
the Ogre head is visible, and textured with the same uniform color coming from the webcam.
the webcam itself is perfectly working with other sw such as cheese or vlc.

did anyone experienced anything similar?
what could be the reason for this behaviour?
thanks
a.
User avatar
so0os
Bugbear
Posts: 833
Joined: Thu Apr 15, 2010 7:42 am
Location: Poznan, Poland
x 33

Re: [WIP] Webcam Plugin

Post by so0os »

aldofk wrote:hi,
I'm a new developer.
I have downloaded the WebcamPluginDemo and managed to make it compile and run (under Linux kubuntu lucid).
the problem is:
the image from the webcam is just a blurred, uniform color, however the color changes if you show something else to the camera.
the Ogre head is visible, and textured with the same uniform color coming from the webcam.
the webcam itself is perfectly working with other sw such as cheese or vlc.

did anyone experienced anything similar?
what could be the reason for this behaviour?
thanks
a.
Check your texture coords.
Sos Sosowski :)
http://www.sos.gd
aldofk
Gnoblar
Posts: 4
Joined: Thu Nov 18, 2010 3:38 pm

Re: [WIP] Webcam Plugin

Post by aldofk »

I will, thank you
aldofk
Gnoblar
Posts: 4
Joined: Thu Nov 18, 2010 3:38 pm

Re: [WIP] Webcam Plugin

Post by aldofk »

that was exactly what you suggested.
thank you a lot!
galomar
Gnoblar
Posts: 2
Joined: Wed Jan 19, 2011 11:16 am
Location: Spain

Re: [WIP] Webcam Plugin

Post by galomar »

Wolf wrote:I know this post is pretty old but if that can help someone :

CV:: seems to be releated to some complexvalue class or functions as written in the error messages. To compile you need to remove all the CV:: of the solution and of course remove the namespace CV { } in Webcam.h (just keep the includes outside of any namespace).

Haven't tested the lib yet but at least it compiles without any error.
Hi!

I've got that problem and I solved it with Wolf's method. Now I can generate the WebcamPlugin project. But when I try to generate the WebcamPluginDemo I've got more problems (with file Webcam.h from WebcamPlugin project (?) ).

First of all, it can't found the pasync.h file (from PTypes_DLL project). I change the correspondent #import adding the relative path and it's solved.

Then, I have problems with de OpenCV source files (cxtypes.h, cxcore.h, cxcore.hpp, cxoperations.hpp) with "ambiguous symbols". A lot of errors like this:
>c:\opencv2.1\include\opencv\cxtypes.h(178) : error C2872: 'int64' : símbolo ambiguo puede ser 'c:\opencv2.1\include\opencv\cxtypes.h(146) : __int64 int64' o 'c:\ogresdk_vc9_v1-7-2\include\ogre\ogreplatform.h(255) : Ogre::int64'
>c:\opencv2.1\include\opencv\cxtypes.h(179) : error C2872: 'uint64' : símbolo ambiguo puede ser 'c:\opencv2.1\include\opencv\cxtypes.h(147) : unsigned __int64 uint64' o 'c:\ogresdk_vc9_v1-7-2\include\ogre\ogreplatform.h(254) : Ogre::uint64'
>c:\opencv2.1\include\opencv\cxtypes.h(307) : error C2872: 'uint64' : símbolo ambiguo puede ser 'c:\opencv2.1\include\opencv\cxtypes.h(147) : unsigned __int64 uint64' o 'c:\ogresdk_vc9_v1-7-2\include\ogre\ogreplatform.h(254) : Ogre::uint64'

It seems that the Ogre namespace from Webcam.h is "active" when try to compile the OpenCV lib and the compiler doesn't know wich symbol is the correct. I tried to use using namespace std; in these files but it doesn't work.

I'm using OgreSDK_vc10_v1-7-2, OpenCV 2.1 and Visual Studio 2010. I've tryed too with Visual Studio 2008 and his respective SDK.

Can anyone help me, please?

Thank you!

PS: I know that my english is very poor, I'm sorry about that!
User avatar
so0os
Bugbear
Posts: 833
Joined: Thu Apr 15, 2010 7:42 am
Location: Poznan, Poland
x 33

Re: [WIP] Webcam Plugin

Post by so0os »

you need to write Ogre::uint64, OR do not use Ogre namespace;
Sos Sosowski :)
http://www.sos.gd
galomar
Gnoblar
Posts: 2
Joined: Wed Jan 19, 2011 11:16 am
Location: Spain

Re: [WIP] Webcam Plugin

Post by galomar »

so0os wrote:you need to write Ogre::uint64, OR do not use Ogre namespace;
Thank you for your reply so0os.

I think that the types that need to be used are the defined on cxtypes.h from OpenCV lib. Then, I must "unuse" the Ogre namespace. But I don't understand why I can generate the WebcamPlugin project (that uses the OpenCV lib and Ogre lib, managing Ogre namespace, without any error) but when the WebcamPluginDemo use the plugin then I have these errors. I haven't modified the project (well, I have deleted only the namespace CV on Webcam.h from WebcamPlugin to avoid the same problem that bwillers and it works fine).
bwillers wrote:I'm trying to get this to build on VStudio 2010 but I keep getting bizarre errors seemingly coming from the standard libraries:

Code: Select all

1>  Webcam.cpp
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\complex(42): error C2039: '_C_double_complex' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\complex(42): error C2146: syntax error : missing ';' before identifier '_Dcomplex_value'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\complex(42): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
...
Anyone have any ideas on how to fix this?

Thanks
so0os, do you can generate both projects?

I don't know how I must delete the Ogre namespace from the WebcamPlugin project. It's full of them. And when I do that, the errors become worst!
User avatar
so0os
Bugbear
Posts: 833
Joined: Thu Apr 15, 2010 7:42 am
Location: Poznan, Poland
x 33

Re: [WIP] Webcam Plugin

Post by so0os »

I don't, I wrote my own webcam thingy. It's like 30 lines of code to get this working with just Ogre+OpenCV using dynamic textures. And just a few more if you want it threaded
Sos Sosowski :)
http://www.sos.gd
User avatar
thejesusbr
Gnoblar
Posts: 15
Joined: Thu Feb 03, 2011 8:17 pm
Location: Campinas, SP Brasil

Re: [WIP] Webcam Plugin

Post by thejesusbr »

Does anyone able to make the plugin work in linux? I even managed to compile and load, but the demo does not compile. Or does anyone have any other solution to have the webcam working? I intend to do a project with augmented reality.

Thanks!
User avatar
so0os
Bugbear
Posts: 833
Joined: Thu Apr 15, 2010 7:42 am
Location: Poznan, Poland
x 33

Re: [WIP] Webcam Plugin

Post by so0os »

thejesusbr wrote:Does anyone able to make the plugin work in linux? I even managed to compile and load, but the demo does not compile. Or does anyone have any other solution to have the webcam working? I intend to do a project with augmented reality.

Thanks!
It takes a framelistener and like 30 lines of code to do that yorself yousing dnamic textures and openCV
Sos Sosowski :)
http://www.sos.gd
User avatar
thejesusbr
Gnoblar
Posts: 15
Joined: Thu Feb 03, 2011 8:17 pm
Location: Campinas, SP Brasil

Re: [WIP] Webcam Plugin

Post by thejesusbr »

so0os wrote:
thejesusbr wrote:Does anyone able to make the plugin work in linux? I even managed to compile and load, but the demo does not compile. Or does anyone have any other solution to have the webcam working? I intend to do a project with augmented reality.

Thanks!
It takes a framelistener and like 30 lines of code to do that yorself yousing dnamic textures and openCV
Ok... I'll do this. One more question: is possible to set a dynamic texture to the background (I'm a newbie in Ogre)?

I'll use ArtoolkitPlus to detect markers and give directions to the Ogre cameras (I can do this by now). I'm still thinking and rewrite some detection routines to work with CUDA. CUDA is able to access OpenGL buffers, so it will be give me the chance to process the texture in parallel.
User avatar
so0os
Bugbear
Posts: 833
Joined: Thu Apr 15, 2010 7:42 am
Location: Poznan, Poland
x 33

Re: [WIP] Webcam Plugin

Post by so0os »

Yeah, just make a ManualObject or rectangle2D with RenderQueue_1 or so and depth_write off. Also, I bet there's a background thingie in ogre.
Sos Sosowski :)
http://www.sos.gd
User avatar
thejesusbr
Gnoblar
Posts: 15
Joined: Thu Feb 03, 2011 8:17 pm
Location: Campinas, SP Brasil

Re: [WIP] Webcam Plugin

Post by thejesusbr »

Thanks, guys. I managed to easily integrate the OpenCV with a texture e show the camera image to the background. And using OpenCV with GStreamer, I am also able to use a USB, a FireWire or a network camera, just by changing one only parameter.

Now, I will be struggling with the ARToolKitPlus. The marker detection is running well, but the position vector that it gave to me is understimated... The movement of the virtual things are smaller than the movement of the marker... I don't know why... I'll question in other threads to find a fix for it.

The OpenCV solution was quite easy, so I'll not put any code here, but if anyone needs help, just contact me. But I don't think it will be necessary, it's quite easy.
User avatar
so0os
Bugbear
Posts: 833
Joined: Thu Apr 15, 2010 7:42 am
Location: Poznan, Poland
x 33

Re: [WIP] Webcam Plugin

Post by so0os »

Are you using both matrices (projection and view) from ARToolkit? Also, have you calibrated your camera correctly?
Sos Sosowski :)
http://www.sos.gd
User avatar
thejesusbr
Gnoblar
Posts: 15
Joined: Thu Feb 03, 2011 8:17 pm
Location: Campinas, SP Brasil

Re: [WIP] Webcam Plugin

Post by thejesusbr »

so0os wrote:Are you using both matrices (projection and view) from ARToolkit? Also, have you calibrated your camera correctly?
I calibrated the camera using the recomended Matlab toolbox. In that toolbox, the projection of camera is acurated. I'm using only the ModelView matrrix. How could I use both? By the way, the orientation quaternion is ok, only the position is given wrong. I will review the use of the matrices so.
Post Reply