Last modified on 8 August 2009, at 22:48

SwisTrack/Interfacing SwisTrack/3rd party software

On start-up SwisTrack is listening on port 3000 (i.e. localhost:3000), where it accepts socket connections. Commands can be send as single characters (case sensitive), and are given below. SwisTrack will respond with the ap- propriate action or will send back a string containing the response. It is important that you make sure to read the exact number of bytes from the socket, otherwise messages will get mixed up. The exact number of bytes that you can expect is given for each command.

Server commandsEdit

'p' pauses tracking
'R' starts tracking
's' performs one step
'S' resumes tracking
'!' stops tracker

Server settingsEdit

'c' turns calibration off (default). Every point being sent, be it trajectory data or a blob will be sent in image coordinates.
'C' turns calibration on. Every point being sent, be it trajectory data or a blob will be sent in world coordinates.

Retrieving trajectory dataEdit

't' retrieves data points in an asynchronous fashion. You will always get the latest trajectory data. If your application queries data faster than it is produced by SwisTrack, you will get the same data more than once. If SwisTrack is running at a faster pace, you will eventually loose information. The trajectory data is encoded as tuples of float with fixed precision and preceeding zeros in the format "+####.#### +####.####" (21) characters. Tuples are separated by spaces.
'T' retrieves data points synchronously. Every time, data is requested, SwisTrack will process a single frame. If your application queries frames faster than the framerate supported by the media in use (camera/video), SwisTrack delay packets to be sent out. If your application is running too slow, SwisTrack will skip frames provided by a camera, but not from a video source. The data is encoded as for 't'.
'N' requests the number of tracks being tracked. Data is returned in the format ### (3 characters), with leading zeros if necessary.

Retrieving blob dataEdit

'b' same as 't'. SwisTrack will sent blobs that are preceeded with the number of blobs. The number of blobs is encoded as an integer with format '####', which is imediately followed by the blob string (encoded as in 't').
'B' sames as 'b', but SwisTrack will perform a single step and go into pause mode after (as 'T').
'n' requests the number of blobs being detected. Data is returned in the format ### (3 characters), with leading zeros if necessary.

Retrieving task progressEdit

'i' sends back the current frame number in the format ########## (10 characters)
'I' sends back the tracking progress in the format ##.## (5 characters), given in percent
'f' sends back the current frame rate in the format ##.## (5 characters), given in Hertz

Data FormatEdit

Every point (be it calibrated, or uncalibrated, trajectory, or blob) is sent as fixed precision floating point number in the format "+####.#### +####.####", and thus having a length of 21 characters (including the separating spaces). Points are concatunated to a string. There is no terminating character.