/boundingBoxToolKit

A toolKit for boundingBoxes; mapping bBoxes to affine transformations, providing context and consistent bBox orientation through time when training trackers.

Primary LanguagePython

boundingBoxToolKit

A toolKit for boundingBoxes; mapping bBoxes to affine transformations, providing context and consistent bBox orientation through time when training trackers.

Usage

To transform a dataSet, it is to be formated like VOT2016 is, ie. the script expects:

  • root contains list.txt listing the relevant directories
  • each directory contains groundtruth.txt, where each line represents a bounding box
    • expected line format: x1,y1,x2,y2,x3,y3,x4,y4

The script

python3 bBoxTransform.py [-h] [-i DIRECTORY] [-d DIRECTORY]
                        [-s resizeX,resizeY] [-c CONTEXTFACTOR] [-r] [-a]
  -h, --help            show this help message and exit
  -i DIRECTORY, --sourceDir DIRECTORY
                        Directory of VOT set
  -d DIRECTORY, --destinationDir DIRECTORY
                        Directory for output file set
  -s resizeX,resizeY, --resize resizeX,resizeY
                        Resize all images and bBoxes to resizeX,resizeY
  -c CONTEXTFACTOR, --addContext CONTEXTFACTOR
                        Scaling factor for the bBox, used to add context
  -r, --reorient        Reorient the boundingBoxes to have consistent
                        orientation through time.
  -a, --affine          Produce the matrix for affine transformation into the
                        boundingBox.

Example: VOT2016

The repository contains ground truth affine transformation matrices for the VOT2016 Challenge bounding boxes (with and without context) and bounding boxes with consistent orientation through time; see ReOrienting the bounding box vertices.

The vot2016 set was produced from the original dataSet by running the script with the following flags:

python bBoxTransform.py -c 1.5 -r -a

exampleGif

The code used to produce the image can be found in makeGif.py.

ReOrienting the bounding box vertices

Let the red dots stand for the vertices of the bounding box in the frame at time t-1 (frame(t-1)), and the blue dots for the vertices of the bounding box in the frame at time t (frame(t)). The number by the vertex signals its position in the list.

In the original VOT set (bellow: frame(1) and frame(2) of example /bag), we see that the bounding boxes in consecutive frames do not match in orientation.

Before

By running the script with the flag -r, this is fixed, as shown by the vertex ordering bellow.

After

Creative Commons License
affineVOTbBox by Žiga Sajovic is licensed under a Creative Commons Attribution 4.0 International License.