Page 1 of 2

webcam plugin

Posted: 24 Feb 2014, 19:08
by motagirl2
Hello Forum,
I'm new to V-REP. I've been a couple of days trying to use the webcam model, with no results. I keep on getting the "The webcam at the given index could not be initialized" error, and I have no clue of what should I do to make it work for me!
The error comes when the scripts is in this line "initialization,deviceResolution[1],deviceResolution[2]=simExtCamStart(deviceIndex,deviceResolution[1],deviceResolution[2])", so I suppose the error is because of the "simExtCamStart" function.
Where could I find some info/documentation about the webcam plugin, and particularly, about this function? I've been surfing the help files and this forum but I haven't found anything.

Any help would be very much appreciated.

PS: And also, where could I get the source code in case I'd like to use this on Linux? It's mentioned when you place the webcam model in a scene, but again, no clue who/where should I ask for it...

Re: webcam plugin

Posted: 24 Feb 2014, 23:43
by coppelia
Hello,

you can find the source code to the Webcam plugin in the folder programming/windowsOnlyProjects/v_repExtCam. As the folder name says, the plugin currently only runs on Windows. Probably it would be not too difficult to adjust it for other platforms.

Cheers

Re: webcam plugin

Posted: 25 Feb 2014, 11:09
by motagirl2
Nice, thank you! :)

Re: webcam plugin

Posted: 05 Apr 2014, 00:04
by cozzy
Hello,

Can an integrated webcam be used in v-rep ? (as those on laptops) , or it must be a webcam connected trough USB ?

Have an integrated webcam on my laptop and got the same error as above..

Thanks.

Re: webcam plugin

Posted: 05 Apr 2014, 09:49
by motagirl2
Hi Cozzy,
I used an integrated camera, running on a laptop with Windows XP.
I still have no clue on what the problem was, but when I tried in another laptop (but with Windows 8.1) then it magically started working. But not always, it sometimes (maybe 20% of the times) it still gives me the same error (then I just have to close and open V-REP again). It's quite weird and annoying...

Re: webcam plugin

Posted: 06 Apr 2014, 09:38
by cozzy
So it isn't for sure a hardware problem. My integrated webcam works fine in other applications but in v-rep still not:( . I am running win 7 and see that the plugin should work :(. I will try soon with an USB connected webcam.

Maybe someone from coppelia staff could help please.

I still have two more questions:

1. It is possible to manually select the camera source ?
2. It is somehow possible to USE the online streaming of an IP cam for image processing ?

Thank you.

Re: webcam plugin

Posted: 06 Apr 2014, 17:12
by Eric
Hi

I realized that this problem happens with the plugin on releases > 3.0.5. if u have your hands on an older version of v-rep that could be a temporary patch.

You can select an other camera by changing the index in the simulation s parameter of the script attached to the webcam object. The index goes from 0 to numberOfConnectedCameras-1. By default it is set at 0 (which is the index of the 1st found cam driver)

If you want to get the image from an IP cam you can use a software like manycam that puts the video stream into a cam driver. Manycam is not free (or free but with a watermark ) so whoever finds a free/ better solution to stream an ip stream into a cam driver please share!

Cheers

Eric

Re: webcam plugin

Posted: 06 Apr 2014, 19:18
by coppelia
Cozzy and Eric,

you could try to directly access the streamed image of an IP cam (without the detour of an auxiliary software), from inside of a plugin. If interested, we can help you with the plugin details.

Cheers

Re: webcam plugin

Posted: 07 Apr 2014, 17:17
by cozzy
Thank you a lot for you answers.

I've tried today again with the laptop's integrated camera , then also with an usb connected one.
I even tried to modify the index number in script and from 0 to 3 same error "camera at given index could not be initialized". If i set the index number >3 it says "Plugin not found."

I am running V-rep Edu version 3.1.1

First i need to solve this thing with the webcam. But after i will get over this step , i will be grateful for any help about the plugin for using an online streaming of an ip cam.

Re: webcam plugin

Posted: 07 Apr 2014, 22:14
by coppelia
The best to do probably, it to integrate OpenCV via a plugin. OpenCV allows to access webcam data (and probably also network cams) in a platform-independent fashion.
We'll try to put this onto our todo list.
btw, there is already an OpenCV bridge for V-REP, courtesy of Marco Bellaccini, located in programming/v_repExtOpenCVBridge

Cheers