Page 2 of 4
Posted: Wed Jul 12, 2006 6:18 am
by pjcast
The External texture Source is just a Material, and as such, you can get the pixel buffer yourself (without having to call the specific plugin's methods) and read the data yourself. however, you may incur a penalty for two texture locks though and a performance loss, I'm not sure.
Posted: Wed Jul 12, 2006 11:03 am
by Timme
@futnuh:
1.) You can also get the image data from the pixel buffer, but I think it would be inexpedient, because the image in the pixel buffer is resized to 512x512 and Webcam::getCvImage delivers a raw image from the cam. Futhermore WebcamListener::newFrame is called everytime when a new image is available. I think that it is the easiest way using the WebcamListener for getting the image data from the cam.
2.) That means there is no crash anymore?
@pjcast: BTW.: Thank you for the External Texture Source and the video plugins which helped me a lot.
Posted: Sat Jul 15, 2006 3:40 am
by futnuh
Timme wrote:2.) That means there is no crash anymore?
That's correct, the crash under pyOgre is now history,
http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=1636.
In the above pyOgre forum post, I mention finding that the raw image gathered by the plug-in via OpenCV is only 320x240 on my Logitech Quickcam Orbit. I know though that the webcam natively supports 640x480 resolution. The plug-in resizes the raw image to a 512x512 texture for Ogre - so I definitely wanted the higher source resolution.
I've spent the afternoon trawling through the OpenCV highgui source and video for windows. It appears that OpenCV doesn't implement the needed cvSetCaptureProperty() function (actually a macro) on Windows. There's a manual fix though in the OpenCV Yahoo forum:
http://groups.yahoo.com/group/OpenCV/message/28735. It is pretty straightforward and, not surprisingly, I'm now getting 640x480 resolution
The question is whether you want to incorporate this into the "official" plug-in? One option would be material parameters for desired height and width. Alternatively a boolean flag for bringing up the VFW dialog that lets the user manually select the capture properties.
Webcam not detected in custom app
Posted: Tue Aug 22, 2006 12:10 pm
by praxis
Hi, everyone. I hope someone can give me a hint with this problem.
I have installed and compiled the webcam plugin and demo, and it works fine.
But when trying to integrate it in my application, the webcam is not recognized or initialized, although the plugin gets loaded correctly.
I have placed the dll on the right place, and added the plugin to the plugins config file.
I have copied as faithfully as possible the initialization code of the demo application, but I get a null pointer here:
Code: Select all
Webcam *webcam=WebcamCtrl->getWebcamByNumber(0);
In the demo source, the same code works ok.
I have triple-checked the code and I can't find anything missing. Has anyone had a similar problem?
One more question: anyone researched if it would be possible to have the plugin running without directX e.g. in Linux?
Thanks in advance
Re: [WIP] Webcam Plugin
Posted: Wed Apr 18, 2007 3:03 pm
by rzr
Thank you for this contribution.
Are there any works done to get official webcam support in ogre ?
It would be nice to merge this code with ogre devel tree.
Else please can you provide a better package , including classing top files : COPYING, README, AUTHORS, etc
What is the problem with GL support ? 2^n square textures or something else ?
Regards
Posted: Thu Apr 19, 2007 7:26 pm
by Timme
@praxis: There must be a material file which uses a camera. While parsing the material sript the webcams are initialised. If you don't use any webcam in your material files, the webcam won't be initialised.
@rzr: I don't think so that the plugin will be added to the Ogre devel tree. There is a video plugin which isn't merged to Ogre, either. Maybe Sinbad can add the OgreAddons.
I'm writing currently a new version of the plugin which will be compatible with Ogre 1.4. I think this version won't use OpenCv anymore, because I couldn't get the support of two webcams with OpenCv on Windows. There is a special plugin which supports two cameras which I haven't released yet.
There is a problem with the texture in OpenGL, but I couldn't fix it. The image is rezised to 512x512 by software and blitted to the texture after rezising. I don't know why there is that problem, but the plugin worked fine with Ogre 1.0 in OpenGL.
@futnuh:
The question is whether you want to incorporate this into the "official" plug-in? One option would be material parameters for desired height and width. Alternatively a boolean flag for bringing up the VFW dialog that lets the user manually select the capture properties.
Good idea. Will add that to the new plugin.
Maybe the new version of the plugin will be released soon, stay tuned.
Posted: Sat Apr 28, 2007 7:45 am
by tgraupmann
Unfortunately when I run the
WebcamPluginDemo.exe demo with this material script:
Code: Select all
material Plane/Background
{
technique
{
pass
{
cull_hardware none
cull_software none
depth_write off
depth_check off
lighting off
texture_unit
{
texture_source webcam_video
{
Webcam_Number 1
}
}
}
}
}
I get the following error.
Code: Select all
---------------------------
Video device already in use
---------------------------
You cannot use this device when another video application, such as DVD, video
conferencing, video editing, TV viewers, or WebTV for Windows is already using it.
To use this device for your current application, close the application that is using it.
If WebTV is installed and running on your system, pause the "WebTV video and data
services" on the taskbar tray by right-clicking its icon and choosing "Pause Services".
---------------------------
OK
---------------------------
I wasn't running any video apps at the time.
Posted: Sun Apr 29, 2007 7:24 pm
by Timme
I think, you are using 2 cameras. (the first webcam is Webcam_Number 0 an the second Webcam_Number 1)Have you tried to open the second camera with a programm?
It isn't possible to use two cameras at once with the current version. But I will fix that with the next release. Please at to every texture_source webcam_video section "Webcam_Number 1". There is a special version for using 2 cameras at the same time, but it is a bit slow yet. But I can send it to you.
Posted: Sun Apr 29, 2007 8:14 pm
by tgraupmann
I think my tv tuner card must be #0. I get channel 3 static. Quick cam #1 is a built in web cam.
I was just checking out your project. No need to send me a fix. Just a feature request to support multiple cameras.
While we are talking about web cams did you see the story, "
One man writes Linux drivers for 352 USB webcams":
http://www.theinquirer.net/default.aspx?article=39291
Re: [WIP] Webcam Plugin
Posted: Fri May 04, 2007 6:35 pm
by tania
Timme wrote:[Edit]The second beta of the webcam plugin has been released. The plugin is based on the video plugin of pjcast.[/Edit]
Features of the plugin:
- Fully scriptable through material script
- automatic update of the texture
- error handling if webcam couldn't be initialised
I provide a binary version and the source (with VC++ 2005 project files) Both versions include the Plugin_Webcam.dll and a Demo:
http://tuan.kuranes.free.fr/Ogre.html#WebCam ([EDIT] new download link)
Note for user who wants to compile the source code: You will have to download OpenCV (
http://www.intel.com/technology/computi ... /index.htm ) and to set up the include path in the projects settings of "WebcamPlugin":
Include:
(OpenCVPath)/cv/include
(OpenCVPath)/cxcore/include
(OpenCVPath)/otherlibs/highgui
Lib:
(OpenCVPath)/lib
There is a problem when compiling the plugin on VC++ 2005: when VC++ makes the linking for ptypes.lib appears the following error message
(it might not be the actual VC++ 2005 error message in English, is a translation of the error message in VC++ 2005 in Spanish):
K2019: unsolved external symbol __imp__MessageBoxA@16 which is referred on function "void __cdecl pt::defhandler(int, char const *)" (?defhandler@pt@@YAXHPDB@Z)
DLL_Debug/ptypes.dll : fatal error LNK1120: 1 unsolved external
Posted: Tue May 08, 2007 12:37 pm
by Timme
The user32.lib is missing while linking the library.
Posted: Mon Jun 25, 2007 7:37 pm
by lowdev
hi
noob 'ere
is there anyone who has used this plugin succesfully in a project or so (documentation)?
im interested in using it for a performance/theater piece i'm co-developing, however i know the ogre learning-curve is fairly steep...
i do have a fair bit of experience in modding quake3, guess i need some convincing to switch to Ogre
thnx
walter
Posted: Sun Aug 26, 2007 5:22 pm
by KuRi
This doesn't work under Vista... it seems a problem with the opencv library.
How to place the processed image into Scene?
Posted: Tue Nov 13, 2007 6:55 pm
by armage
Hi guys,
Nice plugin. I am just wondering after processing the image in the method below.
void TestWebcamListener::newFrame(Webcam* webcam)
{
CV::IplImage* lImg = webcam->getCvImage();
//Do something with the image...
}
1. How do I place the processed image into the displayed Scene? Which variable IplImage variable do I set?
2. If I just need use webcam plugin listner to capture image for processing only. Is it possible not to display the image on the scene?
Re: How to place the processed image into Scene?
Posted: Mon Nov 26, 2007 11:44 pm
by faraklit
armage wrote:Hi guys,
Nice plugin. I am just wondering after processing the image in the method below.
void TestWebcamListener::newFrame(Webcam* webcam)
{
CV::IplImage* lImg = webcam->getCvImage();
//Do something with the image...
}
1. How do I place the processed image into the displayed Scene? Which variable IplImage variable do I set?
2. If I just need use webcam plugin listner to capture image for processing only. Is it possible not to display the image on the scene?
1. You should look into the plugin code (void Webcam::execute())
2. just do not assign webcam material to any entity.
by the way, I tried to make this plugin work on opengl but could not manage to do so. Changing color channels to RGBA did not resolve it either. I think the Ogre::Image has something to do with it, using a manual dynamic texture may fix the problem.
Problem running the demo
Posted: Sun Mar 23, 2008 6:21 pm
by ricardo_arango
EDIT: IT WORKS NOW. I THINK IT HAD SOMETHING TO DO WITH DEBUGGING AND STD:VECTOR, BUT DON"T TAKE MY WORD FOR IT. SO IF ANYONE IS INTERESTED, IT WORKS WITH OpenCV 1.0 AND ptypes-2.1.1.
I have bee trying to the get plugin demo to work, after compiling everything else, but I get stuck here:
Code: Select all
ExternalTextureSourceManager::getSingleton().setCurrentPlugIn("webcam_video");
WebcamController* WebcamCtrl = (WebcamController*)ExternalTextureSourceManager::getSingleton().getCurrentPlugIn();
// What is this for??
WebcamCtrl->getDictionaryStringName();
WebcamCtrl->getWebcamByNumber(0)->addWebcamListerner(new ExampleWebcamListener);
I know is not a problem with the camera, because the plugin actually creates some textures when ogre reads the material and the camera light comes on, and looking at mWebcamVector I see that the camera is there, but, when it comes to the getWebcamByNumber line in WebcamPluginDemo.h, it crashes because it can't find it, the vector is now empty. Somehow, it looses the pointer to the previous mWebcamVector, I am not sure why.
Anyone had this problem? Or has tried the demo lately?
Thanks,
By the way, I am using the latest ogre source, but not from SVN, the downloadable one, 1.4.7
Editing the image from the webcam, and updating the texture
Posted: Mon Mar 24, 2008 12:43 am
by ricardo_arango
Hi,
I tried in void newFrame(Webcam* webcam) to do an operation over the cvImage, and now I want it to be reflected over texture. So when the texture is updated in WebcamTexture::blitToTexture(TexturePtr tex, int webcamNum), it copies the modified image over the texture. But I get this error..
OGRE EXCEPTION(3:RenderingAPIException): D3DXLoadSurfaceFromMemory failed in D3D9HardwarePixelBuffer::blitFromMemory at ..\src\OgreD3D9HardwarePixelBuffer.cpp (line 362)
Here's is the code:
Code: Select all
CV::IplImage* img = webcam->getCvImage();
OperationOnImage(img);
webcam->getOgreImage()->loadDynamicImage((unsigned char*) img->imageData, img->width, img->height, Ogre::PF_R8G8B8);
It fails not on this code, but actually in WebCamTexture.cpp, here
Code: Select all
tex->getBuffer()->blitFromMemory( newImage.getPixelBox(), b );
If I remove the last line from my code it works. So my question is, how can I safely write over the ogre image, so it can be the blit to the texture?
Posted: Mon Mar 24, 2008 4:59 pm
by ricardo_arango
OKAY....just forget all the last posts I wrote. It seems I was doing what I wanted the really hard way. I was changing the cvImage, when I can just change the ogre image, which would then be reflected in the scene, AND, will not give me trouble. I was trying to change the original image because the ogre one has been resized, but honestly, that's not big deal, compared to synchronizing this thing.
So, the moral of the story is, for this webcam plugin, don't touch the cvResizeImage object. You can read from it, but don't try to change it.
Webcam plugin and OGRE 1.4.6
Posted: Thu Apr 03, 2008 4:54 pm
by jj
Hi all,
I was trying to compile the webcam plugin with OGRE 1.4.6 and it crashes... does anyone tried this with success?
Also, I need to use it with opengl (I am building an open source multiplatform library based on ogre), and I have seen that the webcam plugin only works with DirectX... any ideas or tests about this?
Thanks in advance!
jj
Posted: Mon Apr 07, 2008 12:01 pm
by faraklit
crashes? how? send error message.
I could not make it work with opengl too.
Posted: Mon Apr 07, 2008 2:38 pm
by jj
Well, I cannot send you the error right now, but Timme (the author) told me that indeed it was not compatible with Ogre1.4.6...
Posted: Wed Apr 09, 2008 8:04 am
by Gazoo
Hey,
First of, thanks to Timme for making this cool plug-in for Ogre3D. I myself have tried to use the plug-in in the latest version of Ogre 1.4.7 without much success. The regular compile crashes due to an unfindable entry point for a texture function call. The debug version says it cannot locate OgreMain.dll - I assume this is because I'm using the precompiled webcam plugin which isn't intended to be used as a debug dll.
Nevertheless, I'm in a bit of a fix. I'm in the beginning of starting my master thesis and I intend to use Ogre in combination with my webcam. Until about 20 minutes ago I was convinced that this plug-in would do the trick.
Has anyone had any experience with making the plug-in run with the latest Ogre3D? Or perhaps someone knows which is the most recent version of Ogre3D the plug-in worked with.
I can see from the dates on the posts that Timme hasn't been active in this thread for quite a while. Does anyone know if he plans on continuing his development at any time?
Finally, in case all else fails, does anyone know of any (relatively easy) alternate ways to get ahold of some webcam imagery?
Regards,
Gazoo
Posted: Thu Apr 10, 2008 1:50 am
by Yuk1
It's made using the windows multimedia sdk, right ?
Sayonara^^
Posted: Mon May 19, 2008 7:27 pm
by ShadeOgre
Are there any news here? The DX subsystem works great, but OGL version doesn't -> are there any patches yet?
Help on WebcamPluginDemo
Posted: Thu May 29, 2008 12:13 pm
by nmelo
hello,
i'm new with ogre, i have WinXp and VS2005, i've already use openCV and it is working fine, i install Ogre SDK but when i run the WebcamPlugin project i get the error:
fatal error C1083: Cannot open include file: 'ExampleApplication.h': No such file or directory
wen can i get these files that are missing? or what is the problem?
thanks