Client library
The client support library provides a C++ client class that uses C++ protocol API to communicate with the tracker process, besides communication the class also takes care of launching tracker process, handling timeouts, logging, and other things. The class also supports setting up communication over streams as well as over TCP sockets. A detailed tutorial on how to use the client library is available here. To compile the module you have to enable BUILD_CLIENT
flag in CMake build system (check out the tutorial on compiling the project for more details).
-
CONNECTION_DEFAULT
Default connection mode, standard input and output streams.
-
CONNECTION_EXPLICIT
Non-standard input and output streams are created, passed to tracker via environment variables
TRAX_IN
andTRAX_OUT
.
-
CONNECTION_SOCKETS
Using TCP socket for communication, connection parameters passed to tracker via environment variable
TRAX_SOCKET
.
-
class TrackerProcess
-
TrackerProcess(const std::string &command, const std::map<string, string> environment, int timeout = 10, trax::ConnectionMode connection = trax::CONNECTION_DEFAULT, VerbosityMode verbosity = trax::VERBOSITY_DEFAULT)
- Parameters:
command – The name of tracker program followed by its input arguments
environment – A map of environmental variables that have to be set for the tracker process
timeout – Number of seconds to wait for tracker’s response before terminating the session
connection – Type of connection, supported are either
CONNECTION_DEFAULT
,CONNECTION_EXPLICIT
, orCONNECTION_SOCKETS
.verbosity – How verbose should the output be
-
~TrackerProcess()
Destroys the process and cleans up data.
-
int image_formats()
- Returns:
A bitset of image formats supported by the tracker.
-
int region_formats()
- Returns:
A bitset of region formats supported by the tracker.
-
bool ready()
- Returns:
True if the tracker process is alive.
-
bool tracking()
- Returns:
True if the tracker process is tracking an object (was initalized).
-
bool initialize(const trax::Image &image, const trax::Region ®ion, const trax::Properties &properties = trax::Properties())
Request tracker initialization with a given image and region.
- Parameters:
image – Input image object
region – Input region object
properties – Optional properties passed to the tracker
- Returns:
True on success, if the function returns false check
trax::TrackerProcess::ready()
if the process has crashed or simply requested termination
-
bool frame(const trax::Image &image, const trax::Properties &properties = trax::Properties())
Request tracker update with a given image.
- Parameters:
image – Input image object
properties – Optional properties passed to the tracker
- Returns:
True on success, if the function returns false check
trax::TrackerProcess::ready()
if the process has crashed or simply requested termination
-
bool wait(trax::Region ®ion, trax::Properties &properties)
Waits for tracker’s response to the previous request (either initialization or update).
- Parameters:
region – Output region object, on success populated with output region
properties – Optional output properties object, populated by returned optional values, if any
- Returns:
True on success, if the function returns false check
trax::TrackerProcess::ready()
if the process has crashed or simply requested termination
-
bool reset()
Restarts the tracker process. The function terminates the tracker process and starts a new one.
-
TrackerProcess(const std::string &command, const std::map<string, string> environment, int timeout = 10, trax::ConnectionMode connection = trax::CONNECTION_DEFAULT, VerbosityMode verbosity = trax::VERBOSITY_DEFAULT)