To locate a blob of color the program uses a sequence of processing steps. First the color is separated by using a fast table lookup. The tabel is precalculated from the configuration file. The lookup step essentially binarizes the image for each colour beeing tracked. Of each binary image a "center-of-mass" is calculated in the area of interest (bounding area shown on screen). The coordinates are scaled within this area to a range 0.0 to 1.0.
The frame rate that can be achieved with a Pentium CPU running at 200 MHz is approximately 20fps.
# Reconfiguring the kernel to work with the meteor.o module
cd /usr/src/linux
patch -p0 <bigphysarea-patch-rh52
make menuconfig; make dep; make clean; make zlilo; make modules; make modules_install
# Sample lilo.conf to work with "make zlilo" under Redhat Linux
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
append="bigphysarea=1024"
image=/vmlinuz
label=linux
root=/dev/hda3
read-only
image=/boot/vmlinuz-2.0.34-1
label=redhat-linux
root=/dev/hda3
read-only
# Sample meteor-devs.sh
mknod /dev/mmetfgrab0 c 40 0
mknod /dev/mmetfgrab1 c 40 1
mknod /dev/meteor0 c 40 0
mknod /dev/meteor1 c 40 1
./robtrack16yuv [-p/-n] [-s/-c] [meteor framegrabber device]-p sets PAL mode
The default device is "/dev/mmetfgrab0". The default setup is SVIDEO
input in PAL mode. The programs logs all messages (messages, setting changes,
errors, etc.) to "stderr". The configuration file is called always called
<name of program>.cnf (i.e. robtrack16yuv.cnf).
The robtrack program requires a running Xserver at 16bit resolution
and color weights beeing 555. Under Linux the start line for this color
resolution is:
startx -- -bpp 16 -weight 555
Alternatively the XF86Config file can be edited to default to such a color resolution. The pixel resolution should be equal or greater 640x480 points - resolutions greater than 1024x768 should be avoided on older video cards, as these resolutions typically slow down screen update rates.
Home = Toggle cursor mode between resize and move
Cursor <- = Grow x
Cursor -> = Shrink x
Cursor v = Grow y
Cursor ^ = Shrink y
Framegrabber setup
b = Brightness -1
n = Brightness +1
c = Chroma -1
v = Chroma +1
y = Contrast -1
x = Contrast +1
d = Hue -1
f = Hue +1
o = Chcv -1
p = Chcv +1
Special commands
0 = (zero) = Save current settings to a configuration file
q = Quit program and exit
Step 2: Start the program. Move the mouse pointer over the area containing the color to be tracked and click the button. Each time the button is pressed, a sample pixel will be taken, analyzed and line printed containing updated min/avg/max-values for Y, U and V. Press several times on different locations of the target region.
Step 3: Quit the program (press 'q') and record the min and max values for Y, U and V. The ranges should be small - large ranges indicate a noisy image with limited color resolution.
Step 4: Repeat Step 2 to 3 for each color. Record number of colors beeing tracked in the configuration file followed by lines with 6 numbers in a line corresponding to 'Ymin Ymax Umin Umax Vmin Vmax'.
A maximum of 10 colors can be entered into the configuration file.
1
0
639
0
479
148
114
74
5
44
1
0.35 0.50 0.0 0.1 -0.17 -0.1
1 = Return X and Y coordinates for first color beeing tracked
2 = Return X and Y coordinates for second color beeing tracked
3 = ...
0= Return X and Y coordinates for the tenth color beeing tracked
l = Close connection (i.e. logoff)
This can be tested easily with the Unix telnet command as shown in the following example:
localhost#> telnet localhost 2002
1<cr>
0.1726 0.1892
l<cr>