Head tracking for Spring is here! Try it :)
Posted: 07 Feb 2008, 21:52
Real time head tracking for Spring is here!
The application uses a webcam which is placed above the monitor to recognize the players head. It then uses this information to track the camera in relation to the players head.
As of yet, the recognition is done by a Haar classifier, and it uses the OpenCV framework.
It adds the recognition information to a file, headdata.txt, in your Headtracker directory, which is then read by a lua script in real time. The widget sets the camera to the corresponding position.
Moving your head left and right moves the camera left and right (just like scrolling in OTA mode), and up and down motion is mapped to tilting the camera (ctrl+scrollwheel in OTA view)
It will display a window, titled "result", this window can be closed if desired, it just shows the output of the Haar classification.
The app adds a great deal of realism to Spring.
Most webcams frame rate drops to about 5 fps when used without any ambient lighting, the ideal frame rate, which is about 10 minimum, needs stronger ambient lighting.
For maximum effect, try the application during daylight hours, as ambient lighting is higher then than what most people can achieve with electric lights. High frame rates for the camera during this time will make the effect look really spectacular!
Its quite CPU intensive as of now, but I don't see this to be a problem on dual core machines. Most dual core pc's should be able to handle it without a drop in Spring frame rate. For my computer, there is absolutely no drop in Spring preformance.
The Lua widget has a gui, but can be hidden by pressing show. The camera positioning can be stopped by pressing stop. The window is draggable, so as not to be in the way.
Enjoy the full three dimensions of Spring!
System requirements:
- A webcam, just about any type will do.
- A dual core processor, preferably better than 2ghz, so as not to impact Spring performance.
Download links:
HeadTracker v0.4 (2.2MB)
Installation instructions:
1. Download the package.
2. Unzip the contents of the zip file to you Spring directiory. That should create the HeadTracker dir in your spring folder.
3. From your headtrack directory, copy the file headtrak.lua to spring/LuaUI/Widgets.
4. Plug in your webcam, and place it on top of your monitor, facing straight at you. Start Headtracker.exe in the Headtracker directory.
5. Start Spring and enable the Hedtrak widget by pressing F11 and selecting it from the list.
Troubleshooting:
Headtrak doesn't recognize my webcam:
Close all applications that may be using it, then unplug and plug in the device again. If this doesnt work, try updating the drivers for it.
The widget displays the message: "NO FILE"
The widget can't find headdata.txt. Make sure you unzipped into the correct folder, and that the program is actually recognizing your face
The tracking works, but it updates very slowly/moves too jerkily:
Try using a bit more ambient lighting, eg, turn on the lights in your room or use it during daylight hours. The widget displays the current camera frame rate on its GUI. For best results, frame rate should be above 10.
As of yet, the jerky movement is also caused by Spring's SetCameraState function, which uses an exponential decay in moving the camera.
Spring is unable to load widget because of missing spring.h.lua or opengl.h.lua files:
Copy the corresponding files from headtracker to Spring/LuaUI/Headers.
Contact:
Here, or in the lobby: [teh]Beherith
Tell me what you think it, any suggestions or opinions are welcome!
The application uses a webcam which is placed above the monitor to recognize the players head. It then uses this information to track the camera in relation to the players head.
As of yet, the recognition is done by a Haar classifier, and it uses the OpenCV framework.
It adds the recognition information to a file, headdata.txt, in your Headtracker directory, which is then read by a lua script in real time. The widget sets the camera to the corresponding position.
Moving your head left and right moves the camera left and right (just like scrolling in OTA mode), and up and down motion is mapped to tilting the camera (ctrl+scrollwheel in OTA view)
It will display a window, titled "result", this window can be closed if desired, it just shows the output of the Haar classification.
The app adds a great deal of realism to Spring.
Most webcams frame rate drops to about 5 fps when used without any ambient lighting, the ideal frame rate, which is about 10 minimum, needs stronger ambient lighting.
For maximum effect, try the application during daylight hours, as ambient lighting is higher then than what most people can achieve with electric lights. High frame rates for the camera during this time will make the effect look really spectacular!
Its quite CPU intensive as of now, but I don't see this to be a problem on dual core machines. Most dual core pc's should be able to handle it without a drop in Spring frame rate. For my computer, there is absolutely no drop in Spring preformance.
The Lua widget has a gui, but can be hidden by pressing show. The camera positioning can be stopped by pressing stop. The window is draggable, so as not to be in the way.
Enjoy the full three dimensions of Spring!
System requirements:
- A webcam, just about any type will do.
- A dual core processor, preferably better than 2ghz, so as not to impact Spring performance.
Download links:
HeadTracker v0.4 (2.2MB)
Installation instructions:
1. Download the package.
2. Unzip the contents of the zip file to you Spring directiory. That should create the HeadTracker dir in your spring folder.
3. From your headtrack directory, copy the file headtrak.lua to spring/LuaUI/Widgets.
4. Plug in your webcam, and place it on top of your monitor, facing straight at you. Start Headtracker.exe in the Headtracker directory.
5. Start Spring and enable the Hedtrak widget by pressing F11 and selecting it from the list.
Troubleshooting:
Headtrak doesn't recognize my webcam:
Close all applications that may be using it, then unplug and plug in the device again. If this doesnt work, try updating the drivers for it.
The widget displays the message: "NO FILE"
The widget can't find headdata.txt. Make sure you unzipped into the correct folder, and that the program is actually recognizing your face
The tracking works, but it updates very slowly/moves too jerkily:
Try using a bit more ambient lighting, eg, turn on the lights in your room or use it during daylight hours. The widget displays the current camera frame rate on its GUI. For best results, frame rate should be above 10.
As of yet, the jerky movement is also caused by Spring's SetCameraState function, which uses an exponential decay in moving the camera.
Spring is unable to load widget because of missing spring.h.lua or opengl.h.lua files:
Copy the corresponding files from headtracker to Spring/LuaUI/Headers.
Contact:
Here, or in the lobby: [teh]Beherith
Tell me what you think it, any suggestions or opinions are welcome!