ROBTRACK16 Documentation

Andreas Schiffler, ZKM, 1998, 1999.
(schiffler@zkm.de)

Introduction and Method

"robtrack16" is a visual tracking program that uses a segment of 16bit YUV-color-space to locate points in a 2D image. The available tracking colors are determined manually and read from a configuation file. the program returns an x,y coordinate pair in the range between 0.0 and 1.0 for each color beeing tracked. The tracking shapes should be roughly circular for best results, although any shape will work since the "center-of-mass" (average x and y coordinates of all points in one set) is beeing formed. The interface to the results is a standard TCP socket with ASCII in- and output.

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.

Hardware requirements:

 
  • Pentium/PentiumII compatible PC
  • Matrox Meteor (not Meteor/PPB or Meteor/Pro) framegrabber card
  • Linux compatible video card with 4MB RAM
  • Linux compatible network card

  •  

    Software Requirements

     
  • RedHat Linux 5.x Distribution installed (i.e. RH 5.2, see http://www.redhat.com)
  • Linux kernel with "bigphysarea" patch applied
  • Meteor devices created and meteor.o module running
  • XServer running at 16bpp and color weight 555

  •  

    Software Installation Details and Hints

     
  • Install RedHat Linux on system
  • Configure Networking and XServer
  • Apply bigphysarea patch
  • Modify lilo.conf (add image=/vmlinuz, add append="bigphysarea=1024")
  • Reconfigure (select bigphysarea support) and recompile kernel
  • Reboot system
  • Compile meteor module and load it (insmod meteor.o)
  • Check module availability (/sbin/lsmod)
  • Create meteor devices (sh meteor-devs.sh)
  • Compile robtrack16 and start it up while X is running

  •  
    # 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
     

    Command line parameters

    ./robtrack16yuv [-p/-n] [-s/-c] [meteor framegrabber device]
    -p sets PAL mode
    -n sets NTSC mode
    -s sets SVIDEO input
    -c sets COMPOSITE input

    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).
     

    Starting the X-Windows server


    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.

    Keyboard commands

    Active area setup

    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
     

    Generation of configuration file

    Step 1: Start the program and adjust the camera and input settings so that a clear colored image is visible. The colors beeing tracked have to be visible well and show a clear color difference. Save the configuration file (press '0') and exit the program (press'q').

    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.

    Sample configuration file

    Here one color is beeing tracked and the ranges are Y=[0.35,0.5], U=[0.0,0.1] and V=[-0.17,-0.1].

    1
    0
    639
    0
    479
    148
    114
    74
    5
    44
    1
    0.35 0.50 0.0 0.1 -0.17 -0.1
     

    Network commands and syntax

    Open a standard TCP/IP stream socket on port 2002. Send a single ASCII character and New-Line. Receive the information as text line where the first character indicates the type of data send.

    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>