Besides protocol implementation the repository also contains supporting libraries that help with some frequently needed functionalities.
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. To compile the module you have to enable
BUILD_CLIENT flag in CMake build system.
Client support module also provides a simple CLI (command line interface) to the client that can be used for simple tracker execution and protocol testing. If the OpenCV support module (below) is also compiled then the CLI interface uses it for some extra conversions that are otherwise not supported (e.g. loading images and sending them in their raw form over the communication channel if the server requests it).
OpenCV is one of most frequently used C++ libraries in computer vision. This support library provides conversion functions so that protocol image and region objects can be quickly converted to corresponding OpenCV objects and vice-versa.
The module is automatically built if the OpenCV library is found on the system, additionally you can also enable it by turning on the
BUILD_OPENCV flag in CMake build system (but you may have to set the OpenCV location manually in this case).
image_to_mat(const Image &image)¶
Converts a protocol image object to an OpenCV matrix that represents the image.
Parameters: image – Protocol image object Returns: OpenCV matrix object
region_to_rect(const Region ®ion)¶
Converts a protocol region object to an OpenCV rectangle structure.
Parameters: image – Protocol region object Returns: OpenCV rectangle structure
region_to_points(const Region ®ion)¶
Converts a protocol region object to a list of OpenCV points.
Parameters: image – Protocol region object Returns: List of points
mat_to_image(const cv::Mat &mat)¶
Converts an OpenCV matrix to a new protocol image object.
Parameters: mat – OpenCV image Returns: Protocol image object
rect_to_region(const cv::Rect rect)¶
Converts an OpenCV rectangle structure to a protocol region object of type rectangle.
Parameters: rect – Rectangle structure Returns: Protocol region object
points_to_region(const std::vector<cv::Point2f> points)¶
Converts a list of OpenCV points to a protocol region object of type polygon.
Parameters: rect – List of points Returns: Protocol region object
draw_region(cv::Mat &canvas, const Region ®ion, cv::Scalar color, int width = 1)¶
Draws a given region to an OpenCV image with a given color and line width.
- canvas – Target OpenCV image to which the region is drawn
- region – Protocol region object
- color – Color of the line as a an OpenCV scalar structure
- width – Width of the line