EJS has two twin new View elements that can read the input from your laptop or web camera and display it on a DrawingPanel 3D. Both elements work similarly, if only the one for the local camera requires extra software. The icons for these elements are in the 3D Drawables -> Tools and utils palette and look like a circle with the AR letters inside them.
Using the whole AR (Augmented Reality) system is a bit complicated, and we (the authors of this new element) are planning to write a paper on it. But if you feel adventurous, here are the steps to run the attached example:
1- Download the GStreamer runtime libraries and unzip them to your EJS workspace "export" directory. This should create a gstreamer directory with four subdirectories inside it. You only need to keep the one that corresponds to your operating system (though I keep them all, just in case). The copy I use of these libraries is a 100 MB file you can download from my site at http://fem.um.es/EjsWiki/uploads/Download/ARsystem/gstreamer.zip
These libraries are needed to run properly the AR view element that uses your local camera.
2.- Download the 500KB data.zip file at http://fem.um.es/EjsWiki/uploads/Download/ARsystem/data.zip
This file has alternative configuration files for your particular camera. The one in the example works well for the buil-in camera for the latest 15'' Retina Mac Book Pro.
The file also has a directory with the patterns that the AR system can recognize. Print the ejs.pdf file in a white piece of paper.
(Begin Update) 3.- Edit the "Port" property of the ARSystem View element to match the camera you want to use. - On a Mac, Port should be "0" for the built-in camera, "1" for a USB camera. - On a Windows machine, you can get the exact name for your camera from the "Control panel -> Device administrator -> Image devices". (I am freely translating these names, since my Windows is in Spanish. :-) ) (End Update)
4.- Now, run the EJS example attached, and hold the EJS marker (the one you printed) in front of your laptop camera. The program main panel should show the video from your camera showing you, the EJS marker you hold in your hand, and a red rectangle surrounding the EJS marker.
I forgot something important. You need to edit the "Port" property of the ARSystem View element to match your system camera.
In my example, the Port property reads "0", meaning the built-in camera of my MacOSX laptop. ("1" would be a camera connected to a USB port.)
For a Windows computer, you need to change this to read the exact name of your integrated or USB camera.
You can get the exact name for your camera from the Windows "Control panel -> Device administrator -> Image devices". (I am freely translating these names, since my Windows is in Spanish. :-) )
I tried this on my Window Virtual Machine running under MacOSX and it does not work. But my Windows colleague who wrote this code with me says that he sets the Port property to "Integrated Webcam" (that is the name of his built-in camera on his laptop) and it works just fine.
Thank you very much Paco, I fallowed your instructions read the name of the web cam in Windows device administrator and get the program working. For my particular case the name is WebCam SC-0311139N, I just replace the name in port and works perfectly.
Franciso, I puted the pattern number one and the number 76 that and found in data folder but I could not see the red rectangle around the printed graphic. May be is there still any problem with AR module configuration, the only thing that I noted is that It says "ejs:76" in the pattern option of AR module, Is this Ok?.