Skip to content

Commit

Permalink
Minor documentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
lukacu committed Jan 19, 2017
1 parent aae3072 commit 57b2cb6
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 36 deletions.
36 changes: 18 additions & 18 deletions docs/documentation_c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ Region
... c:macro:: TRAX_REGION_MASK
.. Mask region type. A per-pixel binary mask.
.. Mask region type. A per-pixel binary mask.
.. c:macro:: TRAX_REGION_ANY
Expand Down Expand Up @@ -472,7 +472,7 @@ Region
.. c:function:: trax_bounds trax_region_bounds(const trax_region* region)
Calculates a bounding box region that bounds the input region.
:param region: A pointer to the region object
:return: A bounding box structure that contains values for left, top, right, and bottom
Expand Down Expand Up @@ -500,7 +500,7 @@ Region
:param y: Y coordinate of the point
:return: Returns zero if the point is not in the region or one if it is
.. c:function:: float trax_region_overlap(const trax_region* a, const trax_region* b, const trax_bounds bounds)
Calculates the spatial Jaccard index for two regions (overlap).
Expand All @@ -522,27 +522,27 @@ Region
:param region: A character array with textual representation of the region data
:return: A pointer to the region object or ``NULL`` if string does not contain valid region data
Properties
~~~~~~~~~~
.. c:function:: trax_properties* trax_properties_create()
Create an empty properties dictionary.
:returns: A pointer to a properties object
.. c:function:: void trax_properties_release(trax_properties** properties)
Destroy a properties object and clean up the memory.
:param properties: A pointer to a properties object pointer
.. c:function:: void trax_properties_clear(trax_properties* properties)
Clears a properties dictionary making it empty.
:param properties: A pointer to a properties object
.. c:function:: void trax_properties_set(trax_properties* properties, const char* key, const char* value)
Expand Down Expand Up @@ -572,15 +572,15 @@ Properties
.. c:function:: char* trax_properties_get(const trax_properties* properties, const char* key)
Get a string property. The resulting string is a clone of the one stored so it should be released when not needed anymore.
:param properties: A pointer to a properties object
:param key: A key for the property
:returns: The value for the property or ``NULL`` if there is no value associated with the key
.. c:function:: int trax_properties_get_int(const trax_properties* properties, const char* key, int def)
Get an integer property. A stored string value is converted to an integer. If this is not possible or the property does not exist a given default value is returned.
:param properties: A pointer to a properties object
:param key: A key for the property
:param def: Default value for the property
Expand All @@ -606,34 +606,34 @@ Properties
:param enumerator: A pointer to the enumerator function that is called for every key-value pair
:param object: A pointer to additional data for the enumerator function
Integration tutorial
--------------------
Integration example
-------------------
The library can be easily integrated into C and C++ code (although a C++ wrapper also exists) and can be also linked into other programming languages that enable linking of C libraries. Below is an sripped-down example of a C tracker skeleton with a typical tracking loop. Note that this is not a complete example and servers only as a demonstration of a typical tracker on a tracking-loop level.
.. code-block:: c
:linenos:
#include <stdio.h>
int main( int argc, char** argv)
{
int i;
int i;
FILE* out;
rectangle_type region;
image_type image;
out = fopen("trajectory.txt", "w");
region = read_bounding_box();
image = read_image(1);
image = read_image(1);
region = initialize_tracker(region, image);
write_frame(out, region);
for (i = 2; ; i++)
{
image = read_image(i);
image = read_image(i);
region = update_tracker(image);
write_frame(out, region);
}
Expand All @@ -654,7 +654,7 @@ The code above can be modified to use the TraX protocol by including the C libra
int main( int argc, char** argv)
{
int run = 1;
int run = 1;
trax_image* img = NULL;
trax_region* reg = NULL;
Expand All @@ -670,7 +670,7 @@ The code above can be modified to use the TraX protocol by including the C libra
{
int tr = trax_server_wait(handle, &img, &reg, NULL);
// There are two important commands. The first one is
// There are two important commands. The first one is
// TRAX_INITIALIZE that tells the tracker how to initialize.
if (tr == TRAX_INITIALIZE) {
Expand All @@ -685,7 +685,7 @@ The code above can be modified to use the TraX protocol by including the C libra
rectangle_type region = update_tracker(load_image(img));
trax_server_reply(handle, rectangle_to_region(region), NULL);
}
}
// Any other command is either TRAX_QUIT or illegal, so we exit.
else {
run = 0;
Expand Down
24 changes: 12 additions & 12 deletions docs/documentation_cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The wrapper is composed of several classes, mostly following the underlying C fu

.. cpp:class:: Configuration

A wrapper class for
A wrapper class for

.. cpp:function:: Configuration(trax_configuration config)

Expand All @@ -27,17 +27,17 @@ The wrapper is composed of several classes, mostly following the underlying C fu

.. cpp:function:: ~Configuration()

.. cpp:class:: Logging
.. cpp:class:: Logging

A wrapper class for
A wrapper class for

.. cpp:function:: Logging(trax_logging logging)

.. cpp:function:: Logging(trax_logger callback = NULL, void* data = NULL, int flags = 0)

.. cpp:function:: ~Logging()

.. cpp:class:: Bounds
.. cpp:class:: Bounds

.. cpp:function:: Bounds()

Expand Down Expand Up @@ -120,7 +120,7 @@ The wrapper is composed of several classes, mostly following the underlying C fu
.. cpp:function:: ~Image()

Releases image structure, frees allocated memory.

.. cpp:function:: int type() const

Returns a type of the image handle. See :c:func:`trax_image_get_type`.
Expand Down Expand Up @@ -287,22 +287,22 @@ The wrapper is composed of several classes, mostly following the underlying C fu
Copies values in the properties object into the given dictionary.


Integration tutorial
--------------------
Integration example
-------------------

In C++ tracker implementations you can use either the C++ wrapper or basic C protocol implementation. The wrapper is more conveninent as it is object-oriented and provides automatic deallocation of resources via reference counting. Below is an sripped-down example of a C++ tracker skeleton with a typical tracking loop. Note that this is not a complete example and servers only as a demonstration of a typical tracker on a tracking-loop level.

.. code-block:: c++
:linenos:

#include <iostream>
#include <fstream>

using namescpace std;

int main( int argc, char** argv)
{
int i;
int i;
FILE* out;
Rectangle region;
Image image;
Expand All @@ -319,7 +319,7 @@ In C++ tracker implementations you can use either the C++ wrapper or basic C pro

for (i = 2; ; i++)
{
image = read_image(i);
image = read_image(i);
region = tracker.update(image);
out << region << endl;
}
Expand All @@ -342,7 +342,7 @@ The code above can be modified to use the TraX protocol by including the C/C++ l

int main( int argc, char** argv)
{
int run = 1;
int run = 1;
trax_image* img = NULL;
trax_region* reg = NULL;

Expand All @@ -358,7 +358,7 @@ The code above can be modified to use the TraX protocol by including the C/C++ l

int tr = handle.wait(image, region, properties);

// There are two important commands. The first one is
// There are two important commands. The first one is
// TRAX_INITIALIZE that tells the tracker how to initialize.
if (tr == TRAX_INITIALIZE) {

Expand Down
4 changes: 2 additions & 2 deletions docs/documentation_matlab.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ Internals

Additionaly the function also looks for the ``TRAX_SOCKET`` environmental variable that is used to determine that the server has to be set up using TCP sockers and that a TCP server is opened (the port or IP address and port are proviede as the value of the variable) and waiting for connections from the tracker. This mechanism is important for Matlab on Microsoft Windows because the standard streams are closed at startup and cannot be used.

Integration tutorial
--------------------
Integration example
-------------------

As with all tracker implementations it is important to identify a tracking loop. Below is a very simple example of how a typical tracking loop looks in Matlab/Octave with all the tracker specific code removed and placed in self-explanatory functions.

Expand Down
8 changes: 4 additions & 4 deletions docs/documentation_python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Region module
.. automodule:: trax.region
:members:

Integration tutorial
--------------------
Integration example
-------------------

Below is a simple example of a Python code skeleton for a tracker, exposing its tracking loop but hidding all tracker-specific details to keep things clear.

Expand All @@ -56,7 +56,7 @@ Below is a simple example of a Python code skeleton for a tracker, exposing its
trajectory.append(rectangle)
write_trajectory(trajectory)
To make the tracker work with the TraX protocol you have to modify the above code in the following way and also make sure that the ``trax`` module will be available at runtime.

.. code-block:: python
Expand All @@ -82,4 +82,4 @@ To make the tracker work with the TraX protocol you have to modify the above cod
else:
rectangle = tracker.update(load_image(request.image))
server.status(get_region(rectangle))
server.status(get_region(rectangle))

0 comments on commit 57b2cb6

Please sign in to comment.