# SwisTrack/Version 3/Using SwisTrack

This page refers to version 3 of SwisTrack. Unless you are still using this old version, you may want to read the documentation of the most recent version of SwisTrack.

# Using SwisTrack

SwisTrack processes the images in various steps, whereas each step can be performed in a particular mode. For instance you can acquire images from device A, segment it with method B, and perform tracking with method C. This choices are independent from each other, e.g. it does not matter whether the image comes from a camera or a video. Rather, every step expects data to be available in a certain format, and produces output accordingly.
The organization of this manual follows the same scheme that SwisTrack uses for image processing, which is summarized in the table below
| Step | Input | Output | Example |
| Input | Any video source (camera or file). | A raw image | |
| Segmenter | A raw image | A binary image with potential targets as white blobs. | |
| Segmenter Post-Processing | A binary image | Segmenter post-processing performs some filtering on the image (erosion/dilution) to get smoother blobs that ease the detection of contours. Also, it is possible to apply a mask image (right) that rejects blobs outside a certain region of the image. | |
| Particle filter | A binary image | A list of contours that fulfill certain criteria (size, shape, etc.). Contours ("particles") that have been rejected are indicated with red circles, whereas accepted contours are indicated with green circles. | |
| Tracker | A list of particles | A list of trajectories | |
| Calibration | A list of trajectories | A list of trajectories (calibrated) | n.a. |
| Output | A list of trajectories | A text file with trajectory coordinates and time stamp. | n.a. |

## Input
### AVI video driver

This mode uses Intel OpenCV's video acquisition features which uses Video for Windows (VfW) codecs for loading AVI and MPEG files. Make sure that you have the correct codec installed, SwisTrack does not work with DirectShow drivers! A good test is to use the software VirtualDub (open source), which allows you to get more specific information about the codec in use.

### CMU 1394 Digital Camera Driver

This mode uses the firewire driver developed at Carnegie Mellon University. Make sure you deinstall the driver that comes with your camera before! There is a little test application shipped with the CMU driver, which allows you to test your camera, and also to make some settings that are not yet accessible from SwisTrack.

### Native Video Driver

This mode makes use of the native video driver of your operating system. Under Windows, this mode allows accessing standard USB cameras ("Webcams"). Under Linux, it should allow accessing Firewire cameras also, which has not been tested yet.

## Segmenter
### Static Background (fixed threshold)

The image is segmented by subtracting a background image of the scene from each video frame. A fixed threshold defines the minimum difference required to count a pixel as not belonging to the background.
This mode is sensible to changes in lighting condition.
Apparently, you need to be careful that the background image has the exact same dimensions of the video file. The bmp exported from SwisTrack itself does not always have the same dimensions.

### Running Average

This mode does not require a background image, which is instead the running average of all video frames processed so far. The parameter alpha specifies the speed of the running average, i.e. the ratio of how much every new frame contributes to the average.
This mode is more capabale when dealing with changing lighting conditions, but is not able to cope with objects that stop moving for a longer period of time as they become part of the background.

### Fixed Color
## Segmenter Post-Processing
## Mask
### No Mask
### Binary Mask

This feature is currently under revision.

## Tracker
### Nearest Neighbor

The option Maximum allowed speed is given in pixels and defines the radius SwisTrack should look for potential targets. 'Maximum allowed speed is not necessary the physical speed of an object but should also take into account scenarios where objects are merged and split afterwards, which induces displacement on the trajectories without that the objects were moving.
The option Can trajectories share a particle? allows you to specify whether trajectories can merge on a single particle (as for instance when two insects are overlapping) or if this behavior is not desired (as for instance when tracking robots equipped with markers).