VILAP
VILAP realisies a simple solution for counting laps using a Linux-based PC and a webcam. At this time, there can be two cars on the race track simultanously.
http://www.starky.de/vilap/vilap.tar.gz
The webcam detects black flags mounted at the cars on different heights. The background hast to be white.
This Open Source project is in an early stage (Version 0.3).
Vorraussetzungen
I use Video 4 Linux. The only supported resolution is 176x144, there is plenty of information and drivers in http://www.exploits.org/v4l/ . Actually it is only tested with a DEXXA-Webcam, but maybe other cams work also. I use the http://qce-ga.sourceforge.net/ driver for my cam. This should be compatible to Logitech Quickcam Express, Logitech Quickcam Web, LegoCam andLabtec Webcam.
Refer to the above websites for installion of drivers. Be sure that USB and Video4Linux is compiled into the kernel. Or use http://www.knopper.net/knoppix.
Start your V4L driver (e.g. „./quickcam.sh“in qce directory which does usb and „insmod mod_quickcam“-stuff). Test driver with „xawtv“.
To install type „gunzip vilap.tar.gz “ and „tar xvf vilapt.tar“ and compile with „make“. This creates „./vilap“. Use textfile „vilap.cnf“ to configure.
Set the webcam to a one meter distance at the side of the race track. Type „./vilap -c1“. You should see video and some horizontal boxes. Adjust the camera height, that the middle of the lens is at the same height between the lower and the upper flag at the cars. Whereever the car is on the start/finish area, the upper flag should be allways in the upper horizontal box and the lower flag in the other box. If necessary you can change to areas using parameteres XMIN1, YMIN1 etc. in the „vilap.cnf“ file.
The background has to be white, install a few sheets of paper or whatever you want for this purpose. There has to be enough light, that these white areas are absolutely white and not yello or so. You can also change CONTRAST, BRIGHTNESS etc.. The Hex number in the text output should all be „FFF“ as long as there are no flags in the area.
Stop the programm using CTRL-C or Windowmanager.
A normal start is done with „./vilap“. After 5 seconds or so, the race will start. Take care that no car is in the camera field of view before that time.
Use „./vilap | tee racelog.txt“ to create a file „racelog.txt“ where the text output is saved.
There is some more information at the german website. Sorry for not translating it, but it is already a lot of documentation. Maybe the babelfish link at the top of the page helps you a bit.
I did this software for fun and playing with toys. I do not take any responsibility for damages as a result of using this software. Don´t blame me, if there are errors in detect, the video principle is not 100% error prone.
This is Open Source, go to http://www.gnu.org/philosophy/free-sw.html or read the file „License“ in the tarball for more information. Have fun, use the idea, use the code but please don't blame me if anything goes wrong.
Markus Stark, starky@starky.de, www.starky.de/vilap/vilap.html