├── vot-toolkit-master
├── VERSION
├── .dockerignore
├── vot-workspace
│ ├── tracker
│ │ └── kcf
│ │ │ ├── videofig.m
│ │ │ ├── gradientMex.mexa64
│ │ │ ├── gradientMex.mexw64
│ │ │ ├── feature_concatinate.m
│ │ │ ├── linear_correlation.m
│ │ │ ├── polynomial_correlation.m
│ │ │ ├── get_subwindow.m
│ │ │ ├── get_axis_aligned_BB.m
│ │ │ ├── choose_video.m
│ │ │ ├── gaussian_correlation.m
│ │ │ ├── get_features.m
│ │ │ ├── gaussian_shaped_labels.m
│ │ │ ├── precision_plot.m
│ │ │ ├── download_videos.m
│ │ │ ├── external.txt
│ │ │ ├── show_video.m
│ │ │ └── fhog.m
│ ├── run_pack.m
│ └── tracker_KCF.m
├── utilities
│ ├── isascii.m
│ ├── is_octave.m
│ ├── sfigure.m
│ ├── plotc.m
│ ├── mkpath.m
│ ├── iff.m
│ ├── writestruct.m
│ ├── format_interval.m
│ ├── file_newer_than.m
│ ├── gmm_evaluate.m
│ ├── strjoin.m
│ ├── normalise.m
│ ├── readstruct.m
│ ├── strxcmp.m
│ ├── generate_from_template.m
│ ├── json_encode.m
│ ├── delpath.m
│ ├── parsefile.m
│ ├── index.md
│ ├── patch_operation.m
│ ├── export_figure.m
│ ├── md5hash.m
│ ├── compile_mex.m
│ └── relativepath.m
├── .gitignore
├── workspace
│ ├── templates
│ │ ├── run_browse.tpl
│ │ ├── run_test.tpl
│ │ ├── run_pack.tpl
│ │ ├── configuration.tpl
│ │ ├── run_experiments.tpl
│ │ └── run_analysis.tpl
│ ├── print_debug.m
│ ├── print_indent.m
│ ├── print_text.m
│ ├── set_global_variable.m
│ └── get_global_variable.m
├── tracker
│ ├── examples
│ │ ├── native
│ │ │ ├── build.sh
│ │ │ ├── CMakeLists.txt
│ │ │ └── static.cpp
│ │ ├── README.md
│ │ ├── python
│ │ │ ├── python_static.py
│ │ │ └── python_ncc.py
│ │ └── index.md
│ ├── find_tracker.m
│ ├── templates
│ │ ├── tracker.tpl
│ │ ├── tracker_python.tpl
│ │ └── tracker_matlab.tpl
│ ├── valid_identifier.m
│ ├── order_trackers.m
│ ├── estimate_completion_time.m
│ ├── change_trackers_visual_identity.m
│ ├── generate_matlab_command.m
│ ├── calculate_results_fingerprint.m
│ ├── generate_octave_command.m
│ ├── write_manifest.m
│ ├── tracker_test.m
│ ├── is_deterministic.m
│ ├── tracker_create.m
│ ├── set_trackers_visual_identity.m
│ ├── generate_python_command.m
│ ├── tracker_evaluate.m
│ ├── integration.md
│ └── tracker_list.m
├── sequence
│ ├── sequence_get_tags.m
│ ├── get_image.m
│ ├── get_region.m
│ ├── region_offset.m
│ ├── cut_patch.m
│ ├── sequence_reverse.m
│ ├── find_sequence.m
│ ├── get_frame_value.m
│ ├── select_sequence.m
│ ├── sequence_query_tag.m
│ ├── draw_region.m
│ ├── sequence_skipping.m
│ ├── sequence_fragment.m
│ ├── calculate_overlap.m
│ ├── convert_sequences.m
│ ├── sequence_grayscale.m
│ ├── sequence_transform_initialization.m
│ ├── load_sequences.m
│ ├── sequence_resize.m
│ ├── write_trajectory.cpp
│ ├── read_trajectory.cpp
│ └── region_mask.cpp
├── stacks
│ ├── stack_vottir2016.m
│ ├── stack_vot2015.m
│ ├── stack_vottir2015.m
│ ├── stack_vot2016.m
│ ├── stack_test.m
│ ├── stack_vot2017.m
│ ├── stack_vot2014.m
│ ├── stack_vot2013.m
│ └── stack_vot2013_extra.m
├── report
│ ├── templates
│ │ └── report.html
│ ├── create_table_cell.m
│ ├── report_cache.m
│ ├── highlight_best_rows.m
│ ├── tight_subplots.m
│ ├── create_report_context.m
│ ├── generate_timeline.m
│ ├── resources
│ │ ├── css
│ │ │ └── report.css
│ │ └── js
│ │ │ └── layout.js
│ ├── index.md
│ ├── report_sequences_preview.m
│ ├── generate_plot.m
│ ├── generate_ranking_plot.m
│ └── report_ranking_spotlight.m
├── analysis
│ ├── estimate_failures.m
│ ├── adapted_ranks.m
│ ├── index.md
│ ├── normalize_speed.m
│ ├── analyze_failures.m
│ ├── analyze_overlap.m
│ └── estimate_accuracy.m
├── LICENSE.txt
├── toolkit_path.m
├── Dockerfile
├── README.md
├── toolkit_version.m
├── index.md
└── experiment
│ └── experiment_unsupervised.m
└── readme.txt
/vot-toolkit-master/VERSION:
--------------------------------------------------------------------------------
1 | 5.0.2
2 |
--------------------------------------------------------------------------------
/vot-toolkit-master/.dockerignore:
--------------------------------------------------------------------------------
1 | native
2 | build
3 | *~
4 | Dockerfile
5 | .*
6 | appveryor.yml
7 |
--------------------------------------------------------------------------------
/vot-toolkit-master/vot-workspace/tracker/kcf/videofig.m:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YAO1131/vot2015/HEAD/vot-toolkit-master/vot-workspace/tracker/kcf/videofig.m
--------------------------------------------------------------------------------
/vot-toolkit-master/vot-workspace/tracker/kcf/gradientMex.mexa64:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YAO1131/vot2015/HEAD/vot-toolkit-master/vot-workspace/tracker/kcf/gradientMex.mexa64
--------------------------------------------------------------------------------
/vot-toolkit-master/vot-workspace/tracker/kcf/gradientMex.mexw64:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YAO1131/vot2015/HEAD/vot-toolkit-master/vot-workspace/tracker/kcf/gradientMex.mexw64
--------------------------------------------------------------------------------
/vot-toolkit-master/vot-workspace/tracker/kcf/feature_concatinate.m:
--------------------------------------------------------------------------------
1 | features.gray = false;
2 | features.hog = false;
3 | features.hog = true;
4 | features.hog_orientations = 9;
5 | cell_size = 4;
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/isascii.m:
--------------------------------------------------------------------------------
1 | function t = isascii(str)
2 |
3 | if ~ischar(str)
4 | error('Input must be a string');
5 | end;
6 |
7 | t = ~any(str > 127);
8 |
9 | return;
10 | end
11 |
12 |
--------------------------------------------------------------------------------
/vot-toolkit-master/.gitignore:
--------------------------------------------------------------------------------
1 | *~
2 | /native/
3 | cache/
4 | sequences/
5 | tracker/examples/native/build
6 | tracker/examples/native/ncc
7 | tracker/examples/native/static_c
8 | tracker/examples/native/static_cpp
9 | configuration.m
10 | /tracker_*.m
11 | run_analysis.m
12 | run_browse.m
13 | run_experiments.m
14 | run_test.m
15 | testing/
16 | *.pyc
17 |
--------------------------------------------------------------------------------
/vot-toolkit-master/workspace/templates/run_browse.tpl:
--------------------------------------------------------------------------------
1 | % This script can be used to interactively inspect the results
2 |
3 | addpath('{{toolkit}}'); toolkit_path; % Make sure that VOT toolkit is in the path
4 |
5 | [sequences, experiments] = workspace_load();
6 |
7 | trackers = tracker_load('{{tracker}}');
8 |
9 | workspace_browse(trackers, sequences, experiments);
10 |
11 |
--------------------------------------------------------------------------------
/vot-toolkit-master/workspace/templates/run_test.tpl:
--------------------------------------------------------------------------------
1 | % This script can be used to test the integration of a tracker to the
2 | % framework.
3 |
4 | addpath('{{toolkit}}'); toolkit_path; % Make sure that VOT toolkit is in the path
5 |
6 | [sequences, experiments] = workspace_load();
7 |
8 | tracker = tracker_load('{{tracker}}');
9 |
10 | workspace_test(tracker, sequences);
11 |
12 |
--------------------------------------------------------------------------------
/vot-toolkit-master/workspace/templates/run_pack.tpl:
--------------------------------------------------------------------------------
1 | % This script can be used to pack the results and submit them to a challenge.
2 |
3 | addpath('{{toolkit}}'); toolkit_path; % Make sure that VOT toolkit is in the path
4 |
5 | [sequences, experiments] = workspace_load();
6 |
7 | tracker = tracker_load('{{tracker}}');
8 |
9 | workspace_submit(tracker, sequences, experiments);
10 |
11 |
--------------------------------------------------------------------------------
/readme.txt:
--------------------------------------------------------------------------------
1 | This is a simple example to teach you how to use vot2015.
2 | I use KCF algrithom as an example to present you how to merge the KCF with VOT2015.
3 | The KCF algrithom is located at .\vot-toolkit-master\vot-workspace\tracker.
4 | The below website may help you have a good understand of the vot2015 benchmark.
5 | https://blog.csdn.net/yao1131/article/details/78783236#comments#reply#reply#reply
6 |
7 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/is_octave.m:
--------------------------------------------------------------------------------
1 | function [inOctave] = is_octave()
2 | % is_octave Test if in GNU/Octave or Matlab
3 | %
4 | % The function returns true only if it is run in GNU/Octave.
5 | %
6 | % Output:
7 | % - inOctave (boolean): True if run in GUN/Octave, false if run in Matlab.
8 | %
9 |
10 | try
11 | OCTAVE_VERSION;
12 | inOctave = 1;
13 | catch
14 | inOctave = 0;
15 | end
16 |
--------------------------------------------------------------------------------
/vot-toolkit-master/vot-workspace/run_pack.m:
--------------------------------------------------------------------------------
1 | % This script can be used to pack the results and submit them to a challenge.
2 |
3 | addpath('C:\Users\xyd\Desktop\VOT2015-KCF\vot-toolkit-master'); toolkit_path; % Make sure that VOT toolkit is in the path
4 |
5 | [sequences, experiments] = workspace_load();
6 |
7 | tracker = tracker_load('KCF');
8 |
9 | workspace_submit(tracker, sequences, experiments);
10 |
11 |
--------------------------------------------------------------------------------
/vot-toolkit-master/workspace/templates/configuration.tpl:
--------------------------------------------------------------------------------
1 |
2 | set_global_variable('workspace_path', fileparts(mfilename('fullpath')));
3 |
4 | set_global_variable('version', {{version}});
5 |
6 | % Enable more verbose output
7 | % set_global_variable('debug', 1);
8 |
9 | % Disable result caching
10 | % set_global_variable('cache', 0);
11 |
12 | % Select experiment stack
13 | set_global_variable('stack', '{{stack}}');
14 |
--------------------------------------------------------------------------------
/vot-toolkit-master/workspace/print_debug.m:
--------------------------------------------------------------------------------
1 | function print_debug(text, varargin)
2 | % print_debug Prints formatted debug text
3 | %
4 | % Formats and prints text if global debug option is enabled.
5 | %
6 | % Input:
7 | % - text (string): String to print.
8 | % - varargin (cell): Additional arguments that are passed to sprintf.
9 | %
10 |
11 |
12 | if ~get_global_variable('debug', 0)
13 | return;
14 | end;
15 |
16 | print_text(text, varargin{:});
17 |
--------------------------------------------------------------------------------
/vot-toolkit-master/workspace/templates/run_experiments.tpl:
--------------------------------------------------------------------------------
1 | % This script can be used to execute the experiments for a single tracker
2 | % You can copy and modify it to create another experiment launcher
3 |
4 | addpath('{{toolkit}}'); toolkit_path; % Make sure that VOT toolkit is in the path
5 |
6 | [sequences, experiments] = workspace_load();
7 |
8 | tracker = tracker_load('{{tracker}}');
9 |
10 | workspace_evaluate(tracker, sequences, experiments);
11 |
12 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/sfigure.m:
--------------------------------------------------------------------------------
1 | function h = sfigure(h)
2 | % sfigure Silently creates a figure window
3 | %
4 | % Creates a figure window without stealing the focus.
5 | %
6 | % Input:
7 | % - h (integer): Optional id of the figure.
8 | %
9 | % Output:
10 | % - h (integer): Resulting id of the figure.
11 |
12 | if nargin>=1
13 | if ishandle(h)
14 | set(0, 'CurrentFigure', h);
15 | else
16 | h = figure(h);
17 | end
18 | else
19 | h = figure;
20 | end
21 |
--------------------------------------------------------------------------------
/vot-toolkit-master/workspace/print_indent.m:
--------------------------------------------------------------------------------
1 | function print_indent(indent)
2 | % print_indent Modify the indent of the output
3 | %
4 | % Increases of decreases the indent of the output for function print_text.
5 | % Can be used to structure the output in hierarchical calls.
6 | %
7 | % Input:
8 | % - indent (integer): The amount of tabs that the indent is increased (positive) or decreased (negative) for.
9 | %
10 |
11 | set_global_variable('indent', get_global_variable('indent', 0) + indent);
12 |
13 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/examples/native/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | OPENCV_INCLUDES=/usr/include/opencv
4 | TRAX_INCLUDES=../../../native
5 | TRAX_LIBRARY=../../../native
6 |
7 | gcc static.c -I$TRAX_INCLUDES -L$TRAX_LIBRARY -ltraxstatic -g -o static_c
8 |
9 | g++ static.cpp -I$TRAX_INCLUDES -L$TRAX_LIBRARY -ltraxstatic -g -o static_cpp
10 |
11 | g++ ncc.cpp -I$OPENCV_INCLUDES -I$TRAX_INCLUDES -L$TRAX_LIBRARY -ltraxstatic -lopencv_core -lopencv_video -lopencv_imgproc -lopencv_highgui -g -o ncc
12 |
13 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/plotc.m:
--------------------------------------------------------------------------------
1 | function plotc(x, y, varargin)
2 | % plotc Plot closed polygon
3 | %
4 | % Plot a closed polygon (line between first and last point) on the current figure.
5 | %
6 | % Input:
7 | % - x (double vector): A vector of x coordinates of a polygon
8 | % - y (double vector): A vector of y coordinates of a polygon
9 | % - varargin (cell): Additional arguments that are passed to the plot function.
10 | %
11 |
12 |
13 | x = [x(:); x(1)];
14 | y = [y(:); y(1)];
15 |
16 | plot(x, y, varargin{:});
17 |
18 | end
19 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/sequence_get_tags.m:
--------------------------------------------------------------------------------
1 | function [tags] = sequence_get_tags(sequence, index)
2 | % sequence_get_tags Returns all tags for a given frame
3 | %
4 | % Input:
5 | % - sequence (structure): A valid sequence structure.
6 | % - index (integer): A index of a frame.
7 | %
8 | % Output:
9 | % - tags (cell): A cell array of strings. Names of tags for the given frame.
10 |
11 | if (sequence.length < index || index < 1)
12 | tags = {};
13 | else
14 | tags = sequence.tags.names(logical(sequence.tags.data(index, :)));
15 | end;
16 |
17 |
18 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/get_image.m:
--------------------------------------------------------------------------------
1 | function [image_path] = get_image(sequence, index)
2 | % image_path Returns image path for the given sequence
3 | %
4 | % Input:
5 | % - sequence: A valid sequence structure.
6 | % - index: A index of a frame.
7 | %
8 | % Output:
9 | % - image_path: An image parh for the requested frame or an empty matrix if the frame number is invalid.
10 |
11 | if (sequence.length < index || index < 1)
12 | image_path = [];
13 | else
14 | image_path = fullfile(sequence.directory, sequence.images{index});
15 | end;
16 |
17 |
18 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/examples/README.md:
--------------------------------------------------------------------------------
1 | Tracker integration examples
2 | ============================
3 |
4 | This folder contains several examples of tracker integration for C/C++, Matlab, and Python trackers. Helpers for all languages are provided so that integration is as easy as adding a few lines of code to your tracker source code. For C/C++ three example trackers are provided in the `native` directory, for Matlab an example tracker is in the `matlab` directory, and for Python in the `python` directory. More information can be found in the [documentation](index.md).
5 |
6 |
--------------------------------------------------------------------------------
/vot-toolkit-master/stacks/stack_vottir2016.m:
--------------------------------------------------------------------------------
1 | function experiments = stack_vottir2016()
2 |
3 | set_global_variable('bundle', 'http://data.votchallenge.net/vot2016/vot-tir2016.zip');
4 |
5 | baseline.name = 'baseline';
6 | baseline.converter = [];
7 | baseline.type = 'supervised';
8 | baseline.tags = {'camera_motion', 'dynamics_change', 'occlusion', 'size_change', 'motion_change', 'empty'};
9 |
10 | baseline.parameters.repetitions = 15;
11 | baseline.parameters.burnin = 10;
12 | baseline.parameters.skip_initialize = 5;
13 | baseline.parameters.failure_overlap = 0;
14 |
15 | experiments = {baseline};
16 |
17 | end
18 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/mkpath.m:
--------------------------------------------------------------------------------
1 | function [result] = mkpath(filepath)
2 | % mkpath Creates a directory path
3 | %
4 | % Creates a given path by recurively adding directories.
5 | %
6 | % Input:
7 | % - filepath (string): A path to create.
8 | %
9 | % Output:
10 | % - result (boolean): True if successful.
11 | %
12 |
13 |
14 | if exist(filepath) == 2
15 | result = 0;
16 | return;
17 | end;
18 |
19 | if exist(filepath) == 7
20 | result = 1;
21 | return;
22 | end;
23 |
24 | result = mkpath(fileparts(filepath));
25 |
26 | if ~result
27 | return;
28 | end;
29 |
30 | result = mkdir(filepath);
31 |
32 |
--------------------------------------------------------------------------------
/vot-toolkit-master/report/templates/report.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{title}} (VOT toolkit report)
5 | {{head}}
6 |
7 |
8 |
{{title}}
9 | {{body}}
10 |
11 |
12 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/vot-toolkit-master/vot-workspace/tracker/kcf/linear_correlation.m:
--------------------------------------------------------------------------------
1 | function kf = linear_correlation(xf, yf)
2 | %LINEAR_CORRELATION Linear Kernel at all shifts, i.e. correlation.
3 | % Computes the dot-product for all relative shifts between input images
4 | % X and Y, which must both be MxN. They must also be periodic (ie.,
5 | % pre-processed with a cosine window). The result is an MxN map of
6 | % responses.
7 | %
8 | % Inputs and output are all in the Fourier domain.
9 | %
10 | % Joao F. Henriques, 2014
11 | % http://www.isr.uc.pt/~henriques/
12 |
13 | %cross-correlation term in Fourier domain
14 | kf = sum(xf .* conj(yf), 3) / numel(xf);
15 |
16 | end
17 |
18 |
--------------------------------------------------------------------------------
/vot-toolkit-master/report/create_table_cell.m:
--------------------------------------------------------------------------------
1 | function [table_cell] = create_table_cell(text, varargin)
2 | % create_table_cell Create a complex table cell structure
3 | %
4 | % An utility function that creates a structure that describes a complex
5 | % table cell with styling and span.
6 | %
7 | % Input:
8 | % - text (string): Text in a cell.
9 | % - varargin (cell): Key-value pairs of additional arguments.
10 | %
11 | % Output:
12 | % - table_cell (struct): A cell descriptor.
13 | %
14 |
15 |
16 | if ~isstruct(text)
17 | table_cell = struct('text', text, varargin{:});
18 | else
19 | table_cell = struct(varargin{:});
20 | table_cell = struct_merge(table_cell, text);
21 | end;
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/iff.m:
--------------------------------------------------------------------------------
1 | function result = iff(condition, ontrue, onfalse)
2 | % iff A simulation of inline conditional statement
3 | %
4 | % This function simulates a single line conditional statement. Based on the state of the first
5 | % argument it returns either second or third one.
6 | %
7 | % Input:
8 | % - condition (boolean): Condition variable.
9 | % - ontrue: Value to return if condition is true.
10 | % - onfalse: Value to return if condition is false.
11 | %
12 | % Output:
13 | % - result: Either the value of second or third argument.
14 | %
15 |
16 |
17 | narginchk(3,3);
18 |
19 | if condition
20 | result = ontrue;
21 | else
22 | result = onfalse;
23 | end
24 |
--------------------------------------------------------------------------------
/vot-toolkit-master/analysis/estimate_failures.m:
--------------------------------------------------------------------------------
1 | function [count, failures] = estimate_failures(trajectory, sequence)
2 | % estimate_failures Computes number of failures score
3 | %
4 | % Scans the trajectory for instances of tracker failure and returns the number of failures.
5 | %
6 | % Input:
7 | % - trajectory (cell): A trajectory as a cell array of regions.
8 | % - sequence (cell): A valid sequence descriptor.
9 | %
10 | % Output:
11 | % - count (integer): Number of failures
12 | % - failures (integer vector): Indices of frames where the tracker failed
13 | %
14 |
15 | failures = find(cellfun(@(x) numel(x) == 1 && x == 2, trajectory, 'UniformOutput', true));
16 |
17 | count = numel(failures);
18 |
19 |
--------------------------------------------------------------------------------
/vot-toolkit-master/stacks/stack_vot2015.m:
--------------------------------------------------------------------------------
1 | function experiments = stack_vot2015()
2 |
3 | set_global_variable('bundle', 'http://data.votchallenge.net/vot2015/vot2015.zip');
4 | set_global_variable('legacy_rasterization', true);
5 | set_global_variable('bounded_overlap', false);
6 |
7 | baseline.name = 'baseline';
8 | baseline.converter = [];
9 | baseline.type = 'supervised';
10 | baseline.tags = {'camera_motion', 'illum_change', 'occlusion', 'size_change', 'motion_change', 'empty'};
11 |
12 | baseline.parameters.repetitions = 15;
13 | baseline.parameters.burnin = 10;
14 | baseline.parameters.skip_initialize = 5;
15 | baseline.parameters.failure_overlap = 0;
16 |
17 | experiments = {baseline};
18 |
19 | end
20 |
21 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/get_region.m:
--------------------------------------------------------------------------------
1 | function region = get_region(sequence, index)
2 | % get_region Returns region, or multiple regions for the given sequence
3 | %
4 | % Input:
5 | % - sequence: A valid sequence structure.
6 | % - index: A index of a frame or a vector of indices of frames.
7 | %
8 | % Output
9 | % - region: A region description matrix or a cell array of region description matrices if more than one frame was requested.
10 |
11 | if nargin == 1
12 |
13 | region = sequence.groundtruth;
14 |
15 | else
16 |
17 | if numel(index) == 1
18 | region = sequence.groundtruth{index};
19 | else
20 | region = sequence.groundtruth(index);
21 | end;
22 |
23 | end;
24 |
25 |
26 |
--------------------------------------------------------------------------------
/vot-toolkit-master/stacks/stack_vottir2015.m:
--------------------------------------------------------------------------------
1 | function experiments = stack_vottir2015()
2 |
3 | set_global_variable('bundle', 'http://www.cvl.isy.liu.se/research/datasets/ltir/version1.0/ltir_v1_0_8bit.zip');
4 | set_global_variable('legacy_rasterization', true);
5 | set_global_variable('bounded_overlap', false);
6 |
7 | baseline.name = 'baseline';
8 | baseline.converter = [];
9 | baseline.type = 'supervised';
10 | baseline.tags = {'camera_motion', 'illum_change', 'occlusion', 'size','motion', 'empty'};
11 |
12 | baseline.parameters.repetitions = 15;
13 | baseline.parameters.burnin = 10;
14 | baseline.parameters.skip_initialize = 5;
15 | baseline.parameters.failure_overlap = 0;
16 |
17 | experiments = {baseline};
18 |
19 | end
20 |
21 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/region_offset.m:
--------------------------------------------------------------------------------
1 | function [region] = region_offset(region, offset)
2 | % region_offset Translates the region
3 | %
4 | % Translates the region by a given offset and returns the transformed region.
5 | %
6 | % Input:
7 | % - region (double): A valid region.
8 | % - offset (double): A `2x1` vector that denotes the `x` and `y` coordinate of the translation
9 | %
10 | % Output:
11 | % - region: Resulting region.
12 |
13 | if isnumeric(region)
14 | if numel(region) == 4
15 |
16 | region(1:2) = region(1:2) + offset;
17 |
18 | elseif numel(region) >= 6 && mod(numel(region), 2) == 0
19 |
20 | region = region + repmat(offset(:)', 1, numel(region) / 2);
21 |
22 | end;
23 |
24 | end;
25 |
26 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/writestruct.m:
--------------------------------------------------------------------------------
1 | function writestruct(filename, s)
2 | % writestruct Store a structure to file
3 | %
4 | % Saves a single level structure to a text file in an INI-like format.
5 | %
6 | % Input:
7 | % - filename (string): Path to the file.
8 | % - s (structure): A single-level structure.
9 | %
10 |
11 |
12 | % Extract field data
13 | fields = repmat(fieldnames(s), numel(s), 1);
14 | values = struct2cell(s);
15 |
16 | % Convert all numerical values to strings
17 | idx = cellfun(@isnumeric, values);
18 | values(idx) = cellfun(@num2str, values(idx), 'UniformOutput', 0);
19 |
20 | fid = fopen(filename, 'w');
21 |
22 | cellfun(@(x, y) fprintf(fid, '%s=%s\n', x, y) , fields, values, 'UniformOutput', 0);
23 |
24 | fclose(fid);
25 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/format_interval.m:
--------------------------------------------------------------------------------
1 | function string = format_interval(time)
2 | % format_interval Format a time interval
3 | %
4 | % Formats a given time interval in seconds to a string containing
5 | % days, hours and minutes.
6 | %
7 | % Input:
8 | % - time (dobule): A numeric representation of time interval in seconds.
9 | %
10 | % Output:
11 | % - string (string): A string representation of the interval
12 | %
13 |
14 |
15 | days = floor(time / (24*60*60));
16 |
17 | time = time - days * (24*60*60);
18 |
19 | hours = floor(time / (60*60));
20 |
21 | time = time - hours * (60*60);
22 |
23 | minutes = floor(time / (60));
24 |
25 | %time = time - minutes * (60);
26 |
27 | string = sprintf('%d days %d hours %d minutes', days, hours, minutes);
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/examples/native/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | PROJECT(static)
2 | CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
3 |
4 | # Try to find TraX header and library ...
5 | FIND_PACKAGE(trax REQUIRED COMPONENTS core)
6 | LINK_DIRECTORIES(${TRAX_LIBRARY_DIRS})
7 | LINK_LIBRARIES(${TRAX_LIBRARIES})
8 | INCLUDE_DIRECTORIES(AFTER ${TRAX_INCLUDE_DIRS})
9 |
10 | ADD_EXECUTABLE(static_c static.c) # Generate executable for C tracker
11 | ADD_EXECUTABLE(static_cpp static.cpp) # Generate executable for C++ tracker
12 |
13 | FIND_PACKAGE(OpenCV)
14 |
15 | IF (OpenCV_FOUND)
16 | ADD_EXECUTABLE(ncc ncc.cpp) # Generate executable for C tracker
17 | INCLUDE_DIRECTORIES(AFTER ${OpenCV_INCLUDE_DIRS})
18 | TARGET_LINK_LIBRARIES(ncc ${OpenCV_LIBS}) # Link with trax library
19 | ENDIF()
20 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/file_newer_than.m:
--------------------------------------------------------------------------------
1 | function answer = file_newer_than(candidate, original)
2 | % file_newer_than Test if the first file is newer than the second file
3 | %
4 | % Test if the first file is newer than the second file.
5 | %
6 | % Input:
7 | % - candidate (string): Path to the first file.
8 | % - original (string): Path to the second file.
9 | %
10 | % Output:
11 | % - answer (boolean): True if the first file is newer than the second one.
12 | %
13 |
14 |
15 | candidate_metadata = dir(candidate);
16 | original_metadata = dir(original);
17 |
18 | if size(original_metadata, 1) ~= 1 || size(candidate_metadata, 1) ~= 1
19 | answer = 0;
20 | return;
21 | end;
22 |
23 | answer = original_metadata.datenum <= candidate_metadata.datenum;
24 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/cut_patch.m:
--------------------------------------------------------------------------------
1 | function [patch] = cut_patch(image, region)
2 | % cut_patch extract smaller patch defined by region from an image
3 | %
4 | % Input:
5 | % - image (matrix): n-dimensional WxH image
6 | % - region (vector): axis-align bounding box defined as [top_left_x top_left_y width height]
7 | %
8 | % Output: (computed attributes are store in local file system)
9 | % - patch (matrix): n-dimensional widthxheight image region
10 |
11 | region = round(region);
12 |
13 | x1 = max(1, region(1)+1);
14 | y1 = max(1, region(2)+1);
15 | x2 = min(size(image, 2), region(1)+region(3)+1);
16 | y2 = min(size(image, 1), region(2)+region(4)+1);
17 |
18 | if (size(image, 3) > 1)
19 | patch = image(y1:y2, x1:x2, :);
20 | else
21 | patch = image(y1:y2, x1:x2);
22 | end;
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/sequence_reverse.m:
--------------------------------------------------------------------------------
1 | function reversed_sequence = sequence_reverse(sequence)
2 | % sequence_reverse Returns reverse sequence
3 | %
4 | % This sequence converter returns a sequence with all its frames reversed.
5 | %
6 | % Input:
7 | % - sequence (structure): A valid sequence structure.
8 | %
9 | % Output:
10 | % - reversed_sequence (structure): A sequence descriptor of a converted sequence.
11 |
12 | reversed_sequence = sequence;
13 | reversed_sequence.groundtruth = sequence.groundtruth(end:-1:1);
14 | reversed_sequence.indices = sequence.indices(end:-1:1);
15 | reversed_sequence.images = sequence.images(end:-1:1);
16 | reversed_sequence.tags.data = sequence.tags.data(end:-1:1, :);
17 | reversed_sequence.values.data = sequence.values.data(end:-1:1, :);
18 |
19 |
--------------------------------------------------------------------------------
/vot-toolkit-master/workspace/print_text.m:
--------------------------------------------------------------------------------
1 | function print_text(text, varargin)
2 | % print_debug Prints formatted text
3 | %
4 | % Formats and prints text taking into account the indent level that can be adjusted using print_indent function.
5 | %
6 | % Input:
7 | % - text (string): String to print.
8 | % - varargin (cell): Additional arguments that are passed to sprintf.
9 | %
10 |
11 | indent = get_global_variable('indent', 0);
12 |
13 | if indent > 0
14 | fprintf(repmat(sprintf(' '), 1, indent));
15 | end;
16 |
17 | if ispc
18 | text = strrep(text, '\', '\\');
19 | end
20 |
21 | if nargin > 1
22 | fprintf([text, '\n'], varargin{:});
23 | else
24 | fprintf([text, '\n']);
25 | end;
26 |
27 | if is_octave()
28 | fflush(stdout);
29 | else
30 | drawnow('update');
31 | end;
32 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/find_sequence.m:
--------------------------------------------------------------------------------
1 | function [index, sequence] = find_sequence(sequences, name)
2 | % find_sequence Find a sequence by its name
3 | %
4 | % Find a sequence by its name in a cell array of sequence structures. Returns index of sequence and its structure.
5 | % If a sequence is not found the function returns an empty matrix.
6 | %
7 | % Input:
8 | % - sequences: Cell array of sequence structures.
9 | % - name: A string containing sequence namer.
10 | %
11 | % Output:
12 | % - index: Index of the sequence in the cell array or empty matrix if not found.
13 | % - sequence: The sequence structure.
14 |
15 | index = find(cellfun(@(t) strcmp(t.name, name), sequences, 'UniformOutput', true), 1);
16 |
17 | if isempty(index)
18 | sequence = [];
19 | else
20 | sequence = sequences{index};
21 | end;
22 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/gmm_evaluate.m:
--------------------------------------------------------------------------------
1 | function p = gmm_evaluate(model, X)
2 | % gmm_evaluate Evaluates the GMM for a set of points
3 | %
4 | % Input:
5 | % - model (struct): A gaussian mixture model structure
6 | % - X (matrix): Points for which to evaluate the model
7 | %
8 | % Output:
9 | % - p (vector): values for corresponding points
10 | %
11 |
12 | [d, numData] = size(X);
13 | p = zeros(1,numData);
14 | for i = 1 : length(model.w)
15 | iS = chol(inv(model.Cov{i}));
16 | logdetiS = sum(log(diag(iS)));
17 | logConstant = (logdetiS -0.5 * d * 1.83787706640935); % log2pi = 1.83787706640935
18 | dx = X - repmat(model.Mu(:,i), 1, numData);
19 | dx = iS * dx;
20 | pl = logConstant - 0.5 * sum(dx .* dx, 1);
21 | p_tmp = exp(pl);
22 | p = p + model.w(i) * p_tmp;
23 | end
24 |
25 |
26 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/get_frame_value.m:
--------------------------------------------------------------------------------
1 | function [value] = get_frame_value(sequence, key, index)
2 | % get_frame_value Returns frame values for the given sequence
3 | %
4 | % Input:
5 | % - sequence (structure): A valid sequence structure.
6 | % - key (string): Key of a value.
7 | % - index (integer, optional): A index of a frame or a vector of frames. If not present the entire sequence is assumed.
8 | %
9 | % Output:
10 | % - value: A vector of values for corresponing frames.
11 |
12 | value_index = find(strcmp(sequence.values.names, key), 1);
13 |
14 | if isempty(value_index)
15 | value = [];
16 | return;
17 | end;
18 |
19 | if nargin == 2
20 |
21 | value = sequence.values.data(:, value_index);
22 |
23 | else
24 |
25 | value = sequence.values.data(index, value_index);
26 |
27 | end;
28 |
29 |
30 |
--------------------------------------------------------------------------------
/vot-toolkit-master/LICENSE.txt:
--------------------------------------------------------------------------------
1 | VOT toolkit - The official evaluation toolkit for the Visual Object
2 | Tracking (VOT) challenge.
3 |
4 | Copyright (C) 2013 VOT Challenge Group
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/find_tracker.m:
--------------------------------------------------------------------------------
1 | function [index, tracker] = find_tracker(trackers, identifier)
2 | % find_tracker Find a tracker by its identifier
3 | %
4 | % Find a tracker by its identifier in a cell array of tracker structures. Returns index of tracker and its structure.
5 | % If a tracker is not found the function returns an empty matrix.
6 | %
7 | % Input:
8 | % - trackers: Cell array of tracker structures.
9 | % - identifiers: A string containing tracker identifier.
10 | %
11 | % Output:
12 | % - index: Index of the tracker in the cell array or empty matrix if not found.
13 | % - tracker: The tracker structure.
14 |
15 | index = find(cellfun(@(t) strcmp(t.identifier, identifier), trackers, 'UniformOutput', true), 1);
16 |
17 | if isempty(index)
18 | tracker = [];
19 | else
20 | tracker = trackers{index};
21 | end;
22 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/strjoin.m:
--------------------------------------------------------------------------------
1 | function joined = strjoin(tokens, delimiter)
2 | % strjoin Joins multiple strings
3 | %
4 | % Joins a cell array of strings in a single string with a given delimiter in between.
5 | %
6 | % Input:
7 | % - tokens (cell): A cell array of strings.
8 | % - delimiter (string): A delimiter string.
9 | %
10 | % Output:
11 | % - joined (string): Joined string.
12 | %
13 |
14 | if nargin < 2
15 | delimiter = ' ';
16 | end;
17 |
18 | if ~iscell(tokens)
19 | joined = tokens;
20 | return;
21 | end;
22 |
23 | if isempty(tokens)
24 | joined = '';
25 | return;
26 | end;
27 |
28 | tokens = tokens(:)';
29 |
30 | if numel(tokens) == 1
31 | joined = tokens{1};
32 | return;
33 | end;
34 |
35 | joined = cellfun(@(x) [delimiter, x], tokens(2:end), 'UniformOutput', false);
36 | joined = [tokens{1} joined{:}];
37 |
38 |
--------------------------------------------------------------------------------
/vot-toolkit-master/toolkit_path.m:
--------------------------------------------------------------------------------
1 | function paths = toolkit_path()
2 | % toolkit_path Appends all toolkit directories to the Matlab path
3 | %
4 | % If no output argument is given, the function appends all toolkit directories
5 | % to the Matlab/Octave path, otherwise it returns a list as a cell array.
6 | %
7 | % Output:
8 | % - paths (cell): A list of all paths.
9 |
10 | script_directory = fileparts(mfilename('fullpath'));
11 | include_dirs = cellfun(@(x) fullfile(script_directory, x), {'', 'utilities', ...
12 | 'workspace', 'tracker', 'sequence', 'stacks' ,'report', 'analysis', ...
13 | 'experiment'}, 'UniformOutput', false);
14 |
15 | if exist(fullfile(script_directory, 'native'), 'dir')
16 | include_dirs{end+1} = fullfile(script_directory, 'native');
17 | end
18 |
19 | if nargout > 0
20 | paths = include_dirs;
21 | else
22 | addpath(include_dirs{:});
23 | end;
24 |
25 |
26 |
--------------------------------------------------------------------------------
/vot-toolkit-master/report/report_cache.m:
--------------------------------------------------------------------------------
1 | function result = report_cache(context, identifier, fun, varargin)
2 | % report_cache Cache proxy for report generation
3 | %
4 | % Can be used with report context to cache results of a certain function.
5 | %
6 | % Input:
7 | % - context (structure): Report context structure.
8 | % - identifier (string): Caching identifier.
9 | % - fun (handle): Handle to processing function.
10 | % - varargin (cell): Arguments for processing function.
11 | %
12 | % Output:
13 | % - result: Output argument of the processing function.
14 | %
15 | cache_file = fullfile(context.cachedir, sprintf('%s.mat', identifier));
16 |
17 | result = {};
18 | if exist(cache_file, 'file')
19 | load(cache_file);
20 | end;
21 |
22 | if isempty(result)
23 |
24 | clear result;
25 |
26 | result = fun(varargin{:});
27 |
28 | save(cache_file, 'result');
29 |
30 | end;
31 |
32 |
--------------------------------------------------------------------------------
/vot-toolkit-master/vot-workspace/tracker/kcf/polynomial_correlation.m:
--------------------------------------------------------------------------------
1 | function kf = polynomial_correlation(xf, yf, a, b)
2 | %POLYNOMIAL_CORRELATION Polynomial Kernel at all shifts, i.e. kernel correlation.
3 | % Evaluates a polynomial kernel with constant A and exponent B, for all
4 | % relative shifts between input images XF and YF, which must both be MxN.
5 | % They must also be periodic (ie., pre-processed with a cosine window).
6 | % The result is an MxN map of responses.
7 | %
8 | % Inputs and output are all in the Fourier domain.
9 | %
10 | % Joao F. Henriques, 2014
11 | % http://www.isr.uc.pt/~henriques/
12 |
13 | %cross-correlation term in Fourier domain
14 | xyf = xf .* conj(yf);
15 | xy = sum(real(ifft2(xyf)), 3); %to spatial domain
16 |
17 | %calculate polynomial response for all positions, then go back to the
18 | %Fourier domain
19 | kf = fft2((xy / numel(xf) + a) .^ b);
20 |
21 | end
22 |
23 |
--------------------------------------------------------------------------------
/vot-toolkit-master/stacks/stack_vot2016.m:
--------------------------------------------------------------------------------
1 | function experiments = stack_vot2016()
2 |
3 | set_global_variable('bundle', 'http://data.votchallenge.net/vot2016/vot2016.zip');
4 |
5 | baseline.name = 'baseline';
6 | baseline.converter = [];
7 | baseline.type = 'supervised';
8 | baseline.tags = {'camera_motion', 'illum_change', 'occlusion', 'size_change', 'motion_change', 'empty'};
9 |
10 | baseline.parameters.repetitions = 15;
11 | baseline.parameters.burnin = 10;
12 | baseline.parameters.skip_initialize = 5;
13 | baseline.parameters.failure_overlap = 0;
14 |
15 | unsupervised.name = 'unsupervised';
16 | unsupervised.converter = [];
17 | unsupervised.type = 'unsupervised';
18 | unsupervised.tags = {'camera_motion', 'illum_change', 'occlusion', 'size_change', 'motion_change', 'empty'};
19 |
20 | unsupervised.parameters.repetitions = 1;
21 | unsupervised.parameters.burnin = 0;
22 |
23 | experiments = {baseline, unsupervised};
24 |
25 | end
26 |
27 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/templates/tracker.tpl:
--------------------------------------------------------------------------------
1 |
2 | error('Tracker not configured! Please edit the tracker_{{tracker}}.m file.'); % Remove this line after proper configuration
3 |
4 | % The human readable label for the tracker, used to identify the tracker in reports
5 | % If not set, it will be set to the same value as the identifier.
6 | % It does not have to be unique, but it is best that it is.
7 | tracker_label = [];
8 |
9 | % Now you have to set up the system command to be run.
10 | % For classical executables this is usually just a full path to the executable plus
11 | % optional arguments:
12 |
13 | tracker_command = '';
14 |
15 | % tracker_interpreter = []; % Set the interpreter used here as a lower case string. E.g. if you are using Matlab, write 'matlab'. (optional)
16 |
17 | % tracker_linkpath = {}; % A cell array of custom library directories used by the tracker executable (optional)
18 |
19 |
--------------------------------------------------------------------------------
/vot-toolkit-master/vot-workspace/tracker/kcf/get_subwindow.m:
--------------------------------------------------------------------------------
1 | function out = get_subwindow(im, pos, sz)
2 | %GET_SUBWINDOW Obtain sub-window from image, with replication-padding.
3 | % Returns sub-window of image IM centered at POS ([y, x] coordinates),
4 | % with size SZ ([height, width]). If any pixels are outside of the image,
5 | % they will replicate the values at the borders.
6 | %
7 | % Joao F. Henriques, 2014
8 | % http://www.isr.uc.pt/~henriques/
9 |
10 | if isscalar(sz), %square sub-window
11 | sz = [sz, sz];
12 | end
13 |
14 | xs = floor(pos(2)) + (1:sz(2)) - floor(sz(2)/2);
15 | ys = floor(pos(1)) + (1:sz(1)) - floor(sz(1)/2);
16 |
17 | %check for out-of-bounds coordinates, and set them to the values at
18 | %the borders
19 | xs(xs < 1) = 1;
20 | ys(ys < 1) = 1;
21 | xs(xs > size(im,2)) = size(im,2);
22 | ys(ys > size(im,1)) = size(im,1);
23 |
24 | %extract image
25 | out = im(ys, xs, :);
26 |
27 | end
28 |
29 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/select_sequence.m:
--------------------------------------------------------------------------------
1 | function [selected_sequence] = select_sequence(sequences)
2 | % select_sequence Select sequence from a list interactively
3 | %
4 | % The function provides an interactive interface for selecting a sequence from
5 | % a given array of sequence descriptor structures.
6 | %
7 | % Input:
8 | % - sequences (cell or structure): Array of sequence structures.
9 | %
10 | % Output:
11 | % - selected_sequence (integer): An integer of a selected sequence in the array or an empty matrix.
12 | %
13 |
14 |
15 | print_text('Choose a sequence:');
16 | print_indent(1);
17 |
18 | for i = 1:length(sequences)
19 | print_text('%d - "%s"', i, sequences{i}.name);
20 | end;
21 |
22 | print_indent(-1);
23 |
24 | option = input('Selected sequence: ', 's');
25 |
26 | selected_sequence = int32(str2double(option));
27 |
28 | if isempty(selected_sequence) || selected_sequence < 1 || selected_sequence > length(sequences)
29 | selected_sequence = [];
30 | end;
31 |
--------------------------------------------------------------------------------
/vot-toolkit-master/workspace/set_global_variable.m:
--------------------------------------------------------------------------------
1 | function set_global_variable(name, value)
2 | % set_global_variable Set a workspace global variable
3 | %
4 | % Set a global variable in a current workspace storage. If a value argument
5 | % is not given, the variable will be cleared from the storage.
6 | %
7 | % If a structure is given instead of the name then its fields are used to
8 | % set global variables.
9 | %
10 | % Input:
11 | % - name (string): Name of the variable.
12 | % - value (any): New value or the variable.
13 | %
14 |
15 | global global_variables;
16 |
17 | if isempty(global_variables);
18 | global_variables = struct();
19 | end;
20 |
21 | if nargin == 1
22 | if isstruct(name)
23 | global_variables = struct_merge(name, global_variables);
24 | else
25 | if isfield(global_variables, name)
26 | global_variables = rmfield(global_variables, name);
27 | end;
28 | end;
29 | else
30 | global_variables.(name) = value;
31 | end;
32 |
33 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/normalise.m:
--------------------------------------------------------------------------------
1 | function [M, z] = normalise(A, dim)
2 | % NORMALISE Make the entries of a (multidimensional) array sum to 1
3 | % [M, c] = normalise(A)
4 | % c is the normalizing constant
5 | %
6 | % [M, c] = normalise(A, dim)
7 | % If dim is specified, we normalise the specified dimension only,
8 | % otherwise we normalise the whole array.
9 |
10 | if nargin < 2
11 | z = sum(A(:));
12 | % Set any zeros to one before dividing
13 | % This is valid, since c=0 => all i. A(i)=0 => the answer should be 0/1=0
14 | s = z + (z==0);
15 | M = A / s;
16 | elseif dim==1 % normalize each column
17 | z = sum(A);
18 | s = z + (z==0);
19 | %M = A ./ (d'*ones(1,size(A,1)))';
20 | M = A ./ repmatC(s, size(A,1), 1);
21 | else
22 | % Keith Battocchi - v. slow because of repmat
23 | z=sum(A,dim);
24 | s = z + (z==0);
25 | L=size(A,dim);
26 | d=length(size(A));
27 | v=ones(d,1);
28 | v(dim)=L;
29 | %c=repmat(s,v);
30 | c=repmat(s,v');
31 | M=A./c;
32 | end
33 |
34 |
35 |
--------------------------------------------------------------------------------
/vot-toolkit-master/vot-workspace/tracker/kcf/get_axis_aligned_BB.m:
--------------------------------------------------------------------------------
1 | % -------------------------------------------------------------------------------------------------
2 | function [cx, cy, w, h] = get_axis_aligned_BB(region)
3 | %GETAXISALIGNEDBB computes axis-aligned bbox with same area as the rotated one (REGION)
4 | % -------------------------------------------------------------------------------------------------
5 | nv = numel(region);
6 | assert(nv==8 || nv==4);
7 |
8 | if nv==8
9 | cx = mean(region(1:2:end));
10 | cy = mean(region(2:2:end));
11 | x1 = min(region(1:2:end));
12 | x2 = max(region(1:2:end));
13 | y1 = min(region(2:2:end));
14 | y2 = max(region(2:2:end));
15 | A1 = norm(region(1:2) - region(3:4)) * norm(region(3:4) - region(5:6));
16 | A2 = (x2 - x1) * (y2 - y1);
17 | s = sqrt(A1/A2);
18 | w = s * (x2 - x1) + 1;
19 | h = s * (y2 - y1) + 1;
20 | else
21 | x = region(1);
22 | y = region(2);
23 | w = region(3);
24 | h = region(4);
25 | cx = x+w/2;
26 | cy = y+h/2;
27 | end
28 |
--------------------------------------------------------------------------------
/vot-toolkit-master/stacks/stack_test.m:
--------------------------------------------------------------------------------
1 | function experiments = stack_test()
2 |
3 | set_global_variable('bundle', 'http://data.votchallenge.net/toolkit/test.zip');
4 |
5 | baseline.name = 'baseline';
6 | baseline.converter = [];
7 | baseline.type = 'supervised';
8 | baseline.tags = {'camera_motion', 'illum_change', 'occlusion', 'size', ...
9 | 'motion', 'empty'};
10 | baseline.parameters.repetitions = 5;
11 | baseline.parameters.burnin = 10;
12 | baseline.parameters.skip_initialize = 5;
13 | baseline.parameters.failure_overlap = 0;
14 |
15 | realtime.name = 'realtime';
16 | realtime.converter = [];
17 | realtime.type = 'realtime';
18 | realtime.tags = {'camera_motion', 'illum_change', 'occlusion', 'size', ...
19 | 'motion', 'empty'};
20 | realtime.parameters.repetitions = 5;
21 | realtime.parameters.burnin = 10;
22 | realtime.parameters.skip_initialize = 5;
23 | realtime.parameters.failure_overlap = 0;
24 | realtime.parameters.fps_override = true;
25 | realtime.parameters.fps_default = 20;
26 |
27 | experiments = {baseline, realtime};
28 |
29 | end
30 |
31 |
--------------------------------------------------------------------------------
/vot-toolkit-master/vot-workspace/tracker/kcf/choose_video.m:
--------------------------------------------------------------------------------
1 | function video_name = choose_video(base_path)
2 | %CHOOSE_VIDEO
3 | % Allows the user to choose a video (sub-folder in the given path).
4 | %
5 | % Joao F. Henriques, 2014
6 | % http://www.isr.uc.pt/~henriques/
7 |
8 | %process path to make sure it's uniform
9 | if ispc(), base_path = strrep(base_path, '\', '/'); end
10 | if base_path(end) ~= '/', base_path(end+1) = '/'; end
11 |
12 | %list all sub-folders
13 | contents = dir(base_path);
14 | names = {};
15 | for k = 1:numel(contents),
16 | name = contents(k).name;
17 | if isdir([base_path name]) && ~any(strcmp(name, {'.', '..'})),
18 | names{end+1} = name; %#ok
19 | end
20 | end
21 |
22 | %no sub-folders found
23 | if isempty(names), video_name = []; return; end
24 |
25 | %choice GUI
26 | choice = listdlg('ListString',names, 'Name','Choose video', 'SelectionMode','single');
27 |
28 | if isempty(choice), %user cancelled
29 | video_name = [];
30 | else
31 | video_name = names{choice};
32 | end
33 |
34 | end
35 |
36 |
--------------------------------------------------------------------------------
/vot-toolkit-master/vot-workspace/tracker/kcf/gaussian_correlation.m:
--------------------------------------------------------------------------------
1 | function kf = gaussian_correlation(xf, yf, sigma)
2 | %GAUSSIAN_CORRELATION Gaussian Kernel at all shifts, i.e. kernel correlation.
3 | % Evaluates a Gaussian kernel with bandwidth SIGMA for all relative
4 | % shifts between input images X and Y, which must both be MxN. They must
5 | % also be periodic (ie., pre-processed with a cosine window). The result
6 | % is an MxN map of responses.
7 | %
8 | % Inputs and output are all in the Fourier domain.
9 | %
10 | % Joao F. Henriques, 2014
11 | % http://www.isr.uc.pt/~henriques/
12 |
13 | N = size(xf,1) * size(xf,2);
14 | xx = xf(:)' * xf(:) / N; %squared norm of x
15 | yy = yf(:)' * yf(:) / N; %squared norm of y
16 |
17 | %cross-correlation term in Fourier domain
18 | xyf = xf .* conj(yf);
19 | xy = sum(real(ifft2(xyf)), 3); %to spatial domain
20 |
21 | %calculate gaussian response for all positions, then go back to the
22 | %Fourier domain
23 | kf = fft2(exp(-1 / sigma^2 * max(0, (xx + yy - 2 * xy) / numel(xf))));
24 |
25 | end
26 |
27 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/valid_identifier.m:
--------------------------------------------------------------------------------
1 | function [valid, conditional] = valid_identifier(identifier)
2 | % valid_identifier Verifies tracker identifier
3 | %
4 | % Tests if a given input string is a valid tracker identifier. A valid identifier contains only
5 | % upper and lower case letters, digits and underscore.
6 | %
7 | % A conditionally valid identifier also contains dash. This is used for legacy reasons but is
8 | % discouraged for new trackers.
9 | %
10 | % Input:
11 | % - identifier: A string to test.
12 | %
13 | % Ouput:
14 | % - valid: True if the string is a valid identifier.
15 | % - conditional: True if the string is a conditionally valid identifier.
16 |
17 | if ~ischar(identifier)
18 | valid = false;
19 | conditional = false;
20 | return;
21 | end;
22 |
23 | alpha = (identifier >= 'a' & identifier <= 'z') | (identifier >= 'A' & identifier <= 'Z');
24 | numeric = (identifier >= '0' & identifier <= '9');
25 | symbol = identifier == '_';
26 |
27 | valid = all(alpha | numeric | symbol);
28 | conditional = all(alpha | numeric | symbol | identifier == '-');
29 |
--------------------------------------------------------------------------------
/vot-toolkit-master/workspace/templates/run_analysis.tpl:
--------------------------------------------------------------------------------
1 | % This script can be used to perform a comparative analyis of the experiments
2 | % in the same manner as for the VOT challenge
3 | % You can copy and modify it to create a different analyis
4 |
5 | addpath('{{toolkit}}'); toolkit_path; % Make sure that VOT toolkit is in the path
6 |
7 | [sequences, experiments] = workspace_load();
8 |
9 | error('Analysis not configured! Please edit run_analysis.m file.'); % Remove this line after proper configuration
10 |
11 | trackers = tracker_list('{{tracker}}', 'TODO'); % TODO: add more trackers here
12 |
13 | context = create_report_context('report_{{stack}}_{{tracker}}');
14 |
15 | report_article(context, experiments, trackers, sequences, 'spotlight', '{{tracker}}'); % This report is more suitable for results included in a paper
16 |
17 | % report_challenge(context, experiments, trackers, sequences); % Use this report for official challenge report
18 | % report_visualization(context, experiments, trackers, sequences); % Use this report to generate images of visual (bounding box) results of trackers
--------------------------------------------------------------------------------
/vot-toolkit-master/workspace/get_global_variable.m:
--------------------------------------------------------------------------------
1 | function value = get_global_variable(name, default)
2 | % get_global_variable Get a workspace global variable
3 | %
4 | % Get a global variable in a current workspace storage. If the variable
5 | % does not exist in the storage an optional default value is returned. If
6 | % the default value does not exist then an empty matrix is returned.
7 | %
8 | % If no argument is given then a structure with all global variables is
9 | % returned.
10 | %
11 | % Input:
12 | % - name (string): Name of the variable.
13 | % - default (any): Optional default value.
14 | %
15 | % Output:
16 | % - value (any): Value of variable or an empty matrix.
17 | %
18 |
19 |
20 | global global_variables;
21 |
22 | if nargin < 1
23 | value = global_variables;
24 | return;
25 | end
26 |
27 | if ~exist('default', 'var')
28 | default = [];
29 | end;
30 |
31 | if isempty(global_variables);
32 | value = default;
33 | return;
34 | end;
35 |
36 | try
37 | value = global_variables.(name);
38 | catch %#ok
39 | value = default;
40 | end;
41 |
42 | return;
43 |
44 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/examples/python/python_static.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 |
3 | import vot
4 | import sys
5 | import time
6 |
7 | # *****************************************
8 | # VOT: Create VOT handle at the beginning
9 | # Then get the initializaton region
10 | # and the first image
11 | # *****************************************
12 | handle = vot.VOT("rectangle")
13 | selection = handle.region()
14 |
15 | # Process the first frame
16 | imagefile = handle.frame()
17 | if not imagefile:
18 | sys.exit(0)
19 |
20 | while True:
21 | # *****************************************
22 | # VOT: Call frame method to get path of the
23 | # current image frame. If the result is
24 | # null, the sequence is over.
25 | # *****************************************
26 | imagefile = handle.frame()
27 | if not imagefile:
28 | break
29 |
30 | # *****************************************
31 | # VOT: Report the position of the object
32 | # every frame using report method.
33 | # *****************************************
34 | handle.report(selection)
35 |
36 | time.sleep(0.01)
37 |
38 |
39 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/readstruct.m:
--------------------------------------------------------------------------------
1 | function [s] = readstruct(filename)
2 | % readstruct Read a key-value file to a structure
3 | %
4 | % This function reads a key-value file to a structure. If possible, the
5 | % values are converted to numbers, otherwise the value is kept as string.
6 | %
7 | % Input:
8 | % - filename (string): Path to the file.
9 | %
10 | % Output:
11 | % - s (structure): Resulting structure.
12 | %
13 |
14 |
15 | fid = fopen(filename);
16 | lines = textscan(fid, '%s', 'Delimiter', '\n');
17 | fclose(fid);
18 |
19 | lines = lines{1};
20 |
21 | s = struct();
22 |
23 | for i = 1:numel(lines)
24 | [key, value] = parse_line(lines{i});
25 |
26 | key = strrep(strrep(strrep(key, '.', '_'), ' ', '_'), '-', '_');
27 |
28 | if ~isempty(key)
29 | s.(key) = value;
30 | end
31 |
32 | end;
33 |
34 | end
35 |
36 | function [key, value] = parse_line(line)
37 |
38 | delimiter = find(line == '=', 1);
39 |
40 | if isnan(delimiter)
41 | key = []; value = [];
42 | return;
43 | end;
44 |
45 | key = line(1:delimiter-1);
46 | value = line(delimiter+1:end);
47 |
48 | [numvalue, status] = str2num(value); %#ok
49 |
50 | if status
51 | value = numvalue;
52 | end
53 |
54 | end
55 |
56 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/sequence_query_tag.m:
--------------------------------------------------------------------------------
1 | function [indices] = sequence_query_tag(sequence, tag, subset)
2 | % sequence_query_tag Find tag occurences in sequence
3 | %
4 | % The function returns indices of all frames that contain the specified tag.
5 | %
6 | % Input:
7 | % - sequence (structure): A valid sequence structure.
8 | % - tag (string): Name of the tag.
9 | % - subset (vector): A set of frame numbers or a binary mask to be used
10 | % when looking for a tag. Frame indices will be returned relative to that
11 | % subset of frames.
12 | %
13 | % Output:
14 | % - indices (integer): A vector of indices of frames that contain the given tag.
15 |
16 | if nargin < 3
17 | subset = true(sequence.length, 1);
18 | end
19 |
20 | if strcmp(tag, 'all')
21 | if nargin < 3
22 | indices = 1:sequence.length;
23 | else
24 | indices = 1:numel(subset);
25 | end;
26 | return;
27 | end;
28 |
29 | if strcmp(tag, 'empty')
30 | indices = find(all(~sequence.tags.data, 2));
31 | return;
32 | end;
33 |
34 | tag_index = find(strcmp(sequence.tags.names, tag), 1);
35 |
36 | if isempty(tag_index)
37 | indices = [];
38 | else
39 | indices = find(sequence.tags.data(subset, tag_index));
40 | end;
41 |
42 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/strxcmp.m:
--------------------------------------------------------------------------------
1 | function result = strxcmp(data, query, operation, varargin)
2 | % strxcmp Advanced substring comparison
3 | %
4 | % Enables several substring comparisons, prefix and suffix matching
5 | %
6 | % Input:
7 | % - data (string): The data string.
8 | % - query (string): The query string.
9 | % - operation (string): The comparision operation to perform.
10 | %
11 | % Output:
12 | % - result (boolean): The result of the comparison.
13 | %
14 |
15 | if ~ischar(data)
16 | error('First argument must be a string');
17 | end;
18 |
19 | if ~ischar(query)
20 | error('Second argument must be a string');
21 | end;
22 |
23 | if ~ischar(operation)
24 | error('Operation argument must be a string');
25 | end;
26 |
27 | N = numel(data);
28 | M = numel(query);
29 |
30 | switch (lower(operation))
31 | case 'prefix'
32 | if N < M
33 | result = false;
34 | else;
35 | result = strncmp(data, query, M);
36 | end;
37 | case 'suffix'
38 | if N < M
39 | result = false;
40 | else;
41 | result = strcmp(data(end-M+1:end), query);
42 | end;
43 | otherwise
44 | error('Unknown comparison operation');
45 | end;
46 |
47 |
48 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/templates/tracker_python.tpl:
--------------------------------------------------------------------------------
1 |
2 | error('Tracker not configured! Please edit the tracker_{{tracker}}.m file.'); % Remove this line after proper configuration
3 |
4 | % The human readable label for the tracker, used to identify the tracker in reports
5 | % If not set, it will be set to the same value as the identifier.
6 | % It does not have to be unique, but it is best that it is.
7 | tracker_label = [];
8 |
9 | % For Python implementations we have created a handy function that generates the appropritate
10 | % command that will run the python executable and execute the given script that includes your
11 | % tracker implementation.
12 | %
13 | % Please customize the line below by substituting the first argument with the name of the
14 | % script of your tracker (not the .py file but just the name of the script) and also provide the
15 | % path (or multiple paths) where the tracker sources % are found as the elements of the cell
16 | % array (second argument).
17 | tracker_command = generate_python_command('', {''});
18 |
19 | tracker_interpreter = 'python';
20 |
21 | % tracker_linkpath = {}; % A cell array of custom library directories used by the tracker executable (optional)
22 |
23 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/order_trackers.m:
--------------------------------------------------------------------------------
1 | function [trackers, indices] = order_trackers(trackers, order)
2 | % order_trackers Change the order of trackers
3 | %
4 | % Change the order of trackers in a cell array of tracker structures.
5 | %
6 | % The functions upports the following ordering options:
7 | %
8 | % - IdentifierAscending
9 | % - IdentifierDescending
10 | %
11 | % Input:
12 | % - trackers: Cell array of tracker structures.
13 | % - order: A string that defines the order of trackers. See the description above for available options.
14 | %
15 | % Output:
16 | % - trackers: A modified cell array of tracker structures.
17 | % - indices: The mapping from the old to the new array.
18 |
19 | if nargin < 2
20 | order = 'identifierascending';
21 | end;
22 |
23 | order = lower(order);
24 |
25 | switch order
26 | case 'identifierascending'
27 | identifiers = cellfun(@(t) t.identifier, trackers, 'UniformOutput', false);
28 | [~, indices] = sort(identifiers);
29 | case 'identifierdescending'
30 | identifiers = cellfun(@(t) t.identifier, trackers, 'UniformOutput', false);
31 | [~, indices] = sort(identifiers);
32 | indices = fliplr(indices);
33 | otherwise
34 | return;
35 | end;
36 |
37 | trackers = trackers(indices);
38 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/templates/tracker_matlab.tpl:
--------------------------------------------------------------------------------
1 |
2 | error('Tracker not configured! Please edit the tracker_{{tracker}}.m file.'); % Remove this line after proper configuration
3 |
4 | % The human readable label for the tracker, used to identify the tracker in reports
5 | % If not set, it will be set to the same value as the identifier.
6 | % It does not have to be unique, but it is best that it is.
7 | tracker_label = [];
8 |
9 | % For MATLAB implementations we have created a handy function that generates the appropritate
10 | % command that will run the matlab executable and execute the given script that includes your
11 | % tracker implementation.
12 | %
13 | % Please customize the line below by substituting the first argument with the name of the
14 | % script (not the .m file but just the name of the script as you would use it in within Matlab)
15 | % of your tracker and also provide the path (or multiple paths) where the tracker sources
16 | % are found as the elements of the cell array (second argument).
17 | tracker_command = generate_matlab_command('', {''});
18 |
19 | tracker_interpreter = 'matlab';
20 |
21 | % tracker_linkpath = {}; % A cell array of custom library directories used by the tracker executable (optional)
22 |
23 |
--------------------------------------------------------------------------------
/vot-toolkit-master/vot-workspace/tracker_KCF.m:
--------------------------------------------------------------------------------
1 |
2 | %error('Tracker not configured! Please edit the tracker_KCF.m file.'); % Remove this line after proper configuration
3 |
4 | % The human readable label for the tracker, used to identify the tracker in reports
5 | % If not set, it will be set to the same value as the identifier.
6 | % It does not have to be unique, but it is best that it is.
7 | tracker_label = ['KCF'];
8 |
9 | % For MATLAB implementations we have created a handy function that generates the appropritate
10 | % command that will run the matlab executable and execute the given script that includes your
11 | % tracker implementation.
12 | %
13 | % Please customize the line below by substituting the first argument with the name of the
14 | % script (not the .m file but just the name of the script as you would use it in within Matlab)
15 | % of your tracker and also provide the path (or multiple paths) where the tracker sources
16 | % are found as the elements of the cell array (second argument).
17 | tracker_command = generate_matlab_command('KCF', {'C:\Users\xyd\Desktop\VOT2015-KCF\vot-toolkit-master\vot-workspace\tracker\kcf'});
18 |
19 | tracker_interpreter = 'matlab';
20 |
21 | % tracker_linkpath = {}; % A cell array of custom library directories used by the tracker executable (optional)
22 |
23 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/draw_region.m:
--------------------------------------------------------------------------------
1 | function draw_region(region, color, width)
2 | % draw_region Draw a region on the current figure
3 | %
4 | % This functions is an utility that draws a region with a given color and stroke width.
5 | % A region can be a rectangle or a polygon.
6 | %
7 | % Input:
8 | % - region (double vector): A vector of numbers describing a region.
9 | % - color (double vector): A `3x1` matrix denoting color of the stroke.
10 | % - width (double): Width of a stroke.
11 |
12 |
13 | if nargin < 2
14 | color = [1, 0, 0];
15 | end;
16 |
17 | if nargin < 3
18 | width = 1;
19 | end;
20 |
21 | if isnumeric(region)
22 | if numel(region) == 4
23 |
24 | for i = 1:size(region, 1)
25 | x = [region(i, 1), region(i, 1), region(i, 1) + region(i, 3), ...
26 | region(i, 1) + region(i, 3), region(i, 1)];
27 | y = [region(i, 2), region(i, 2) + region(i, 4), region(i, 2) + ...
28 | region(i, 4), region(i, 2), region(i, 2)];
29 |
30 | plot(x, y, 'Color', color, 'LineWidth', width);
31 | end;
32 |
33 | elseif numel(region) >= 6 && mod(numel(region), 2) == 0
34 |
35 | x = region(1:2:end);
36 | y = region(2:2:end);
37 |
38 | plotc(x, y, 'Color', color, 'LineWidth', width);
39 | end;
40 |
41 | end;
42 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/examples/index.md:
--------------------------------------------------------------------------------
1 | Tracker integration examples
2 | ============================
3 |
4 | Several examples of tracker integration for C/C++, Matlab and Python trackers are provided together with the toolkit. Helpers for both languages are provided so that integration is as easy as adding a few lines of code to your tracker source code. More details about the actual process of integration can be found [here](../integration.md). Contributions of the community are welcome in supporting additional programing languages.
5 |
6 | C/C++
7 | ------------
8 |
9 | Three examples are provided by the toolkit. There are two static trackers (trackers that just report the initial position) written in C and C++ and a NCC tracker written in C++ and using OpenCV library.
10 |
11 | All three trackers are using `vot.h` header that provides integration functions and classes that can be used to speed up the integration process.
12 |
13 | Matlab
14 | ------
15 |
16 | A NCC tracker example, written in Matlab is provided by the toolkit. The tracker uses `vot` function that generates a communication structure that is then used to communicate with the toolkit.
17 |
18 | Python
19 | ------
20 |
21 | Both static and NCC tracker example, written in Python are provided by the toolkit. The tracker uses `vot.VOT` object that is then used to communicate with the toolkit.
22 |
--------------------------------------------------------------------------------
/vot-toolkit-master/vot-workspace/tracker/kcf/get_features.m:
--------------------------------------------------------------------------------
1 | function x = get_features(im, features, cell_size, cos_window)
2 | %GET_FEATURES
3 | % Extracts dense features from image.
4 | %
5 | % X = GET_FEATURES(IM, FEATURES, CELL_SIZE)
6 | % Extracts features specified in struct FEATURES, from image IM. The
7 | % features should be densely sampled, in cells or intervals of CELL_SIZE.
8 | % The output has size [height in cells, width in cells, features].
9 | %
10 | % To specify HOG features, set field 'hog' to true, and
11 | % 'hog_orientations' to the number of bins.
12 | %
13 | % To experiment with other features simply add them to this function
14 | % and include any needed parameters in the FEATURES struct. To allow
15 | % combinations of features, stack them with x = cat(3, x, new_feat).
16 | %
17 | % Joao F. Henriques, 2014
18 | % http://www.isr.uc.pt/~henriques/
19 |
20 |
21 | if features.hog,
22 | %HOG features, from Piotr's Toolbox
23 | x = double(fhog(single(im) / 255, cell_size, features.hog_orientations));
24 | x(:,:,end) = []; %remove all-zeros channel ("truncation feature")
25 | end
26 |
27 | if features.gray,
28 | %gray-level (scalar feature)
29 | x = double(im) / 255;
30 |
31 | x = x - mean(x(:));
32 | end
33 |
34 | %process with cosine window if needed
35 | if ~isempty(cos_window),
36 | x = bsxfun(@times, x, cos_window);
37 | end
38 |
39 | end
40 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/sequence_skipping.m:
--------------------------------------------------------------------------------
1 | function [skipped_sequence] = sequence_skipping(sequence, skip, keep)
2 | % sequence_skipping Returns sequence with skipped frames
3 | %
4 | % This sequence converter returns a sequence that omits a periodic pattern frames.
5 | %
6 | % Cache notice: The results of this function are cached in the workspace cache directory.
7 | %
8 | % Input:
9 | % - sequence (structure): A valid sequence structure.
10 | % - skip (integer): Number of frames to skip in a period.
11 | % - keep (integer): Number of frames to keep in a period.
12 | %
13 | % Output:
14 | % - skipped_sequence (structure): A sequence descriptor of a converted sequence.
15 |
16 | skip = min(10, max(1, skip));
17 | keep = min(10, max(1, keep));
18 |
19 | skipped_sequence = sequence;
20 |
21 | indices = 1:sequence.length;
22 |
23 | mask = mod(indices, skip + keep);
24 | indices = indices(mask > 0 & mask < (keep + 1));
25 |
26 | skipped_sequence.groundtruth = sequence.groundtruth(indices, :);
27 | skipped_sequence.indices = sequence.indices(indices, :);
28 | skipped_sequence.tags.names = sequence.tags.names;
29 | skipped_sequence.tags.data = sequence.tags.data(indices, :);
30 | skipped_sequence.values.names = sequence.values.names;
31 | skipped_sequence.values.data = sequence.values.data(indices, :);
32 |
33 | skipped_sequence.images = sequence.images(indices);
34 |
35 | skipped_sequence.length = length(indices);
36 |
37 |
--------------------------------------------------------------------------------
/vot-toolkit-master/stacks/stack_vot2017.m:
--------------------------------------------------------------------------------
1 | function experiments = stack_vot2017()
2 |
3 | set_global_variable('bundle', 'http://data.votchallenge.net/vot2017/vot2017.zip');
4 |
5 | baseline.name = 'baseline';
6 | baseline.converter = [];
7 | baseline.type = 'supervised';
8 | baseline.tags = {'camera_motion', 'illum_change', 'occlusion', 'size_change', 'motion_change', 'empty'};
9 |
10 | baseline.parameters.repetitions = 15;
11 | baseline.parameters.burnin = 10;
12 | baseline.parameters.skip_initialize = 5;
13 | baseline.parameters.failure_overlap = 0;
14 |
15 | unsupervised.name = 'unsupervised';
16 | unsupervised.converter = [];
17 | unsupervised.type = 'unsupervised';
18 | unsupervised.tags = {'camera_motion', 'illum_change', 'occlusion', 'size_change', 'motion_change', 'empty'};
19 |
20 | unsupervised.parameters.repetitions = 1;
21 | unsupervised.parameters.burnin = 0;
22 |
23 | realtime.name = 'realtime';
24 | realtime.converter = [];
25 | realtime.type = 'realtime';
26 | realtime.tags = {'camera_motion', 'illum_change', 'occlusion', 'size_change', 'motion_change', 'empty'};
27 |
28 | realtime.parameters.repetitions = 1;
29 | realtime.parameters.default_fps = 20;
30 | realtime.parameters.grace = 3;
31 | realtime.parameters.override_fps = true;
32 | realtime.parameters.skip_initialize = 5;
33 | realtime.parameters.realtime_type = 'real';
34 |
35 | experiments = {baseline, unsupervised, realtime};
36 |
37 | end
38 |
39 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/estimate_completion_time.m:
--------------------------------------------------------------------------------
1 | function [estimate] = estimate_completion_time(sequences, varargin)
2 | % estimate_completion_time Estimates completion time for a tracker
3 | %
4 | % Estimates time for a pass over a given set of sequences given some basic performance characteristics.
5 | %
6 | % Input:
7 | % - sequences: Cell array of sequence structures.
8 | % - varargin[FPS]: Average speed of a tracker (frames per second).
9 | % - varargin[Failures]: Average number of failures per sequence.
10 | % - varargin[Repeats]: Required number of repetitions for each sequence.
11 | %
12 | % Output:
13 | % - estimate: Completion time estimate given in number of seconds
14 |
15 | failures = 8;
16 | fps = 0.5;
17 | repeats = 1;
18 |
19 | args = varargin;
20 | for j=1:2:length(args)
21 | switch varargin{j}
22 | case 'fps', fps = max(0, args{j+1});
23 | case 'failures', failures = max(0, args{j+1});
24 | case 'repeats', repeats = max(1, args{j+1});
25 | otherwise, error(['unrecognized argument ' args{j}]);
26 | end
27 | end
28 |
29 | total_frames = 0;
30 |
31 | for i = 1:length(sequences)
32 | total_frames = total_frames + sequences{i}.length;
33 | end;
34 |
35 | average_frames = total_frames / length(sequences);
36 |
37 | lens = linspace(0, 1, failures + 1);
38 | reruns = sum(lens);
39 |
40 | estimate = (average_frames * reruns * repeats) * length(sequences) / fps;
41 |
42 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/change_trackers_visual_identity.m:
--------------------------------------------------------------------------------
1 | function [trackers] = change_trackers_visual_identity(trackers, identifiers, varargin)
2 | % change_trackers_visual_identity Modify the visualization properties
3 | %
4 | % Modify the visualization properties of a tracker or a set of trackers.
5 | %
6 | % Input:
7 | % - trackers: Cell array of tracker structures.
8 | % - identifiers: A string or a cell array of strings containing tracker identifiers.
9 | % - varargin[FontColor]: A triple indicating a color of the font used.
10 | % - varargin[FontBold]: A boolean indicating if using bold font.
11 | %
12 | % Output:
13 | % - trackers: A modified cell array of tracker structures.
14 |
15 | font_color = [0, 0, 0];
16 | font_bold = false;
17 |
18 | for i = 1:2:length(varargin)
19 | switch lower(varargin{i})
20 | case 'fontcolor'
21 | font_color = varargin{i+1};
22 | case 'fontbold'
23 | font_bold = varargin{i+1};
24 | otherwise
25 | error(['Unknown switch ', varargin{i},'!']) ;
26 | end
27 | end
28 |
29 | if ~iscell(identifiers)
30 | identifiers = {identifiers};
31 | end
32 |
33 | for i = 1:numel(identifiers)
34 | t = find_tracker(trackers, identifiers{i});
35 |
36 | if isempty(t)
37 | continue;
38 | end
39 |
40 | trackers{t}.style.font_color = font_color;
41 | trackers{t}.style.font_bold = font_bold;
42 |
43 | end
44 |
--------------------------------------------------------------------------------
/vot-toolkit-master/vot-workspace/tracker/kcf/gaussian_shaped_labels.m:
--------------------------------------------------------------------------------
1 | function labels = gaussian_shaped_labels(sigma, sz)
2 | %GAUSSIAN_SHAPED_LABELS
3 | % Gaussian-shaped labels for all shifts of a sample.
4 | %
5 | % LABELS = GAUSSIAN_SHAPED_LABELS(SIGMA, SZ)
6 | % Creates an array of labels (regression targets) for all shifts of a
7 | % sample of dimensions SZ. The output will have size SZ, representing
8 | % one label for each possible shift. The labels will be Gaussian-shaped,
9 | % with the peak at 0-shift (top-left element of the array), decaying
10 | % as the distance increases, and wrapping around at the borders.
11 | % The Gaussian function has spatial bandwidth SIGMA.
12 | %
13 | % Joao F. Henriques, 2014
14 | % http://www.isr.uc.pt/~henriques/
15 |
16 |
17 | % %as a simple example, the limit sigma = 0 would be a Dirac delta,
18 | % %instead of a Gaussian:
19 | % labels = zeros(sz(1:2)); %labels for all shifted samples
20 | % labels(1,1) = magnitude; %label for 0-shift (original sample)
21 |
22 |
23 | %evaluate a Gaussian with the peak at the center element
24 | [rs, cs] = ndgrid((1:sz(1)) - floor(sz(1)/2), (1:sz(2)) - floor(sz(2)/2));
25 | labels = exp(-0.5 / sigma^2 * (rs.^2 + cs.^2));
26 |
27 | %move the peak to the top-left, with wrap-around
28 | labels = circshift(labels, -floor(sz(1:2) / 2) + 1);
29 |
30 | %sanity check: make sure it's really at top-left
31 | assert(labels(1,1) == 1)
32 |
33 | end
34 |
35 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/sequence_fragment.m:
--------------------------------------------------------------------------------
1 | function [fragments, fragment_offset] = sequence_fragment(sequence, fragment_length)
2 | % sequence_fragment Returns an array of subsequences
3 | %
4 | % This function returns a cell array of sequence objects that are fragments of the source sequence.
5 | %
6 | % Input:
7 | % - sequence (structure): A valid sequence structure.
8 | % - fragment_length (integer): The length of a single fragment.
9 | %
10 | % Output:
11 | % - fragments (cell): A cell array of sequence descriptors.
12 | % - fragment_offset(vector): A vector of offsets in the original sequence.
13 |
14 | fragment_offset = [1:fragment_length:sequence.length, sequence.length+1];
15 |
16 | fragments = cell(numel(fragment_offset)-1, 1);
17 |
18 | for f = 1:numel(fragment_offset)-1
19 | indices = fragment_offset(f):fragment_offset(f+1)-1;
20 | fragments{f} = sequence;
21 |
22 | fragments{f}.groundtruth = sequence.groundtruth(indices, :);
23 | fragments{f}.indices = sequence.indices(indices);
24 | fragments{f}.tags.names = sequence.tags.names;
25 | fragments{f}.tags.data = sequence.tags.data(indices, :);
26 | fragments{f}.values.names = sequence.values.names;
27 | fragments{f}.values.data = sequence.values.data(indices, :);
28 | fragments{f}.images = sequence.images(indices);
29 | fragments{f}.length = length(indices);
30 |
31 | end;
32 |
33 | fragment_offset = fragment_offset(1:end-1);
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/generate_matlab_command.m:
--------------------------------------------------------------------------------
1 | function command = generate_matlab_command(script, paths)
2 | % generate_matlab_command Generate command line for Matlab tracker
3 | %
4 | % This function generates the appropritate command string that will
5 | % run the matlab executable and execute the given script that includes your
6 | % tracker implementation.
7 | %
8 | % Input:
9 | % - script (string): Name of the tracker script to be executed.
10 | % - paths (cell): An array of strings that denote directories to be added to Matlab path.
11 | %
12 | % Output:
13 | % - command (string): Generated command string.
14 | %
15 |
16 | trax_mex = get_global_variable('trax_mex');
17 |
18 | % If path to trax mex file is set then we attempt to export it to tracker
19 | if ~isempty(trax_mex)
20 | paths{end+1} = trax_mex;
21 | end
22 |
23 | path_string = strjoin(cellfun(@(p) sprintf('addpath(''%s'');', p), paths, 'UniformOutput', false), '');
24 |
25 | if ispc()
26 | matlab_executable = ['"', fullfile(matlabroot, 'bin', 'matlab.exe'), '"'];
27 | matlab_flags = {'-nodesktop', '-nosplash', '-wait', '-minimize'};
28 | else
29 | matlab_executable = fullfile(matlabroot, 'bin', 'matlab');
30 | matlab_flags = {'-nodesktop', '-nosplash'};
31 | end
32 |
33 | argument_string = strjoin(matlab_flags, ' ');
34 |
35 | matlab_script = sprintf('try; diary ''runtime.log''; %s%s; catch ex; disp(getReport(ex)); quit; end;', path_string, script);
36 |
37 | command = sprintf('%s %s -r "%s"', matlab_executable, argument_string, matlab_script);
38 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/calculate_results_fingerprint.m:
--------------------------------------------------------------------------------
1 | function hash = calculate_results_fingerprint(tracker, experiment, sequences)
2 | % calculate_results_fingerprint Calculate results hash
3 | %
4 | % Calculates a hash fingerprint based on timestamps of result files for a tracker
5 | %
6 | % Input:
7 | % - tracker: Tracker structure.
8 | % - experiment: Experiment structure.
9 | % - sequences: Cell array of sequence structures.
10 | %
11 | % Output:
12 | % - hash: A string containing hash fingerprint.
13 |
14 | time_string = iterate(experiment, tracker, sequences, 'iterator', @fingerprint_iterator, 'context', []);
15 |
16 | hash = md5hash(time_string);
17 |
18 | end
19 |
20 | function context = fingerprint_iterator(event, context)
21 | % fingerprint_iterator Iterator function
22 | %
23 | % Iterator function that calculates parts of the fingerprint.
24 | %
25 | % Input:
26 | % - event (structure): Event structure.
27 | % - context (structure): Context structure.
28 | %
29 | % Output:
30 | % - context (structure): Modified context structure.
31 | %
32 |
33 |
34 | switch (event.type)
35 | case 'sequence_enter'
36 |
37 | files = tracker_evaluate(event.tracker, event.sequence, event.experiment, ...
38 | 'scan', true);
39 |
40 | dates = zeros(1, numel(files));
41 |
42 | for j = 1:numel(files)
43 | stat = dir(files{j});
44 | dates(j) = stat.datenum;
45 | end;
46 |
47 | context = [context, dates];
48 |
49 | end;
50 |
51 | end
52 |
--------------------------------------------------------------------------------
/vot-toolkit-master/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ubuntu:16.04
2 |
3 | # Install build & basic dependencies
4 | RUN apt-get -y update && apt-get install -y sudo build-essential cmake vim wget git software-properties-common
5 |
6 | # Install Octave 4 & packages
7 | RUN apt-add-repository ppa:octave/stable && apt-get update && \
8 | apt-get install -y octave liboctave-dev zip && \
9 | echo "pkg install -forge -auto image" | octave --no-window-system && \
10 | echo "pkg install -forge -auto io" | octave --no-window-system && \
11 | echo "pkg install -forge -auto statistics" | octave --no-window-system
12 |
13 | ENV TOOLKIT_ROOT /usr/local/toolkit
14 |
15 | # Add toolkit source
16 | ADD . /usr/local/toolkit/
17 |
18 | # Compile native components
19 | RUN mkdir -p /usr/local/toolkit/native && \
20 | echo "addpath ('${TOOLKIT_ROOT}'); toolkit_path; workspace_load('OnlyDefaults', true); initialize_native; " | octave --no-window-system
21 |
22 | # Compile TraX
23 | RUN cd ${TOOLKIT_ROOT}/native/trax && mkdir build && cd build \
24 | && cmake -DBUILD_CLIENT=ON -DBUILD_MATLAB=ON .. && make && make install && cd .. && rm -rf build
25 |
26 | # Set environment variables.
27 | ENV USER vot
28 | ENV HOME /home/$USER
29 |
30 | # Create new user
31 | RUN \
32 | useradd -m $USER && \
33 | mkdir -m 440 -p /etc/sudoers.d/ && \
34 | echo "$USER ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$USER
35 |
36 | # Define user name.
37 | USER $USER
38 |
39 | RUN echo "addpath ('/toolkit');" >> ~/.octaverc && mkdir -p /home/$USER/workspace
40 |
41 | WORKDIR /home/$USER/workspace
42 |
43 | # Define default command.
44 | CMD ["/bin/bash"]
45 |
46 |
--------------------------------------------------------------------------------
/vot-toolkit-master/analysis/adapted_ranks.m:
--------------------------------------------------------------------------------
1 | function adapted = adapted_ranks(ranks, different, mode)
2 | % adapted_ranks Performs rank adaptation on a set of ranks
3 | %
4 | % Performs different types of rank adaptation on a set of ranks and a matrix of determined actual differences of ranked entities.
5 | %
6 | % The function looks for sets of entities that are considered equal according to the `different` matrix and adapts their ranks
7 | % in one of the following ways:
8 | % - none: no adaptation, keep the original ranks.
9 | % - mean: a mean rank of a set is assigned to all trackers in the set.
10 | % - median: a median rank of a set is assigned to all trackers in the set.
11 | % - best: a minimum rank in a set is assigned to all trackers in the set.
12 | %
13 | % Input:
14 | % - ranks (double vector): A vector of `N` ranks.
15 | % - different (boolean matrix): A `N x N` matrix that denotes which entities should actually be equal and which not.
16 | % - mode (string): Type of rank adaptation.
17 | %
18 | % Output
19 | % - adapted (double vector): Adapted ranks
20 |
21 | adapted = zeros(1, length(ranks)) ;
22 |
23 | switch mode
24 | case 'none'
25 | adapted = ranks;
26 |
27 | case 'mean'
28 |
29 | for tracker = 1:length(ranks)
30 | adapted(tracker) = mean(ranks(find(~different(tracker,:)))) ; %#ok
31 | end
32 |
33 | case 'median'
34 |
35 | for tracker = 1:length(ranks)
36 | adapted(tracker) = median(ranks(find(~different(tracker,:)))) ; %#ok
37 | end
38 |
39 | case 'best'
40 |
41 | for tracker = 1:length(ranks)
42 | adapted(tracker) = min(ranks(find(~different(tracker,:)))) ; %#ok
43 | end
44 |
45 | end;
46 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/calculate_overlap.m:
--------------------------------------------------------------------------------
1 | function [overlap, only1, only2] = calculate_overlap(T1, T2, bounds)
2 | % calculate_overlap Calculates overlap for two trajectories
3 | %
4 | % The function calculates per-frame overlap between two trajectories. Besides the
5 | % region overlap the function also returns cointainment of the second trajectory in the
6 | % first and containment of the first trajectory in the second.
7 | %
8 | % If the trajectories are not of equal length, then the overlaps are calculated up
9 | % to the end of the shorter one.
10 | %
11 | % Input:
12 | % - T1 (cell): The first trajectory.
13 | % - T2 (cell): The second trajectory.
14 | % - bounds (vector): An optional bounds of valid region where the overlap is calculated.
15 | %
16 | % Output:
17 | % - overlap: A vector of per-frame overlaps.
18 | % - only1: A vector of per-frame containment of the second trajectory in the first.
19 | % - only2: A vector of per-frame containment of the first trajectory in the second.
20 |
21 | len = min(size(T1, 1), size(T2, 1));
22 | T1 = T1(1:len, :);
23 | T2 = T2(1:len, :);
24 |
25 | if (~iscell(T1))
26 | T1 = num2cell(T1, 2);
27 | end
28 |
29 | if (~iscell(T2))
30 | T2 = num2cell(T2, 2);
31 | end
32 |
33 | if nargin < 3
34 | bounds = [];
35 | end
36 |
37 | if get_global_variable('legacy_rasterization', true)
38 | mode = 'legacy';
39 | else
40 | mode = 'default';
41 | end;
42 |
43 | results = region_overlap(T1, T2, bounds, mode);
44 |
45 | %results = cell2mat(cellfun(@(r1, r2) region_overlap(r1, r2), T1, T2, 'UniformOutput', false));
46 |
47 | overlap = results(:, 1);
48 | only1 = results(:, 2);
49 | only2 = results(:, 3);
50 |
51 |
--------------------------------------------------------------------------------
/vot-toolkit-master/stacks/stack_vot2014.m:
--------------------------------------------------------------------------------
1 | function experiments = stack_vot2014()
2 |
3 | set_global_variable('bundle', 'http://data.votchallenge.net/vot2014/vot2014.zip');
4 | set_global_variable('legacy_rasterization', true);
5 | set_global_variable('bounded_overlap', false);
6 |
7 | baseline.name = 'baseline';
8 | baseline.converter = [];
9 | baseline.type = 'supervised';
10 | baseline.tags = {'camera_motion', 'illum_change', 'occlusion', 'size_change', ...
11 | 'motion_change', 'empty'};
12 | baseline.parameters.repetitions = 15;
13 | baseline.parameters.burnin = 10;
14 | baseline.parameters.skip_initialize = 5;
15 | baseline.parameters.failure_overlap = 0;
16 |
17 | region_noise.name = 'region_noise';
18 | region_noise.converter = @(sequence) sequence_transform_initialization(...
19 | sequence, @noisy_transform);
20 | region_noise.type = 'supervised';
21 | region_noise.tags = {'camera_motion', 'illum_change', 'occlusion', 'size_change', ...
22 | 'motion_change', 'empty'};
23 | region_noise.parameters.repetitions = 15;
24 | region_noise.parameters.burnin = 10;
25 | region_noise.parameters.skip_initialize = 5;
26 | region_noise.parameters.failure_overlap = 0;
27 |
28 | experiments = {baseline, region_noise};
29 |
30 | end
31 |
32 | function [transform] = noisy_transform(sequence, index, context)
33 |
34 | bounds = region_convert(get_region(sequence, index), 'rectangle');
35 |
36 | scale = 0.9 + rand(1, 2) * 0.2;
37 | move = bounds(3:4) .* (0.1 - rand(1, 2) * 0.2);
38 | rotate = 0.1 - rand(1) * 0.2;
39 |
40 | transform = [scale(1) * cos(rotate), -sin(rotate), move(1); ...
41 | sin(rotate), scale(2) * cos(rotate), move(2); 0, 0, 1];
42 |
43 | end
44 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/generate_octave_command.m:
--------------------------------------------------------------------------------
1 | function command = generate_octave_command(script, paths)
2 | % generate_octave_command Generate command line for Octave tracker
3 | %
4 | % This function generates the appropritate command string that will
5 | % run the Octave executable and execute the given script that includes your
6 | % tracker implementation.
7 | %
8 | % Input:
9 | % - script (string): Name of the tracker script to be executed.
10 | % - paths (cell): An array of strings that denote directories to be added to Octave path.
11 | %
12 | % Output:
13 | % - command (string): Generated command string.
14 | %
15 |
16 | trax_mex = get_global_variable('trax_mex');
17 |
18 | % If path to trax mex file is set then we attempt to export it to tracker
19 | if ~isempty(trax_mex)
20 | paths{end+1} = trax_mex;
21 | end
22 |
23 | path_string = strjoin(cellfun(@(p) sprintf('addpath(''%s'');', p), paths, 'UniformOutput', false), '');
24 |
25 | octave_flags = {};
26 |
27 | if ispc()
28 | octave_executable = ['"', fullfile(matlabroot, 'bin', 'octave.exe'), '"'];
29 | else
30 | octave_executable = fullfile(matlabroot, 'bin', 'octave');
31 | end
32 |
33 | if compare_versions(version(), '4.0.0', '>=')
34 | octave_flags{end+1} = '--no-gui';
35 | octave_flags{end+1} = '--no-window-system';
36 | end
37 |
38 | argument_string = strjoin(octave_flags, ' ');
39 |
40 | octave_script = sprintf('try; diary ''runtime.log''; %s%s; catch ex; disp(ex.message); for i = 1:size(ex.stack) disp(''filename''); disp(ex.stack(i).file); disp(''line''); disp(ex.stack(i).line); endfor; quit; end;', path_string, script);
41 |
42 | command = sprintf('%s %s --eval "%s"', octave_executable, argument_string, octave_script);
43 |
--------------------------------------------------------------------------------
/vot-toolkit-master/analysis/index.md:
--------------------------------------------------------------------------------
1 | Analysis module
2 | ===============
3 |
4 | The analysis module contains functions related to performance analysis and general analysis of results. The core of the module
5 | is a ranking methodology that is based on Accuracy-Robustness measure pair, proposed in [this paper].
6 |
7 |
8 | Module functions
9 | ----------------
10 |
11 | ### Performance measures
12 |
13 | - [estimate_accuracy](estimate_accuracy.m) - Calculate accuracy score
14 | - [estimate_failures](estimate_failures.m) - Computes number of failures score
15 | - [estimate_expected_overlap](estimate_expected_overlap.m) - Estimates expected average overlap for different sequence lengths
16 |
17 | ### Ranking
18 |
19 | - [compare_trackers](compare_trackers.m) - Compares two trackers in terms of accuracy and robustness
20 | - [adapted_ranks](adapted_ranks.m) - Performs rank adaptation on a set of ranks
21 | - [analyze_ranks](analyze_ranks.m) - Performs ranking analysis on per-sequence or per-tag basis
22 | - [create_tag_selectors](create_tag_selectors.m) - Create per-tag selectors
23 | - [create_sequence_selectors](create_sequence_selectors.m) - Create per-sequence selectors
24 |
25 | ### Speed
26 |
27 | - [normalize_speed](normalize_speed.m) - Normalizes tracker speed estimate
28 | - [analyze_speed](analyze_speed.m) - Perform speed analysis
29 |
30 | ### Other analyses
31 |
32 | - [analyze_expected_overlap](analyze_expected_overlap.m) - Performs expected overlap analysis
33 | - [analyze_failures](analyze_failures.m) - Perform failure frequency analysis
34 |
35 |
36 | [this paper]: http://prints.vicos.si/publications/302/ "Is my new tracker really better than yours?"
37 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/write_manifest.m:
--------------------------------------------------------------------------------
1 | function [manifest] = write_manifest(tracker, directory)
2 | % write_manifest Write a manifest file for the tracker
3 | %
4 | % Write a manifest file for the tracker. The manifest file contains some system
5 | % statistics that can be used for debugging and analysis.
6 | %
7 | % Input:
8 | % - tracker: Tracker structure.
9 | % - tracker: Optional directory (default is tracker result root).
10 | %
11 | % Output:
12 | % - manifest: Full path to the manifest file that is located in tracker result directory.
13 |
14 | if nargin < 2
15 | directory = tracker.directory;
16 | end;
17 |
18 | mkpath(directory);
19 | manifest = fullfile(directory, 'manifest.txt');
20 |
21 | [platform_str, platform_maxsize, platform_endian] = computer();
22 |
23 | if is_octave()
24 | environment = 'octave';
25 | else
26 | environment = 'matlab';
27 | end;
28 |
29 | environment_version = version();
30 |
31 | fid = fopen(manifest, 'w');
32 |
33 | votversion = toolkit_version();
34 |
35 | fprintf(fid, 'toolkit.version=%d.%d.%d\n', votversion.major, votversion.minor, votversion.patch);
36 | if isfield(votversion, 'build')
37 | fprintf(fid, 'toolkit.build=%d\n', votversion.build);
38 | end;
39 | fprintf(fid, 'tracker.identifier=%s\n', tracker.identifier);
40 | fprintf(fid, 'tracker.interpreter=%s\n', tracker.interpreter);
41 | fprintf(fid, 'timestamp=%s\n', datestr(now, 31));
42 | fprintf(fid, 'platform=%s\n', platform_str);
43 | fprintf(fid, 'platform.maxsize=%f\n', platform_maxsize);
44 | fprintf(fid, 'platform.endian=%s\n', platform_endian);
45 | fprintf(fid, 'environment=%s\n', environment);
46 | fprintf(fid, 'environment.version=%s\n', environment_version);
47 |
48 | fclose(fid);
49 |
--------------------------------------------------------------------------------
/vot-toolkit-master/vot-workspace/tracker/kcf/precision_plot.m:
--------------------------------------------------------------------------------
1 | function precisions = precision_plot(positions, ground_truth, title, show)
2 | %PRECISION_PLOT
3 | % Calculates precision for a series of distance thresholds (percentage of
4 | % frames where the distance to the ground truth is within the threshold).
5 | % The results are shown in a new figure if SHOW is true.
6 | %
7 | % Accepts positions and ground truth as Nx2 matrices (for N frames), and
8 | % a title string.
9 | %
10 | % Joao F. Henriques, 2014
11 | % http://www.isr.uc.pt/~henriques/
12 |
13 |
14 | max_threshold = 50; %used for graphs in the paper
15 |
16 |
17 | precisions = zeros(max_threshold, 1);
18 |
19 | if size(positions,1) ~= size(ground_truth,1),
20 | % fprintf('%12s - Number of ground truth frames does not match number of tracked frames.\n', title)
21 |
22 | %just ignore any extra frames, in either results or ground truth
23 | n = min(size(positions,1), size(ground_truth,1));
24 | positions(n+1:end,:) = [];
25 | ground_truth(n+1:end,:) = [];
26 | end
27 |
28 | %calculate distances to ground truth over all frames
29 | distances = sqrt((positions(:,1) - ground_truth(:,1)).^2 + ...
30 | (positions(:,2) - ground_truth(:,2)).^2);
31 | distances(isnan(distances)) = [];
32 |
33 | %compute precisions
34 | for p = 1:max_threshold,
35 | precisions(p) = nnz(distances <= p) / numel(distances);
36 | end
37 |
38 | %plot the precisions
39 | if show == 1,
40 | % figure('Number','off', 'Name',['Precisions - ' title])
41 | figure( 'Name',['Precisions - ' title])
42 | plot(precisions, 'k-', 'LineWidth',2)
43 | xlabel('Threshold'), ylabel('Precision')
44 | end
45 |
46 | end
47 |
48 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/generate_from_template.m:
--------------------------------------------------------------------------------
1 | function generate_from_template(filename, template, varargin)
2 | % generate_from_template Generate a new file from a template file
3 | %
4 | % Generate a new file from a template file by % inserting given variables
5 | % into the placeholders. The placeholders in the template file are denoted
6 | % by ''{{ variable_name }}''.
7 | %
8 | % Input:
9 | % - filename (string): Path to the destination file.
10 | % - template (string): Path to the template file.
11 | % - varargin (cell): Pairs of strings, the first string denotes the name of
12 | % the variable and the second one denotes the value.
13 | %
14 |
15 |
16 | report = fileread(template);
17 |
18 | if (ischar(filename))
19 | fid = fopen(filename, 'w');
20 | close_file = 1;
21 | else
22 | fid = filename;
23 | close_file = 0;
24 | end;
25 |
26 | pS = strfind(report, '{{');
27 | pE = strfind(report, '}}');
28 |
29 | variables = struct(varargin{:});
30 |
31 | for i = 1:numel(pS)
32 | s = pS(i);
33 | e = min(pE(pE > s));
34 | if isempty(e)
35 | break;
36 | end;
37 |
38 | varname = strtrim(report(s+2:e-1));
39 | varvalue = '';
40 |
41 | if isempty(varname)
42 | continue;
43 | end;
44 |
45 | if isfield(variables, varname)
46 | varvalue = variables.(varname);
47 | elseif varname(1) == '@'
48 | varvalue = num2str(get_global_variable(varname(2:end), ''));
49 | end;
50 |
51 | report = cat(2, report(1:s-1), varvalue, report(e+2:end));
52 | pS = pS - (e - s + 2) + numel(varvalue);
53 | pE = pE - (e - s + 2) + numel(varvalue);
54 | end
55 |
56 | fwrite(fid, report);
57 |
58 | if (close_file)
59 | fclose(fid);
60 | end;
61 |
62 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/tracker_test.m:
--------------------------------------------------------------------------------
1 | function [supported] = tracker_test(tracker)
2 | % trax_test Test tracker's support for TraX protocol
3 | %
4 | % This function tries to run the tracker and communicate with it using the
5 | % TraX protocol to determine if it supports it. The results are chached
6 | % in the workspace cache directory.
7 | %
8 | % Input:
9 | % - tracker: Tracker structure.
10 | %
11 | % Output:
12 | % - supported (boolean): Is the protocol supported.
13 |
14 | % Check if the result of the test is already cached
15 | cache = fullfile(get_global_variable('directory'), 'cache', 'trax');
16 |
17 | tracker_hash = md5hash(sprintf('%s-%s-%s', tracker.command, tracker.interpreter, strjoin(tracker.linkpath, '-')));
18 | mkpath(cache);
19 | cache_file = fullfile(cache, sprintf('trax_%s_%s.mat', tracker.identifier, tracker_hash));
20 |
21 | supported = [];
22 | if exist(cache_file, 'file')
23 | load(cache_file);
24 | if ~isempty(supported)
25 | return;
26 | end;
27 | end;
28 |
29 | print_text('Testing TraX protocol support for tracker %s.', tracker.identifier);
30 |
31 | try
32 |
33 | data.header = false;
34 |
35 | data = tracker_run(tracker, @callback, data);
36 |
37 | supported = data.header;
38 |
39 | catch
40 |
41 | supported = false;
42 |
43 | end
44 |
45 | if supported
46 | % Only cache if support is detected
47 | save(cache_file, 'supported');
48 | print_text('TraX support detected.');
49 | else
50 | print_text('TraX support not detected.');
51 | end
52 |
53 | end
54 |
55 | function [image, region, properties, data] = callback(state, data)
56 |
57 | image = [];
58 | region = [];
59 | properties = struct();
60 |
61 | data.header = true;
62 | data.state = state;
63 |
64 | end
65 |
66 |
67 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/convert_sequences.m:
--------------------------------------------------------------------------------
1 | function converted_sequences = convert_sequences(sequences, converter)
2 | % convert_sequences Converts sequences using a converter
3 | %
4 | % This functions is an utility function that converts a set of sequences using
5 | % a given converter. The benefit of using this function is that each sequence
6 | % is checked if it was already converted.
7 | %
8 | % Input:
9 | % - sequences (cell): Cell array of sequence structures.
10 | % - converter (function, string): A function handle or a string that can be resolved to a converter function.
11 | %
12 | % Output:
13 | % - converted_sequences (cell): Cell array of converted sequence structures.
14 |
15 | if isempty(converter)
16 | converted_sequences = sequences;
17 | return;
18 | end;
19 |
20 | if ischar(converter)
21 | converter = str2func(converter);
22 | end;
23 |
24 | converted_sequences = cellfun(@(x) convert_sequence(x, converter), sequences,'UniformOutput',false);
25 |
26 | end
27 |
28 | function sequence = convert_sequence(sequence, converter)
29 | % convert_sequence Converts sequence using a converter
30 | %
31 | % Converts a single sequence using a converter
32 | %
33 | % Input:
34 | % - sequence (structure): Input sequence structure.
35 | % - converter (function): A function handle of a converter function.
36 | %
37 | % Output:
38 | % - sequence (structure): Converted sequence structure.
39 | %
40 |
41 |
42 | if isfield(sequence, 'converter')
43 | % If the sequence is already converted with this converter
44 | % then do not do it again
45 | if strcmp(func2str(converter), sequence.converter)
46 | return;
47 | end;
48 | end;
49 |
50 | sequence = converter(sequence);
51 |
52 | sequence.converter = func2str(converter);
53 |
54 | end
55 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/sequence_grayscale.m:
--------------------------------------------------------------------------------
1 | function [grayscale_sequence] = sequence_grayscale(sequence)
2 | % sequence_grayscale Returns grayscale sequence
3 | %
4 | % This sequence converter returns a grayscale version of an input sequence.
5 | %
6 | % Cache notice: The results of this function are cached in the workspace cache directory.
7 | %
8 | % Input:
9 | % - sequence (structure): A valid sequence structure.
10 | %
11 | % Output:
12 | % - grayscale_sequence (structure): A sequence descriptor of a converted sequence.
13 |
14 | cache_directory = fullfile(get_global_variable('directory'), 'cache', 'grayscale', sequence.name);
15 |
16 | mkpath(cache_directory);
17 |
18 | cache_groundtruth = fullfile(cache_directory, 'groundtruth.txt');
19 |
20 | sequence_groundtruth = fullfile(sequence.directory, 'groundtruth.txt');
21 |
22 | if file_newer_than(cache_groundtruth, sequence_groundtruth)
23 | grayscale_sequence = create_sequence(cache_directory, 'name', sequence.name);
24 | grayscale_sequence.tags.names = sequence.tags.names;
25 | grayscale_sequence.tags.data = sequence.tags.data;
26 | grayscale_sequence.properties = sequence.properties;
27 | return;
28 | end;
29 |
30 | print_debug('Generating cached grayscale sequence ''%s''...', sequence.name);
31 |
32 | for i = 1:sequence.length
33 |
34 | color_image = imread(get_image(sequence, i));
35 |
36 | gray_image = repmat(rgb2gray(color_image), [1 1 3]);
37 |
38 | imwrite(gray_image, fullfile(cache_directory, sprintf('%08d.jpg', i)));
39 |
40 | end;
41 |
42 | write_trajectory(cache_groundtruth, sequence.groundtruth);
43 |
44 | grayscale_sequence = create_sequence(cache_directory, 'name', sequence.name);
45 |
46 | grayscale_sequence.tags.names = sequence.tags.names;
47 | grayscale_sequence.tags.data = sequence.tags.data;
48 |
49 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/json_encode.m:
--------------------------------------------------------------------------------
1 | function string = json_encode(object)
2 | % json_encode Converts structure to a JSON string
3 | %
4 | % This function converts a structure or a cell array to a JSON string
5 | % representation. It supports encoding of structures, cell arrays
6 | % strings and matrices. Both matrices and cell arrays are first
7 | % converted to single dimension lists as JSON does not support
8 | % multiple dimensions.
9 | %
10 | % Input:
11 | % - object (struct, cell): A Matlab structure
12 | %
13 | % Output:
14 | % - string (string): An encoded JSON string
15 | %
16 | string = save_element(object);
17 |
18 | end
19 |
20 | function string = save_element(object)
21 |
22 | if isstruct(object)
23 | string = save_struct(object);
24 | elseif iscell(object)
25 | string = save_cell(object);
26 | elseif ischar(object)
27 | string = save_string(object);
28 | else
29 | string = save_matrix(object);
30 | end
31 |
32 | end
33 |
34 | function string = save_struct(object)
35 |
36 | fields = repmat(fieldnames(object), numel(object), 1);
37 | values = struct2cell(object);
38 |
39 | string = ['{', strjoin(cellfun(@(x, y) sprintf('"%s" : %s', x, save_element(y)), fields, values, 'UniformOutput', 0), ','), '}'];
40 | end
41 |
42 | function string = save_cell(object)
43 |
44 | string = ['[', strjoin(cellfun(@(x) save_element(x), object(:), 'UniformOutput', 0), ','), ']'];
45 | end
46 |
47 | function string = save_string(object)
48 |
49 | string = ['"', strrep(object, '"', '\"'), '"'];
50 |
51 | end
52 |
53 | function string = save_matrix(object)
54 |
55 | if isempty(object)
56 | string = 'null';
57 | elseif numel(object) == 1
58 | string = num2str(object);
59 | else
60 | string = ['[', strjoin(cellfun(@(x) num2str(x), num2cell(object(:)', numel(object)), 'UniformOutput', 0), ','), ']'];
61 | end;
62 |
63 | end
64 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/delpath.m:
--------------------------------------------------------------------------------
1 | function [status] = delpath(root, varargin)
2 | % delpath Deletes the file or directory recursively
3 | %
4 | % Deletes the file or directory. If the root is a directory then all its
5 | % content is deleted recursively.
6 | %
7 | % Input:
8 | % - root (string): Path to file or root directory to delete.
9 | % - varargin[Empty] (boolean): Delete directory only if it is.
10 | % - varargin[Root] (boolean): Also delete root directory.
11 | %
12 | % Output:
13 | % - status (boolean): True on success.
14 | %
15 |
16 |
17 | if_empty = false;
18 | delete_root = true;
19 |
20 | args = varargin;
21 | for j=1:2:length(args)
22 | switch lower(varargin{j})
23 | case 'empty', if_empty = args{j+1};
24 | case 'root', delete_root = args{j+1};
25 | otherwise, error(['unrecognized argument ' args{j}]);
26 | end
27 | end
28 |
29 | if ~exist(root, 'dir')
30 | if exist(root, 'file')
31 | delete(root);
32 | status = 1;
33 | else
34 | status = 0;
35 | end;
36 | return;
37 | end;
38 |
39 | status = true;
40 |
41 | data = dir(root);
42 |
43 | isdir = [data.isdir];
44 | files = {data(~isdir).name}';
45 |
46 | sdirs = {data(isdir).name};
47 | for sdir = find(~ismember(sdirs, {'.', '..'}))
48 | status = status && delpath(fullfile(root, sdirs{sdir}), 'Root', true);
49 | end
50 |
51 | if isempty(files) || ~if_empty
52 | if ~isempty(files)
53 | for i = 1:length(files)
54 | delete(fullfile(root, files{i}));
55 | end;
56 | end
57 | else
58 | status = false;
59 | return;
60 | end
61 |
62 | if (status && delete_root)
63 | try
64 | rmdir(root);
65 | catch
66 | status = false;
67 | end;
68 | end;
69 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/is_deterministic.m:
--------------------------------------------------------------------------------
1 | function result = is_deterministic(sequence, repetitions, directory)
2 | % is_deterministic Test if a tracker is deterministic
3 | %
4 | % Test if a tracker is deterministic for a given sequence. This is done by considering
5 | % first three trajectories for a given sequence and checking if the regions are equivalent
6 | % for every frame.
7 | %
8 | % Input:
9 | % - sequence: A sequence structure.
10 | % - repetitions: An integer number denoting the maximum number of repetitions.
11 | % - directory: A full path to the directory containing the results for the sequence.
12 | %
13 | % Output
14 | % - result: True if the tracker is deterministic.
15 |
16 | result = 1;
17 |
18 | result_file = fullfile(directory, sprintf('%s_%03d.txt', sequence.name, 1));
19 |
20 | if ~exist(result_file, 'file')
21 | result = 0;
22 | return;
23 | end;
24 |
25 | bind_within = get_global_variable('bounded_overlap', true);
26 | baseline = read_trajectory(result_file);
27 | baseline_valid = ~cellfun(@(x) numel(x) == 1, baseline, 'UniformOutput', true);
28 |
29 | if bind_within
30 | bounds = [sequence.width, sequence.height] - 1;
31 | else
32 | bounds = [];
33 | end;
34 |
35 | for i = 2:repetitions
36 |
37 | result_file = fullfile(directory, sprintf('%s_%03d.txt', sequence.name, i));
38 |
39 | if ~exist(result_file, 'file')
40 | result = 0;
41 | break;
42 | end;
43 |
44 | trial = read_trajectory(result_file);
45 |
46 | if all(size(baseline) == size(trial))
47 | trial_valid = ~cellfun(@(x) numel(x) == 1, trial, 'UniformOutput', true);
48 | if all(baseline_valid == trial_valid)
49 | same = calculate_overlap(baseline(baseline_valid), trial(trial_valid), bounds) > 0.999;
50 | if all(same)
51 | continue;
52 | end;
53 | end;
54 | end;
55 |
56 | result = 0;
57 | break;
58 |
59 | end;
60 |
61 |
62 |
--------------------------------------------------------------------------------
/vot-toolkit-master/vot-workspace/tracker/kcf/download_videos.m:
--------------------------------------------------------------------------------
1 |
2 | % This script downloads and extracts all videos to the path specified
3 | % below.
4 | %
5 | % Joao F. Henriques, 2014
6 | % http://www.isr.uc.pt/~henriques/
7 |
8 |
9 | %local path where the videos will be located.
10 | %note that if you change it here, you must also change it in RUN_TRACKER.
11 | base_path = './data/Benchmark/';
12 |
13 |
14 | %list of videos to download
15 | videos = {'basketball', 'bolt', 'boy', 'car4', 'carDark', 'carScale', ...
16 | 'coke', 'couple', 'crossing', 'david2', 'david3', 'david', 'deer', ...
17 | 'dog1', 'doll', 'dudek', 'faceocc1', 'faceocc2', 'fish', 'fleetface', ...
18 | 'football', 'football1', 'freeman1', 'freeman3', 'freeman4', 'girl', ...
19 | 'ironman', 'jogging', 'jumping', 'lemming', 'liquor', 'matrix', ...
20 | 'mhyang', 'motorRolling', 'mountainBike', 'shaking', 'singer1', ...
21 | 'singer2', 'skating1', 'skiing', 'soccer', 'subway', 'suv', 'sylvester', ...
22 | 'tiger1', 'tiger2', 'trellis', 'walking', 'walking2', 'woman'};
23 |
24 |
25 | if ~exist(base_path, 'dir'), %create if it doesn't exist already
26 | mkdir(base_path);
27 | end
28 |
29 | if ~exist('matlabpool', 'file'),
30 | %no parallel toolbox, use a simple 'for' to iterate
31 | disp('Downloading videos one by one, this may take a while.')
32 | disp(' ')
33 |
34 | for k = 1:numel(videos),
35 | disp(['Downloading and extracting ' videos{k} '...']);
36 | unzip(['http://cvlab.hanyang.ac.kr/tracker_benchmark/seq/' videos{k} '.zip'], base_path);
37 | end
38 |
39 | else
40 | %download all videos in parallel
41 | disp('Downloading videos in parallel, this may take a while.')
42 | disp(' ')
43 |
44 | if matlabpool('size') == 0,
45 | matlabpool open;
46 | end
47 | parfor k = 1:numel(videos),
48 | disp(['Downloading and extracting ' videos{k} '...']);
49 | unzip(['http://cvlab.hanyang.ac.kr/tracker_benchmark/seq/' videos{k} '.zip'], base_path);
50 | end
51 | end
52 |
53 |
--------------------------------------------------------------------------------
/vot-toolkit-master/report/highlight_best_rows.m:
--------------------------------------------------------------------------------
1 | function tabledata = highlight_best_rows(tabledata, columns, varargin)
2 | % highlight_best_rows Adds highlight to the best three cells in a given
3 | % row.
4 | %
5 | % The function modifies the input matrix by converting it to cell array
6 | % and augmenting the cells in individual columns with class labels for
7 | % first three places acording to specified ordering. The resulting array
8 | % can be then handed over to matrix2html function.
9 | %
10 | % Input:
11 | % - tabledata (matrix):
12 | % - columns (cell): An array of strings that denote type of ordering for
13 | % individual columns.
14 | % - Decreasing: Highlight in decreasing order.
15 | % - Increasing: Highlight in increasing order.
16 | % - None: Do not highlight.
17 | %
18 | % Output:
19 | % - tabledata (cell): Modified array.
20 | %
21 |
22 | if size(tabledata, 2) ~= numel(columns)
23 | error('Number of columns does not match the sorting instructuions.');
24 | end;
25 |
26 | labels = {'first', 'second', 'third'};
27 |
28 | for i = 1:numel(columns)
29 |
30 | switch lower(columns{i})
31 | case {'descending', 'descend', 'high'}
32 | values = cell2mat(tabledata(:, i));
33 | usable = find(~isnan(values));
34 | levels = sort(unique(values(usable)), 'descend');
35 |
36 | case {'ascending', 'ascend', 'low'}
37 | values = cell2mat(tabledata(:, i));
38 | usable = find(~isnan(values));
39 | levels = sort(unique(values(usable)), 'ascend');
40 |
41 | otherwise
42 | levels = [];
43 | end;
44 |
45 | if isempty(levels)
46 | continue;
47 | end;
48 |
49 | for j = 1:min(numel(labels), numel(levels))
50 | tabledata(values == levels(j), i) = cellfun(...
51 | @(x) struct('text', x, 'class', labels{j}), tabledata(values == levels(j), i), 'UniformOutput', false);
52 |
53 | end
54 | end;
55 |
--------------------------------------------------------------------------------
/vot-toolkit-master/stacks/stack_vot2013.m:
--------------------------------------------------------------------------------
1 | function experiments = stack_vot2013()
2 |
3 | set_global_variable('bundle', 'http://data.votchallenge.net/vot2013/vot2013.zip');
4 | set_global_variable('legacy_rasterization', true);
5 | set_global_variable('bounded_overlap', false);
6 |
7 | baseline.name = 'baseline';
8 | baseline.converter = [];
9 | baseline.type = 'supervised';
10 | baseline.tags = {'camera_motion', 'illum_change', 'occlusion', 'size', ...
11 | 'motion', 'empty'};
12 | baseline.parameters.repetitions = 15;
13 | baseline.parameters.burnin = 10;
14 | baseline.parameters.skip_initialize = 5;
15 | baseline.parameters.failure_overlap = 0;
16 |
17 | region_noise.name = 'region_noise';
18 | region_noise.converter = @(sequence) sequence_transform_initialization(...
19 | sequence, @noisy_transform, 'rectangle');
20 | region_noise.type = 'supervised';
21 | region_noise.tags = {'camera_motion', 'illum_change', 'occlusion', 'size', ...
22 | 'motion', 'empty'};
23 | region_noise.parameters.repetitions = 15;
24 | region_noise.parameters.burnin = 10;
25 | region_noise.parameters.skip_initialize = 5;
26 | region_noise.parameters.failure_overlap = 0;
27 |
28 | grayscale.name = 'grayscale';
29 | grayscale.converter = 'sequence_grayscale';
30 | grayscale.type = 'supervised';
31 | grayscale.tags = {'camera_motion', 'illum_change', 'occlusion', 'size', ...
32 | 'motion', 'empty'};
33 | grayscale.parameters.repetitions = 15;
34 | grayscale.parameters.burnin = 10;
35 | grayscale.parameters.skip_initialize = 5;
36 | grayscale.parameters.failure_overlap = 0;
37 |
38 | experiments = {baseline, region_noise, grayscale};
39 |
40 | end
41 |
42 | function [transform] = noisy_transform(sequence, index, context)
43 |
44 | bounds = region_convert(get_region(sequence, index), 'rectangle');
45 |
46 | scale = 0.9 + rand(1, 2) * 0.2;
47 | move = bounds(3:4) .* (0.1 - rand(1, 2) * 0.2);
48 |
49 | transform = [scale(1), 0, move(1); 0, scale(2), move(2); 0, 0, 1];
50 |
51 | end
52 |
--------------------------------------------------------------------------------
/vot-toolkit-master/README.md:
--------------------------------------------------------------------------------
1 | The VOT evaluation kit
2 | ======================
3 |
4 | This repository contains the official evaluation kit for the [Visual Object Tracking (VOT) challenge](http://votchallenge.net/). The repository contains the actual evaluation toolkit as a set of Matlab (Octave compatible) scripts, a documentation and a set of integration examples for different programming languages.
5 |
6 | For more detailed informations consult the documentation available in the source or a compiled version of the documentation [here](http://box.vicos.si/vot/toolkit/docs/). You can also subscribe to the VOT [mailing list](https://service.ait.ac.at/mailman/listinfo/votchallenge) to receive news about challenges and important software updates or join our [support form](https://groups.google.com/forum/?hl=en#!forum/votchallenge-help) to ask questions.
7 |
8 | Click [here](http://toolkit.votchallenge.net) to browse and download the latest official releases of the toolkit.
9 |
10 | Developers
11 | ----------
12 |
13 | * Luka Čehovin (lead developer)
14 | * Tomáš Vojíř
15 | * Alan Lukežič
16 |
17 | Contributors
18 | ------------
19 |
20 | * Georg Nebehay
21 | * Heng Cherkeng
22 | * Stefan Duffner
23 | * Mario Maresca
24 | * Klaus Haag
25 | * Alessio Dore
26 | * Alan Torres
27 | * Rok Mandeljc
28 |
29 | License
30 | -------
31 |
32 | The evaluation toolkit code and the documentation is available under GPL 3 license. The tracker examples are available under various licenses.
33 |
34 | Enquiries, Question and Comments
35 | --------------------------------
36 |
37 | If you have any further enquiries, question, or comments, please refer to the contact infromation link on the [VOT homepage](http://votchallenge.net/). If you would like to file a bug report or a feature request, use the [Github issue tracker](https://github.com/vicoslab/vot-toolkit/issues). **The issue tracker is for toolkit issues only**, if you have a problem with tracker integration or any other questions, please use our [support forum](https://groups.google.com/forum/?hl=en#!forum/votchallenge-help).
38 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/tracker_create.m:
--------------------------------------------------------------------------------
1 | function [identifier] = tracker_create(varargin)
2 | % tracker_create Generate a new tracker configuration file
3 | %
4 | % This function helps with creation of a new tracker configuration file.
5 | %
6 | % Input:
7 | % - varargin[Identifier] (string): Identifier of the new tracker. Must be a valid tracker name.
8 | % - varargin[Directory] (string): Directory where the configuration file will be created.
9 | %
10 |
11 | identifier = [];
12 | directory = pwd();
13 |
14 | for j=1:2:length(varargin)
15 | switch lower(varargin{j})
16 | case 'identifier', identifier = varargin{j+1};
17 | case 'directory', directory = varargin{j+1};
18 | otherwise, error(['unrecognized argument ' varargin{j}]);
19 | end
20 | end
21 |
22 | if isempty(identifier)
23 | identifier = input('Input an unique identifier for your tracker: ', 's');
24 | end;
25 |
26 | if ~valid_identifier(identifier)
27 | error('Not a valid tracker identifier!');
28 | end;
29 |
30 | variables = {'tracker', identifier};
31 |
32 | interpreter_names = {'Matlab', 'Python', 'C/C++', 'Octave', 'None of the above'};
33 | interpreter_ids = {'matlab', 'python', '', 'octave', ''};
34 |
35 | print_text('Is your tracker written in any of the following languages?');
36 | print_indent(1);
37 |
38 | for i = 1:length(interpreter_ids)
39 | print_text('%d - "%s"', i, interpreter_names{i});
40 | end;
41 |
42 | print_indent(-1);
43 |
44 | selected_interpreter = int32(str2double(input('Selected option: ', 's')));
45 |
46 | if isempty(selected_interpreter) || selected_interpreter < 1 || selected_interpreter > length(interpreter_ids)
47 | selected_interpreter = numel(interpreter_names);
48 | end;
49 |
50 | if ~isempty(interpreter_ids{selected_interpreter})
51 | template_name = sprintf('tracker_%s.tpl', interpreter_ids{selected_interpreter});
52 | else
53 | template_name = 'tracker.tpl';
54 | end;
55 |
56 | generate_from_template(fullfile(directory, ['tracker_', identifier, '.m']), ...
57 | fullfile(fileparts(mfilename('fullpath')), 'templates', template_name), variables{:});
58 |
59 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/set_trackers_visual_identity.m:
--------------------------------------------------------------------------------
1 | function [styled_trackers] = set_trackers_visual_identity(trackers, varargin)
2 | % set_trackers_visual_identity Generate visual identity information
3 | %
4 | % Generate visual identity information for a set of trackers.
5 | %
6 | % Input:
7 | % - trackers: Cell array of tracker structures.
8 | % - varargin[Groups]: An array of group identifiers. A vector of the same length as the trackers cell array where each number denotes a group for the corresponding tracker. Trackers in the same group get the same color.
9 | %
10 | % Output:
11 | % - styled_trackers: A modified cell array of tracker structures with their visualization information updated.
12 |
13 | groups = [];
14 |
15 | for i = 1:2:length(varargin)
16 | switch lower(varargin{i})
17 | case 'groups'
18 | groups = varargin{i+1};
19 | otherwise
20 | error(['Unknown switch ', varargin{i},'!']) ;
21 | end
22 | end
23 |
24 | if ~isempty(groups)
25 | if numel(groups) ~= numel(trackers)
26 | error('Group map not of correct size');
27 | end;
28 |
29 | [g, ia, ic] = unique(groups);
30 |
31 | colors = repmat(hsv(7), ceil(length(g) / 7), 1);
32 |
33 | colors = colors(ic ,:);
34 |
35 | else
36 | colors = repmat(hsv(7), ceil(length(trackers) / 7), 1);
37 | end
38 |
39 | symbol = repmat({'o', 'x', '*', 'v', 'd', '+', '<', 'p', '>', 's', '^', 'h'}, 1, ceil(length(trackers) / 9));
40 | width = mod(1:length(trackers), 5) / 5 + 1.5;
41 |
42 | styled_trackers = cell(length(trackers), 1);
43 |
44 | for i = 1:length(trackers)
45 | styled_trackers{i} = trackers{i};
46 | styled_trackers{i}.style.color = colors(i, :);
47 | styled_trackers{i}.style.symbol = symbol{i};
48 | styled_trackers{i}.style.width = width(i);
49 | styled_trackers{i}.style.font_color = [0, 0, 0];
50 | styled_trackers{i}.style.font_bold = false;
51 | if isfield(trackers{i}, 'label')
52 | styled_trackers{i}.label = trackers{i}.label;
53 | else
54 | styled_trackers{i}.label = trackers{i}.identifier;
55 | end;
56 | end;
57 |
--------------------------------------------------------------------------------
/vot-toolkit-master/report/tight_subplots.m:
--------------------------------------------------------------------------------
1 | function handles = tight_subplots(rows, columns, gap, row_margin, column_margin)
2 | % tight_subplots Initializes a grid of axes
3 | %
4 | % Initializes a grid of axes with adjustable gaps and margins
5 | % and returns their handles.
6 | %
7 | % Credit: Pekka Kumpulainen (2010) @tut.fi Tampere University of Technology / Automation Science and Engineering
8 | %
9 | % Input:
10 | % - rows (integer): Number of axes in hight (vertical direction).
11 | % - columns (integer): Number of axes in width (horizontal direction).
12 | % - gap (double): Gaps between the axes in normalized units (0...1)
13 | % or [gap_h gap_w] for different gaps in height and width.
14 | % - row_margin (): Margins in height in normalized units (0...1)
15 | % or [lower upper] for different lower and upper margins.
16 | % - column_margin (): Margins in width in normalized units (0...1)
17 | % or [left right] for different left and right margins
18 | %
19 | % Output:
20 | % - handles (matrix): Matrix of handles for the axes objects
21 | % starting from upper left corner, going row-wise as in
22 | % going row-wise as in.
23 | %
24 |
25 | if nargin<3; gap = .02; end
26 | if nargin<4 || isempty(row_margin); row_margin = .05; end
27 | if nargin<5; column_margin = .05; end
28 |
29 | if numel(gap)==1;
30 | gap = [gap gap];
31 | end
32 | if numel(column_margin)==1;
33 | column_margin = [column_margin column_margin];
34 | end
35 | if numel(row_margin)==1;
36 | row_margin = [row_margin row_margin];
37 | end
38 |
39 | axh = (1-sum(row_margin)-(rows-1)*gap(1))/rows;
40 | axw = (1-sum(column_margin)-(columns-1)*gap(2))/columns;
41 |
42 | py = 1-row_margin(2)-axh;
43 |
44 | handles = zeros(rows*columns,1);
45 | ii = 0;
46 | for ih = 1:rows
47 | px = column_margin(1);
48 |
49 | for ix = 1:columns
50 | ii = ii+1;
51 | handles(ii) = axes('Units','normalized', ...
52 | 'Position',[px py axw axh], ...
53 | 'XTickLabel','', ...
54 | 'YTickLabel',''); %#ok
55 | px = px+axw+gap(2);
56 | end
57 | py = py-axh-gap(1);
58 | end
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/sequence_transform_initialization.m:
--------------------------------------------------------------------------------
1 | function tranform_sequence = sequence_transform_initialization(sequence, transform, format)
2 | % sequence_transform_initialization Returns sequence with transformed initialization
3 | %
4 | % This sequence converter returns a sequence that has a modified initialize handler that
5 | % transforms the region before handing it over to the tracker. This can be used to
6 | % to introduce noise.
7 | %
8 | % Input:
9 | % - sequence (structure): A valid sequence structure.
10 | % - transform (function): A handle of transformation function.
11 | % - format (string, optional): Region format identifier for coercion.
12 | %
13 | % Output:
14 | % - tranform_sequence (structure): A sequence descriptor of a converted sequence.
15 |
16 | if nargin < 3
17 | format = [];
18 | end;
19 |
20 | tranform_sequence = sequence;
21 | tranform_sequence.initialize = @transform_initialization;
22 | tranform_sequence.initialize_transform = transform;
23 | tranform_sequence.initialize_format = format;
24 |
25 | end
26 |
27 | function [region] = transform_initialization(sequence, index, context)
28 |
29 | region = get_region(sequence, index);
30 |
31 | transform = sequence.initialize_transform(sequence, index, context);
32 |
33 | if size(transform, 1) ~= 3 || size(transform, 2) ~= 3
34 | return;
35 | end;
36 |
37 | bounds = region_convert(region, 'rectangle');
38 |
39 | origin = bounds(1:2) + bounds(3:4) / 2;
40 |
41 | shift = [1, 0, origin(1); 0, 1, origin(2); 0, 0, 1];
42 |
43 | transform = shift * transform / shift;
44 |
45 | if isnumeric(region)
46 | polygon = region_convert(region, 'polygon');
47 |
48 | region = cat(2, reshape(polygon, 2, numel(polygon) / 2)', ...
49 | ones(numel(polygon) / 2 , 1));
50 |
51 | region = transform * region';
52 | region = reshape(region(1:2, :), 1, numel(polygon));
53 |
54 | end;
55 |
56 | if ~isempty(sequence.initialize_format)
57 | region = region_convert(region, sequence.initialize_format);
58 | end;
59 |
60 | end
61 |
--------------------------------------------------------------------------------
/vot-toolkit-master/analysis/normalize_speed.m:
--------------------------------------------------------------------------------
1 | function [normalized_speed, actual_speed] = normalize_speed(speed, failures, skipping, tracker, sequence)
2 | % normalize_speed Normalizes tracker speed estimate
3 | %
4 | % This function normalizes speed estimates based on performance profile and some information about
5 | % the way the measurement was obtained (sequence, number of failures, frame skipping).
6 | %
7 | % Input:
8 | % - speed (double): The initial speed estimate.
9 | % - failures (double): Number of failures of the tracker.
10 | % - skipping (integer): Number of skipped frames after each failure.
11 | % - tracker (structure): A valid tracker descriptor.
12 | % - sequence (structure): A valid sequence descriptor.
13 | %
14 | % Output:
15 | % - normalized_speed (double): Normalized speed estimate.
16 | % - actual_speed (double): Corrected raw speed based on supplied information,
17 | %
18 |
19 | if ~isfield(tracker, 'performance')
20 | error('Tracker %s has no performance profile, unable to normalize speed.', tracker.identifier);
21 | end;
22 |
23 | performance = tracker.performance;
24 |
25 | factor = performance.nonlinear_native;
26 | startup = 0;
27 |
28 | if strcmpi(tracker.interpreter, 'matlab')
29 | if isfield(performance, 'matlab_startup')
30 | startup = performance.matlab_startup;
31 | else
32 | model = get_global_variable('matlab_startup_model', []);
33 | if ~isempty(model)
34 | startup = model(1) * performance.reading + model(2);
35 | end;
36 | end;
37 | end
38 |
39 | failure_count = cellfun(@(x) numel(x), failures, 'UniformOutput', true);
40 |
41 | if tracker.trax
42 | actual_length = sequence.length - (skipping - 1) * failure_count;
43 | full_length = sequence.length;
44 | startup_time = startup * (1 + failure_count);
45 | else
46 | full_length = cellfun(@(x) sum(sequence.length - x - (skipping - 1)), failures, 'UniformOutput', true) + sequence.length;
47 | actual_length = full_length;
48 | startup_time = startup * (1 + failure_count);
49 | end;
50 |
51 | actual_speed = (((speed .* full_length) - startup_time) ./ actual_length);
52 | normalized_speed = actual_speed / factor;
53 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/generate_python_command.m:
--------------------------------------------------------------------------------
1 | function command = generate_python_command(script, paths)
2 | % generate_python_command Generate command line for a Python tracker
3 | %
4 | % This function generates the appropritate command string that will
5 | % run the python executable and execute the given script that includes your
6 | % tracker implementation.
7 | %
8 | % Input:
9 | % - script (string): Name of the tracker script to be executed.
10 | % - paths (cell): An array of strings that denote directories to be added to Matlab path.
11 | %
12 | % Output:
13 | % - command (string): Generated command string.
14 | %
15 |
16 | trax_python = get_global_variable('trax_python');
17 | python_exec = get_global_variable('python');
18 |
19 | % If path to python trax implementatin is set then we attempt to export it to tracker
20 | if ~isempty(trax_python)
21 | paths = cat(1, {trax_python}, paths);
22 | end
23 |
24 | path_string = strjoin(cellfun(@(p) sprintf('sys.path.append(''%s'');', p), paths, 'UniformOutput', false), '');
25 |
26 | % Attempt to locate python interpreter
27 | if isempty(python_exec)
28 | if ispc()
29 | path_separator = ';';
30 | exec_name = 'python.exe';
31 | else
32 | path_separator = ':';
33 | exec_name = 'python';
34 | end
35 |
36 | system_paths = strsplit(getenv('PATH'), path_separator);
37 |
38 | for i = 1:numel(system_paths)
39 | if exist(fullfile(system_paths{i}, exec_name), 'file') == 2
40 | python_exec = fullfile(system_paths{i}, exec_name);
41 | break;
42 | end
43 | end
44 |
45 | end
46 |
47 | if isempty(python_exec)
48 | error('Unable to locate Python interpreter, please set the "python" global variable manually.');
49 | end
50 |
51 | if ispc()
52 | python_executable = ['"', python_exec, '"'];
53 | python_flags = {};
54 | else
55 | python_executable = python_exec;
56 | python_flags = {};
57 | end
58 |
59 | argument_string = strjoin(python_flags, ' ');
60 |
61 | python_script = sprintf('import sys; %s import %s', path_string, script);
62 |
63 | command = sprintf('%s %s -c "%s"', python_executable, argument_string, python_script);
64 |
--------------------------------------------------------------------------------
/vot-toolkit-master/vot-workspace/tracker/kcf/external.txt:
--------------------------------------------------------------------------------
1 |
2 | NOTE: The following files are part of Piotr's Toolbox, and are provided for
3 | convenience only:
4 |
5 | fhog.m
6 | gradientMex.mexa64
7 | gradientMex.mexw64
8 |
9 | You are encouraged to get the full version of this excellent library, at which
10 | point they can be safely deleted.
11 |
12 | Piotr's Toolbox (3.25) -- http://vision.ucsd.edu/~pdollar/toolbox/doc/index.html
13 |
14 |
15 | _______________________________________________________________________________
16 |
17 | Copyright (c) 2012, Piotr Dollar
18 | All rights reserved.
19 |
20 | Redistribution and use in source and binary forms, with or without
21 | modification, are permitted provided that the following conditions are met:
22 |
23 | 1. Redistributions of source code must retain the above copyright notice, this
24 | list of conditions and the following disclaimer.
25 | 2. Redistributions in binary form must reproduce the above copyright notice,
26 | this list of conditions and the following disclaimer in the documentation
27 | and/or other materials provided with the distribution.
28 |
29 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
32 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
33 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
36 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 |
40 | The views and conclusions contained in the software and documentation are those
41 | of the authors and should not be interpreted as representing official policies,
42 | either expressed or implied, of the FreeBSD Project.
43 |
44 |
--------------------------------------------------------------------------------
/vot-toolkit-master/stacks/stack_vot2013_extra.m:
--------------------------------------------------------------------------------
1 | function experiments = stack_vot2013_extra()
2 |
3 | set_global_variable('bundle', 'http://data.votchallenge.net/vot2013/vot2013.zip');
4 | set_global_variable('legacy_rasterization', true);
5 | set_global_variable('bounded_overlap', false);
6 |
7 | basic_experiments = stack_vot2013();
8 |
9 | loss_black.name = 'loss_black';
10 | loss_black.converter = @(x) sequence_pixelchange(x, @(I, L, i, len) ...
11 | deal(iff(mod(i, 5) == 0, zeros(size(I)), I), iff(mod(i, 5) == 0, ...
12 | union(L, {'hidden'}), L)), 'loss_black');
13 | loss_black.type = 'supervised';
14 | loss_black.tags = {'camera_motion', 'illum_change', 'occlusion', 'size', ...
15 | 'motion', 'empty'};
16 | loss_black.parameters.repetitions = 15;
17 | loss_black.parameters.burnin = 10;
18 | loss_black.parameters.skip_initialize = 5;
19 | loss_black.parameters.skip_tags = {'hidden'};
20 | loss_black.parameters.failure_overlap = 0;
21 |
22 | skipping.name = 'skipping';
23 | skipping.converter = @(s) sequence_skipping(s, 2, 2);
24 | skipping.type = 'supervised';
25 | skipping.tags = {'camera_motion', 'illum_change', 'occlusion', 'size', ...
26 | 'motion', 'empty'};
27 | skipping.parameters.repetitions = 15;
28 | skipping.parameters.burnin = 10;
29 | skipping.parameters.skip_initialize = 5;
30 | skipping.parameters.failure_overlap = 0;
31 |
32 | resize.name = 'resize';
33 | resize.converter = @(s) sequence_resize(s, 0.6);
34 | resize.type = 'supervised';
35 | resize.tags = {'camera_motion', 'illum_change', 'occlusion', 'size', ...
36 | 'motion', 'empty'};
37 | resize.parameters.repetitions = 15;
38 | resize.parameters.burnin = 10;
39 | resize.parameters.skip_initialize = 5;
40 | resize.parameters.failure_overlap = 0;
41 |
42 | reverse.name = 'reverse';
43 | reverse.converter = 'sequence_reverse';
44 | reverse.type = 'supervised';
45 | reverse.tags = {'camera_motion', 'illum_change', 'occlusion', 'size', ...
46 | 'motion', 'empty'};
47 | reverse.parameters.repetitions = 15;
48 | reverse.parameters.burnin = 10;
49 | reverse.parameters.skip_initialize = 5;
50 | reverse.parameters.failure_overlap = 0;
51 |
52 | experiments = {loss_black, skipping, resize, reverse};
53 |
54 | experiments = [basic_experiments, experiments];
55 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/parsefile.m:
--------------------------------------------------------------------------------
1 | function data = parsefile(filename, varargin)
2 | % parsefile Parse a file to a cell array
3 | %
4 | % A general purpose function that parses a file into a cell array of
5 | % elements based on a delimiter string and a parser function.
6 | %
7 | % Input:
8 | % - filename ():
9 | % - varargin[Delimiter] (string): An element delimiter string.
10 | % - varargin[Parser] (function): A parser function that receives text data
11 | % for an element and returns parsed content.
12 | %
13 | % Output:
14 | % - data (cell): Resulting cell array.
15 | %
16 |
17 |
18 | parser = @default_cell_parser;
19 |
20 | delimiter = ',';
21 |
22 | for i = 1:2:length(varargin)
23 | switch lower(varargin{i})
24 | case 'delimiter'
25 | delimiter = varargin{i+1};
26 | case 'parser'
27 | parser = varargin{i+1};
28 |
29 | otherwise
30 | error(['Unknown switch ', varargin{i},'!']) ;
31 | end
32 | end
33 |
34 |
35 | % Initialize the variable output argument
36 | data = cell(0, 0);
37 |
38 | fid = fopen(filename, 'r');
39 |
40 | lineindex = 0;
41 |
42 | while true
43 | % Get the current line
44 | line = fgetl(fid);
45 |
46 | % Stop if EOF
47 | if line == -1
48 | break;
49 | end
50 |
51 | lineindex = lineindex + 1;
52 |
53 | % Split the line string into components and parse numbers
54 | p = strfind(line, delimiter);
55 | if ~isempty(p)
56 | nt = numel(p) + 1;
57 | elements = cell(1, nt);
58 | sp = 1;
59 | dl = length(delimiter);
60 | for i = 1 : nt-1
61 | elements{i} = strtrim(line(sp:p(i)-1));
62 | sp = p(i) + dl;
63 | end
64 | elements{nt} = strtrim(line(sp:end));
65 | else
66 | elements = {line};
67 | end
68 |
69 | parsed = cellfun(parser, elements, 'UniformOutput', false);
70 |
71 | if (lineindex == 1)
72 | data = parsed;
73 | else
74 | data(lineindex, :) = parsed;
75 | end
76 |
77 | end;
78 |
79 | end
80 |
81 | function [value] = default_cell_parser(text)
82 |
83 | value = str2double(text);
84 |
85 | if isnan(value)
86 | value = text;
87 | end
88 |
89 | end
90 |
91 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/examples/python/python_ncc.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 |
3 | import vot
4 | import sys
5 | import time
6 | import cv2
7 | import numpy
8 | import collections
9 |
10 | class NCCTracker(object):
11 |
12 | def __init__(self, image, region):
13 | self.window = max(region.width, region.height) * 2
14 |
15 | left = max(region.x, 0)
16 | top = max(region.y, 0)
17 |
18 | right = min(region.x + region.width, image.shape[1] - 1)
19 | bottom = min(region.y + region.height, image.shape[0] - 1)
20 |
21 | self.template = image[int(top):int(bottom), int(left):int(right)]
22 | self.position = (region.x + region.width / 2, region.y + region.height / 2)
23 | self.size = (region.width, region.height)
24 |
25 | def track(self, image):
26 |
27 | left = max(round(self.position[0] - float(self.window) / 2), 0)
28 | top = max(round(self.position[1] - float(self.window) / 2), 0)
29 |
30 | right = min(round(self.position[0] + float(self.window) / 2), image.shape[1] - 1)
31 | bottom = min(round(self.position[1] + float(self.window) / 2), image.shape[0] - 1)
32 |
33 | if right - left < self.template.shape[1] or bottom - top < self.template.shape[0]:
34 | return vot.Rectangle(self.position[0] + self.size[0] / 2, self.position[1] + self.size[1] / 2, self.size[0], self.size[1])
35 |
36 | cut = image[int(top):int(bottom), int(left):int(right)]
37 |
38 | matches = cv2.matchTemplate(cut, self.template, cv2.TM_CCOEFF_NORMED)
39 | min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(matches)
40 |
41 | self.position = (left + max_loc[0] + float(self.size[0]) / 2, top + max_loc[1] + float(self.size[1]) / 2)
42 |
43 | return vot.Rectangle(left + max_loc[0], top + max_loc[1], self.size[0], self.size[1])
44 |
45 | handle = vot.VOT("rectangle")
46 | selection = handle.region()
47 |
48 | imagefile = handle.frame()
49 | if not imagefile:
50 | sys.exit(0)
51 |
52 | image = cv2.imread(imagefile, cv2.IMREAD_GRAYSCALE)
53 | tracker = NCCTracker(image, selection)
54 | while True:
55 | imagefile = handle.frame()
56 | if not imagefile:
57 | break
58 | image = cv2.imread(imagefile, cv2.IMREAD_GRAYSCALE)
59 | region = tracker.track(image)
60 | handle.report(region)
61 |
62 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/load_sequences.m:
--------------------------------------------------------------------------------
1 | function sequences = load_sequences(directory, varargin)
2 | % load_sequences Load a set of sequences
3 | %
4 | % Create a cell array of new sequence structures for sequences, specified in a listing file.
5 | %
6 | % Input:
7 | % - directory: Path to the directory with sequences.
8 | % - varargin[List]: Name of the file that lists all the sequences. By default `list.txt` is used.
9 | % - varargin[Dummy]: Create the sequence structures without checking if all the images exist.
10 | %
11 | % Output:
12 | % - sequences: A cell array of new sequence structures.
13 |
14 | list = 'list.txt';
15 | dummy = false;
16 |
17 | for i = 1:2:length(varargin)
18 | switch lower(varargin{i})
19 | case 'list'
20 | list = varargin{i+1};
21 | case 'dummy'
22 | dummy = varargin{i+1};
23 | otherwise
24 | error(['Unknown switch ', varargin{i},'!']) ;
25 | end
26 | end
27 |
28 | list_file = fullfile(directory, list);
29 |
30 | sequences = cell(0);
31 |
32 | mkpath(directory);
33 |
34 | bundle_url = get_global_variable('bundle');
35 |
36 | if ~exist(list_file, 'file') && ~isempty(bundle_url)
37 | print_text('Downloading sequence bundle from "%s". This may take a while ...', bundle_url);
38 | bundle = [tempname, '.zip'];
39 | try
40 | urlwrite(bundle_url, bundle);
41 | unzip(bundle, directory);
42 | delete(bundle);
43 | list_file = fullfile(directory, 'list.txt');
44 | catch
45 | print_text('Unable to retrieve sequence bundle from the server. This is either a connection problem or the server is temporary offline.');
46 | print_text('Please try to download the bundle manually from %s and uncompress it to %s', bundle_url, directory);
47 | return;
48 | end;
49 | end;
50 |
51 | fid = fopen(list_file, 'r');
52 |
53 | while true
54 | sequence_name = fgetl(fid);
55 | if sequence_name == -1
56 | break;
57 | end
58 |
59 | sequence_directory = fullfile(directory, sequence_name);
60 |
61 | if ~exist(sequence_directory, 'dir')
62 | continue;
63 | end;
64 |
65 | print_debug('Loading sequence %s', sequence_name);
66 |
67 | sequences{end+1} = create_sequence(sequence_directory, 'dummy', dummy); %#ok
68 |
69 | end;
70 |
71 | fclose(fid);
72 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/sequence_resize.m:
--------------------------------------------------------------------------------
1 | function [resized_sequence] = sequence_resize(sequence, ratio)
2 | % sequence_resize Returns resized sequence
3 | %
4 | % This sequence converter returns a sequence with resized frames and annotations.
5 | %
6 | % Cache notice: The results of this function are cached in the workspace cache directory.
7 | %
8 | % Input:
9 | % - sequence (structure): A valid sequence structure.
10 | % - ratio (double): Resize ratio (between 10 and 0.1)
11 | %
12 | % Output:
13 | % - resized_sequence (structure): A sequence descriptor of a converted sequence.
14 |
15 | ratio = min(10, max(0.1, ratio));
16 |
17 | cache_directory = fullfile(get_global_variable('directory'), 'cache', ...
18 | sprintf('resize_%.2f', ratio), sequence.name);
19 |
20 | mkpath(cache_directory);
21 |
22 | cache_groundtruth = fullfile(cache_directory, 'groundtruth.txt');
23 |
24 | sequence_groundtruth = fullfile(sequence.directory, 'groundtruth.txt');
25 |
26 | if file_newer_than(cache_groundtruth, sequence_groundtruth)
27 | resized_sequence = create_sequence(cache_directory, 'name', sequence.name);
28 | resized_sequence.tags.names = sequence.tags.names;
29 | resized_sequence.tags.data = sequence.tags.data;
30 | resized_sequence.values.names = sequence.values.names;
31 | resized_sequence.values.data = sequence.values.data;
32 | return;
33 | end;
34 |
35 | print_debug('Generating cached resized sequence ''%s'' for scaling factor %.2f...', sequence.name, ratio);
36 |
37 | for i = 1:sequence.length
38 |
39 | color_image = imread(get_image(sequence, i));
40 |
41 | scaled_image = imresize(color_image, ratio);
42 |
43 | imwrite(scaled_image, fullfile(cache_directory, sprintf('%08d.jpg', i)));
44 |
45 | end;
46 |
47 | function region = rescale_region(region)
48 |
49 | if numel(region) > 3
50 | region = region .* ratio;
51 | end;
52 |
53 | end
54 |
55 | write_trajectory(cache_groundtruth, cellfun(@(x) rescale_region(x), sequence.groundtruth, 'UniformOutput', false));
56 |
57 | resized_sequence = create_sequence(cache_directory, 'name', sequence.name);
58 |
59 | resized_sequence.tags.names = sequence.tags.names;
60 | resized_sequence.tags.data = sequence.tags.data;
61 | resized_sequence.values.names = sequence.values.names;
62 | resized_sequence.values.data = sequence.values.data;
63 |
64 | end
65 |
--------------------------------------------------------------------------------
/vot-toolkit-master/report/create_report_context.m:
--------------------------------------------------------------------------------
1 | function context = create_report_context(name, varargin)
2 | % create_report_context Create report context structure
3 | %
4 | % Creates a new report context structure that can be used to generate
5 | % report documents.
6 | %
7 | % Input:
8 | % - name (string): Name of the report. Is used to name a directory where the report is stored in.
9 | % - varargin[Title] (string): A human-friendly name of the report. May be more verbose than report name.
10 | % - varargin[FigureEPS] (boolean): Should the report also generate formaps in Encapsulated PostScript (for LaTeX).
11 | % - varargin[FigureRaw] (boolean): Should internal raw figures and data also be saved for future processing.
12 | % - varargin[Standalone] (boolean): If true (default), the JavaScript and CSS resources are copied to the report.
13 | % - varargin[Cache] (boolean): Should cache be used.
14 | %
15 | % Output:
16 | % - context (structure): A report context structure.
17 | %
18 |
19 |
20 | title = name;
21 | figure_eps = false;
22 | figure_raw = false;
23 | standalone = true;
24 | cache = false;
25 |
26 | for i = 1:2:length(varargin)
27 | switch lower(varargin{i})
28 | case 'title'
29 | title = varargin{i+1};
30 | case 'figureeps'
31 | figure_eps = varargin{i+1};
32 | case 'figureraw'
33 | figure_raw = varargin{i+1};
34 | case 'standalone'
35 | standalone = varargin{i+1};
36 | case 'cache'
37 | cache = varargin{i+1};
38 | otherwise
39 | error(['Unknown switch ', varargin{i}, '!']) ;
40 | end
41 | end
42 |
43 |
44 | context.root = fullfile(get_global_variable('directory'), 'reports', name);
45 | context.images = fullfile(context.root, 'images');
46 | context.raw = fullfile(context.root, 'raw');
47 | context.data = fullfile(context.root, 'data');
48 | context.exporteps = figure_eps;
49 | context.exportraw = figure_raw;
50 | context.standalone = standalone;
51 | context.prefix = '';
52 | context.imagesurl = 'images';
53 | context.rawurl = 'raw';
54 | context.dataurl = 'data';
55 | context.title = title;
56 | context.cache = cache;
57 |
58 | mkpath(context.root);
59 | mkpath(context.images);
60 | mkpath(context.data);
61 | mkpath(context.raw);
62 |
63 | context.cachedir = fullfile(context.root, 'cache');
64 | mkpath(context.cachedir);
65 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/tracker_evaluate.m:
--------------------------------------------------------------------------------
1 | function [files, metadata] = tracker_evaluate(tracker, sequence, experiment, varargin)
2 | % tracker_evaluate Evaluates a tracker on a given sequence for a given experiment
3 | %
4 | % The core function of experimental evaluation. This function can perform various
5 | % types of experiments or result gathering. The data is stored to the specified
6 | % directory.
7 | %
8 | % Experiment types:
9 | % - supervised: Repeats running a tracker on a given sequence for a number of
10 | % times, taking into account its potential deterministic nature and
11 | % various properties of experiments.
12 | %
13 | % Input:
14 | % - tracker (struct): Tracker structure.
15 | % - sequence (struct): Sequence structure.
16 | % - expetiment (struct): Experiment structure.
17 | % - varargin[Scan] (boolean): Do not evaluate the tracker but simply scan the directory
18 | % for files that are generated and return their list.
19 | % - varargin[Persist] (boolean): Do not throw error even if one was encountered during
20 | % executuon of the experiment.
21 | %
22 | % Output:
23 | % - files (cell): An array of files that were generated during the evaluation.
24 | % - metadata (struct): Additional information about the evaluation.
25 |
26 | scan = false;
27 | files = {};
28 | metadata.completed = true;
29 | persist = false;
30 |
31 | for j=1:2:length(varargin)
32 | switch lower(varargin{j})
33 | case 'scan', scan = varargin{j+1};
34 | case 'persist', persist = varargin{j+1};
35 | otherwise, error(['unrecognized argument ' varargin{j}]);
36 | end
37 | end
38 |
39 | parameters = struct();
40 | if isfield(experiment, 'parameters')
41 | parameters = experiment.parameters;
42 | end;
43 |
44 | directory = fullfile(tracker.directory, experiment.name, sequence.name);
45 | mkpath(directory);
46 |
47 | experiment_type = experiment.type;
48 |
49 | if exist(['experiment_', experiment_type]) ~= 2 %#ok
50 | error('Experiment %s not available.', experiment_type);
51 | end;
52 |
53 | experiment_function = str2func(['experiment_', experiment_type]);
54 |
55 | try
56 |
57 | [files, metadata] = experiment_function(tracker, sequence, directory, parameters, scan);
58 |
59 | catch e
60 | metadata.completed = false;
61 |
62 | if ~persist
63 | rethrow(e);
64 | end
65 | end
66 |
67 | end
68 |
--------------------------------------------------------------------------------
/vot-toolkit-master/report/generate_timeline.m:
--------------------------------------------------------------------------------
1 | function [handles] = generate_timeline(tracks, starts, ends, varargin)
2 | % generate_timeline Generate a timeline plot with intervals.
3 | %
4 | % Draws horizontal timeline in the current axes. The name of each track
5 | % appears as a label on the y-axis. Each element of the starts and
6 | % ends cell arrays is itself an array, so each track can start and
7 | % stop either once or many times.
8 | %
9 | % Credit: Kevin Bartlett (kpb@uvic.ca), 2012
10 | %
11 | % Input:
12 | % - tracks (cell): An array of timeline track names.
13 | % - starts (cell): An array of vectors that indicate segment starts.
14 | % - ends (cell): An array of vectors that indicate segment ends.
15 | % - varargin[LineSpacing] (double): A number between 0 and 1, places
16 | % adjacent timelines the specified fraction of the line widths apart.
17 | % - varargin[Color] (char): Color identifier for fill color.
18 | %
19 | % Output:
20 | % - handles (cell): Handles of all segment rectangles.
21 | %
22 |
23 | line_spacing = 1/4;
24 | face_color = 'r';
25 |
26 | args = varargin;
27 | for j = 1:2:length(args)
28 | switch lower(varargin{j})
29 | case 'linespacing', line_spacing = args{j+1};
30 | case 'color', face_color = args{j+1};
31 | otherwise, error(['Unknown switch ', varargin{j},'!']) ;
32 | end
33 | end
34 |
35 | if line_spacing < 0 || line_spacing >= 1
36 | error('Line spacing must be between 0 and 1.');
37 | end
38 |
39 | tracks_number = length(tracks);
40 |
41 | line_height = 1;
42 | corner_y = (line_spacing + line_height) * 0:(tracks_number-1);
43 | set(gca,'ylim',[0 max(corner_y)+line_height])
44 | handles = cell(1, tracks_number);
45 |
46 | for i = 1:tracks_number
47 | track_starts = starts{i};
48 | track_ends = ends{i};
49 | track_y = corner_y(i);
50 | segments_number = length(track_starts);
51 | track_segments = nan(1, segments_number);
52 |
53 | for j = 1:segments_number
54 | segment_x = [track_starts(j) track_ends(j) track_ends(j) track_starts(j) track_starts(j)];
55 | segment_y = [track_y track_y track_y+line_height track_y+line_height track_y];
56 | track_segments(j) = patch(segment_x, segment_y, face_color);
57 | end
58 |
59 | handles{i} = track_segments;
60 |
61 | end
62 |
63 | set(gca,'ytick',corner_y+0.5*line_height,'yticklabel',tracks,'ylim', [0, numel(tracks)+1]);
64 | box on;
65 | set(gca,'ygrid','on');
66 |
67 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/index.md:
--------------------------------------------------------------------------------
1 | Utilities module
2 | ================
3 |
4 | This module contains general utility functions that are used all over the toolkit.
5 |
6 | Module functions
7 | ----------------
8 |
9 | ### Files
10 |
11 | - [parsefile](parsefile.m) - Parse a file to a cell array
12 | - [readstruct](readstruct.m) - Read a key-value file to a structure
13 | - [writestruct](writestruct.m) - Store a structure to file
14 | - [file_newer_than](file_newer_than.m) - Test if the first file is newer than the second file
15 | - [generate_from_template](generate_from_template.m) - Generate a new file from a template file
16 | - [delpath](delpath.m) - Deletes the file or directory recursively
17 | - [mkpath](mkpath.m) - Creates a directory path
18 | - [relativepath](relativepath.m) - Returns the relative path from an root path to the target path
19 | - [filewrite](filewrite.m) - Write a string to a file
20 |
21 | ### Figures
22 |
23 | - [plotc](is_octave.m) - Plot closed polygon
24 | - [sfigure](is_octave.m) - Silently creates a figure window
25 | - [export_figure](export_figure.m) - Export a figure to various formats
26 |
27 | ### General
28 |
29 | - [is_octave](is_octave.m) - Test if in GNU/Octave or Matlab
30 | - [iterate](iterate.m) - Iterates over experiment, tracker and sequence triplets
31 | - [iff](iff.m) - A simulation of inline conditional statement
32 | - [struct_merge](struct_merge.m) - Merges a from structure to another in a recursive manner
33 | - [format_interval](format_interval.m) - Format a time interval
34 | - [patch_operation](patch_operation.m) - Performs a point-wise operation with two unequal matrices
35 | - [initialize_native](initialize_native.m) - Initialize all native components
36 | - [compile_mex](compile_mex.m) - Compile given source files to a MEX function
37 |
38 | ### Strings
39 |
40 | - [md5hash](md5hash.m) - Calculate 128 bit MD5 checksum
41 | - [strjoin](strjoin.m) - Joins multiple strings
42 | - [strxcmp](strxcmp.m) - Advanced substring comparison
43 | - [json_encode](json_encode.m) - Encodes object to JSON string
44 | - [json_decode](json_decode.m) - Parses JSON string to an object
45 |
46 | ### Mathematics and statistics
47 |
48 | - [gmm_estimate](gmm_estimate.m) - Estimates a GMM on a set of points
49 | - [gmm_evaluate](gmm_evaluate.m) - Evaluates the GMM for a set of points
50 | - apcluster - Computers clusters on data using affinity propagation
51 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/patch_operation.m:
--------------------------------------------------------------------------------
1 | function [new, mask] = patch_operation(matrix, patch, offset, operation)
2 | % patch_operation Performs a point-wise operation with two unequal matrices
3 | %
4 | % Performs a point-wise operation (e.g. assignment, arithmetic) between two matrices
5 | % that are not of the same size with a given offset. The result has the size of the
6 | % first matrix and the outlying elements are left intact.
7 | %
8 | % Input:
9 | % - matrix (matrix): First operand matrix.
10 | % - patch (matrix): Second operand matrix.
11 | % - offset (vector): Two-element vector that defines the row and column offset of the second operand.
12 | % - operation (char): A char that defines the type of the operation.
13 | % - '+': addition
14 | % - '-': subraction
15 | % - '*': multiplication
16 | % - '/': division
17 | % - '=': assignment
18 | %
19 | % Output:
20 | % - new (matrix): Resulting matrix.
21 | % - mask (matrix): Binary mask of the elements that were affected by the operation.
22 | %
23 |
24 |
25 | if nargin < 4
26 | operation = '=';
27 | end;
28 |
29 | [w1, h1, d2] = size(matrix); %#ok<*NASGU>
30 | [w2, h2, d2] = size(patch);
31 |
32 | offset = int16(offset);
33 |
34 | xd1 = uint16(min([w1, max([offset(1), 1])]));
35 | xd2 = uint16(min([w1, max([offset(1) + w2 - 1, 1])]));
36 | yd1 = uint16(min([h1, max([offset(2), 1])]));
37 | yd2 = uint16(min([h1, max([offset(2) + h2 - 1, 1])]));
38 |
39 | xs1 = uint16(min([w2, max([-offset(1) + 2, 1])]));
40 | xs2 = uint16(min([w2, max([-offset(1) + w1 + 1, 1])]));
41 | ys1 = uint16(min([h2, max([-offset(2) + 2, 1])]));
42 | ys2 = uint16(min([h2, max([-offset(2) + h1 + 1, 1])]));
43 |
44 | if (xd1 > xd2 || yd1 > yd2)
45 | new = matrix;
46 | return;
47 | end;
48 |
49 | new = matrix;
50 |
51 | switch (operation)
52 | case '-'
53 | new(xd1:xd2, yd1:yd2, :) = new(xd1:xd2, yd1:yd2, :) - patch(xs1:xs2, ys1:ys2, :);
54 | case '+'
55 | new(xd1:xd2, yd1:yd2, :) = new(xd1:xd2, yd1:yd2, :) + patch(xs1:xs2, ys1:ys2, :);
56 | case '*'
57 | new(xd1:xd2, yd1:yd2, :) = new(xd1:xd2, yd1:yd2, :) .* patch(xs1:xs2, ys1:ys2, :);
58 | case '/'
59 | new(xd1:xd2, yd1:yd2, :) = new(xd1:xd2, yd1:yd2, :) ./ patch(xs1:xs2, ys1:ys2, :);
60 | case '='
61 | new(xd1:xd2, yd1:yd2, :) = patch(xs1:xs2, ys1:ys2, :);
62 | end;
63 |
64 | if (nargout > 1)
65 | mask = zeros(w1, h1);
66 | mask(xd1:xd2, yd1:yd2) = 1;
67 | end;
68 |
69 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/integration.md:
--------------------------------------------------------------------------------
1 | Tracker integration
2 | ===================
3 |
4 | This file describes the details about the tracker integration into the VOT toolkit. It is not written as a quick integration guide, but rather as a technical document that provides a lot of details about the integration. For a quick tutorial on integration you should check the [integration tutorial](http://votchallenge.net/howto/integration.html).
5 |
6 | When designing the integration interface the main goal was that the adaptation of a tracker should be as simple as possible for as many programming languages and operating systems as possible and that the separation between the evaluation logic and the tracker should be very clear. With the current version of the toolkit there is now only one way of integrating a tracker to the VOT toolkit evaluation environment, the [TraX protocol](https://github.com/votchallenge/trax/). The benefit of the protocol is faster and more flexibile execution of experiments. Since VOT2015 we are providing some common boilerplate code that makes it easy to transition form the previously supported file-based integration. Examples of using these wrappers are available in the toolkit repository.
7 |
8 | ## The TraX protocol
9 |
10 | Tracking eXchange protocol is a simple protocol that enables easier evaluation of computer vision tracking algorithms. The basic idea is that a tracker communicates with the evaluation software using a set of textual commands over the standard input/output streams of each process.
11 |
12 | Integration of TraX protocol into a C/C++ or Matlab tracker is quite simple as there are [examples](https://github.com/votchallenge/trax/tree/master/trackers) available in the repository of the reference implementation.
13 |
14 | VOT toolkit is tightly connected to the TraX reference implementation as it shares some native code with it. For the execution the toolkit uses a `traxclient` MEX library to execute a tracker and control it. This way the tracker can be monitored and reinitialized when required. While the TraX reference implementation source code is automatically downloaded and compiled by the toolkit (if a MEX compiler is properly configured), the native TraX library that is used for C/C++ trackers has to be compiled manually using [CMake](http://www.cmake.org/). If possible, the toolkit also downloads pre-compiled version of the libraries, however, it has been reported that this approach does not work all the time.
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/vot-toolkit-master/toolkit_version.m:
--------------------------------------------------------------------------------
1 | function version = toolkit_version(compare)
2 | % toolkit_version Version information for the toolkit, compare
3 | % versions
4 | %
5 | % Returns version information for the toolkit.
6 | %
7 | % Input:
8 | % - compare (string, optional): a version to compare against, if set
9 | % then the string is parsed and compared against toolkit version,
10 | % -1 is returned if it is lower, 1 if higher and 0 if equal.
11 | %
12 | % Output:
13 | % - version (structure): Structure containing version information.
14 | % - major (integer): Major version of the toolkit
15 | % - minor (integer): Minor version of the toolkit
16 | % - patch (integer): Patch version of the toolkit
17 |
18 | version = get_global_variable('toolkit_version');
19 |
20 | if isempty(version)
21 |
22 | version = struct('major', 0, 'minor', 0, 'patch', 0);
23 |
24 | try
25 |
26 | root = fileparts(mfilename('fullpath'));
27 |
28 | tokens = strsplit(fileread(fullfile(root, 'VERSION')), '.');
29 |
30 | version.major = int32(str2double(tokens{1}));
31 | version.minor = int32(str2double(tokens{2}));
32 | version.patch = int32(str2double(tokens{3}));
33 |
34 | set_global_variable('toolkit_version', version);
35 |
36 | catch
37 | error('Unable to parse version file');
38 | end
39 |
40 | end;
41 |
42 | if nargin > 0
43 |
44 | tokens = strsplit(strtrim(compare), '.');
45 |
46 | compare = struct('major', 0, 'minor', 0, 'patch', 0);
47 |
48 | if numel(compare) < 1
49 | error('Illegal version');
50 | end;
51 |
52 | try
53 |
54 | if numel(tokens) > 0
55 | compare.major = int32(str2double(tokens{1}));
56 | end
57 | if numel(tokens) > 1
58 | compare.minor = int32(str2double(tokens{2}));
59 | end
60 | if numel(tokens) > 2
61 | compare.patch = int32(str2double(tokens{3}));
62 | end
63 |
64 | catch
65 | error('Unable to parse version string');
66 | end
67 |
68 | if version.major > compare.major; version = -1; return; end;
69 | if version.major < compare.major; version = 1; return; end;
70 | if version.minor > compare.minor; version = -1; return; end;
71 | if version.minor < compare.minor; version = 1; return; end;
72 | if version.patch > compare.patch; version = -1; return; end;
73 | if version.patch < compare.patch; version = 1; return; end;
74 |
75 | version = 0;
76 |
77 | end
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/export_figure.m:
--------------------------------------------------------------------------------
1 | function fullpath = export_figure(handle, filename, format, varargin)
2 | % export_figure Export a figure to various formats
3 | %
4 | % Utility function that exports a figure to various formats taking care
5 | % of caching as well as some other options.
6 | %
7 | % Input:
8 | % - handle (handle): Handle of a figure.
9 | % - filename (string): Filename of the target file without extension.
10 | % - format (string): Target format (fig, eps or png).
11 | % - varargin[Cache] (boolean): Use caching. Disabled by default.
12 | %
13 | % Output:
14 | % - fullpath (string): Path to the resulting file.
15 | %
16 |
17 |
18 | cache = false;
19 |
20 | for i = 1:2:length(varargin)
21 | switch lower(varargin{i})
22 | case 'cache'
23 | cache = varargin{i+1};
24 | otherwise
25 | error(['Unknown switch ', varargin{i},'!']) ;
26 | end
27 | end
28 |
29 | fullpath = [filename, '.', format];
30 |
31 | if isa(handle, 'function_handle')
32 | autoclose = true;
33 | cache = true;
34 | else
35 | autoclose = false;
36 | end
37 |
38 | if cache && exist(fullpath, 'file')
39 | return;
40 | end;
41 |
42 | if isa(handle, 'function_handle')
43 | handle = handle();
44 | end;
45 |
46 | switch lower(format)
47 | case 'fig'
48 | saveas(handle, filename, 'fig');
49 | case 'eps'
50 | allca = num2cell(findall(handle, 'type', 'axes'));
51 | allbackup = cellfun(@update_axis, allca, 'UniformOutput', false);
52 | print( handle, '-depsc', [filename, '.eps']);
53 | cellfun(@restore_axis, allca, allbackup, 'UniformOutput', false);
54 | case 'png'
55 | ah = get(handle, 'CurrentAxes');
56 | title = get(ah, 'Title');
57 | set(title, 'Visible', 'off');
58 | print( handle, '-dpng', '-r130', [filename, '.png']);
59 | set(title, 'Visible', 'on');
60 | otherwise
61 | error('Unknown format');
62 | end;
63 |
64 | if autoclose
65 | close(handle);
66 | end
67 |
68 | end
69 |
70 | function [backup] = update_axis(ha)
71 | backup.fontSize = get(ha, 'FontSize');
72 | backup.fontWeight = get(ha, 'FontWeight');
73 | backup.lineWidth = get(ha, 'LineWidth');
74 | set(ha, 'FontSize', 10, 'FontWeight', 'bold', 'LineWidth', 2);
75 | end
76 |
77 | function [backup] = restore_axis(ha, backup)
78 | set(ha, 'FontSize', backup.fontSize, 'FontWeight', backup.fontWeight, 'LineWidth', backup.lineWidth);
79 | end
80 |
--------------------------------------------------------------------------------
/vot-toolkit-master/report/resources/css/report.css:
--------------------------------------------------------------------------------
1 |
2 | body {
3 | position: relative;
4 | }
5 |
6 | footer {
7 | clear: both;
8 | padding-top: 60px;
9 | text-align: center;
10 | }
11 |
12 | .poweredby {
13 | padding-top: 30px;
14 | padding-bottom: 30px;
15 | text-align: center;
16 | font-size: small;
17 | color: #AAA;
18 | }
19 |
20 | body > .container {
21 | margin-top: 60px;
22 |
23 | }
24 |
25 | footer ul.metadata {
26 | color: #AAA;
27 | font-size: 80%;
28 | margin: 10px;
29 | padding: 0;
30 | list-style: none;
31 | }
32 |
33 | footer ul.metadata li {
34 | display: inline-block;
35 | padding: 0;
36 | margin: 5px;
37 | }
38 |
39 |
40 | td.first { font-weight: bold; color: red; }
41 | td.second { font-weight: bold; color: blue; }
42 | td.third { color: green; }
43 |
44 | td.good { color: green; }
45 | td.average { color: gray; }
46 | td.bad { color: red; }
47 |
48 | .image-wrapper { border: 1px #eeeeee solid; padding: 10px; margin-bottom: 20px; position: relative; }
49 | .image-wrapper img { width: 100%; }
50 | .image-wrapper .title { text-align: center; font-size: 140%; display: block; margin-top: 20px; }
51 | .image-wrapper .toolbar {
52 | position: absolute;
53 | top: 5px;
54 | right: 5px;
55 | display: none;
56 | }
57 |
58 | .image-wrapper:hover .toolbar {
59 | display: block;
60 | }
61 |
62 | .image-wrapper .title:before {
63 | content: "Figure: ";
64 | }
65 |
66 | .table-wrapper {
67 | clear: both;
68 | margin: 40px 0;
69 | position: relative;
70 | }
71 |
72 | .table-wrapper table {
73 | clear: both;
74 | }
75 |
76 | .table-wrapper .title {
77 | font-size: 140%;
78 |
79 | }
80 |
81 | .table-wrapper .title:before {
82 | content: "Table: ";
83 | }
84 |
85 | .table-wrapper .toolbar {
86 | position: absolute;
87 | top: 0px;
88 | right: 5px;
89 | display: none;
90 | }
91 |
92 | .table-wrapper:hover .toolbar {
93 | display: block;
94 | }
95 |
96 | .toolbar .btn {
97 | margin-right: 5px;
98 | }
99 |
100 | /*body { font-size: 12px; margin: 20px; }
101 | th { background-color: #eeeeee; text-align: left; } td { min-width: 70px; } td .failures { font-weight: bold; display: block; } td .variance { font-size: 80%; font-weight: normal; } td .length { font-weight: bold; display: block; } td .count { float: right; } td .count:before { content: '('; } td .count:after { content: ')'; }
102 | tr:hover { background-color: #eeffff; }*/
103 |
104 |
--------------------------------------------------------------------------------
/vot-toolkit-master/analysis/analyze_failures.m:
--------------------------------------------------------------------------------
1 | function [failure_histograms] = analyze_failures(experiment, trackers, sequences)
2 | % analyze_failures Perform failure frequency analysis
3 | %
4 | % This function performs failure frequency analysis for a set of trackers
5 | % on a set of sequences and experiments.
6 | %
7 | % Input:
8 | % - experiment (cell): A cell array of valid experiment structures.
9 | % - trackers (cell): A cell array of valid tracker descriptor structures.
10 | % - sequences (cell): A cell array of valid sequence descriptor structures.
11 | %
12 | % Output:
13 | % - failure_histograms (cell): A cell array (one element for each experiment) of cell arrays (one for each sequence) of double matrices that contain per-frame failure frequencies for all trackers.
14 | %
15 |
16 | repeat = experiment.parameters.repetitions;
17 |
18 | print_text('Failure analysis for experiment %s ...', experiment.name);
19 |
20 | experiment_sequences = convert_sequences(sequences, experiment.converter);
21 |
22 | failure_histograms = cell(1, numel(experiment_sequences));
23 |
24 | for s = 1:length(experiment_sequences)
25 |
26 | print_indent(1);
27 |
28 | failure_histogram = zeros(numel(trackers), experiment_sequences{s}.length);
29 |
30 | print_text('Processing sequence %s ...', experiment_sequences{s}.name);
31 |
32 | for t = 1:length(trackers)
33 |
34 | print_indent(1);
35 |
36 | result_directory = fullfile(trackers{t}.directory, experiment.name, experiment_sequences{s}.name);
37 |
38 | for j = 1:repeat
39 |
40 | result_file = fullfile(result_directory, sprintf('%s_%03d.txt', experiment_sequences{s}.name, j));
41 |
42 | try
43 | trajectory = read_trajectory(result_file);
44 | catch
45 | continue;
46 | end;
47 |
48 | if length(trajectory) < experiment_sequences{s}.length
49 | trajectory{end+1:experiment_sequences{s}.length} = 0;
50 | end;
51 |
52 | [~, failures] = estimate_failures(trajectory, experiment_sequences{s});
53 | failures = failures(failures <= experiment_sequences{s}.length);
54 | failure_histogram(t, failures) = failure_histogram(t, failures) + 1;
55 |
56 | end;
57 |
58 | failure_histograms{s} = failure_histogram;
59 |
60 | print_indent(-1);
61 |
62 | end;
63 |
64 | print_indent(-1);
65 |
66 | end;
67 |
--------------------------------------------------------------------------------
/vot-toolkit-master/analysis/analyze_overlap.m:
--------------------------------------------------------------------------------
1 | function [result] = analyze_overlap(experiment, trackers, sequences, varargin)
2 | % analyze_expected_overlap Performs overlap analysis
3 | %
4 | % Performs overlap analysis for a given experiment on a set trackers and sequences.
5 | %
6 | % Input:
7 | % - experiment (structure): A valid experiment structures.
8 | % - trackers (cell): A cell array of valid tracker descriptor structures.
9 | % - sequences (cell): A cell array of valid sequence descriptor structures.
10 | % - varargin[Tags] (cell): An array of tag names that should be used
11 | % instead of sequences.
12 | %
13 | % Output:
14 | % - result (structure): A structure with the following fields
15 | % - curves: overlap threshold curves
16 | % - practical: corresponding practical differences
17 | % - lengths: lengths for which the expected overlap was evaluated
18 | %
19 |
20 | resolution = 100;
21 | tags = {};
22 |
23 | for i = 1:2:length(varargin)
24 | switch lower(varargin{i})
25 | case 'tags'
26 | tags = varargin{i+1};
27 | case 'resolution'
28 | resolution = varargin{i+1} ;
29 | otherwise
30 | error(['Unknown switch ', varargin{i},'!']) ;
31 | end
32 | end
33 |
34 | print_text('Overlap analysis for experiment %s ...', experiment.name);
35 |
36 | print_indent(1);
37 |
38 | experiment_sequences = convert_sequences(sequences, experiment.converter);
39 |
40 | if ~isempty(tags)
41 |
42 | tags = unique(tags); % Remove any potential duplicates.
43 |
44 | selectors = create_tag_selectors(experiment, ...
45 | experiment_sequences, tags);
46 |
47 | else
48 |
49 | selectors = create_sequence_selectors(experiment, experiment_sequences);
50 |
51 | end;
52 |
53 | result.thresholds = linspace(0, 1, resolution);
54 | result.curves = zeros(numel(trackers), numel(selectors), resolution);
55 | result.auc = zeros(numel(trackers), numel(selectors));
56 |
57 | for i = 1:numel(trackers)
58 |
59 | print_text('Tracker %s', trackers{i}.identifier);
60 |
61 | for s = 1:numel(selectors)
62 | [overlaps, ~] = selectors{s}.aggregate(experiment, trackers{i}, experiment_sequences);
63 | N = selectors{s}.length(experiment_sequences);
64 | overlaps(isnan(overlaps)) = 0;
65 |
66 | result.curves(i, s, :) = sum(bsxfun(@(x, y) x > y, overlaps', result.thresholds), 1) ./ N;
67 | result.auc(i, s) = mean(overlaps);
68 |
69 | end;
70 |
71 | end;
72 |
73 | print_indent(-1);
74 |
75 | end
76 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/examples/native/static.cpp:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * This is an example of a stationary tracker. It only reports the initial
4 | * position for all frames and is used for testing purposes.
5 | * The main function of this example is to show the developers how to modify
6 | * their trackers to work with the evaluation environment.
7 | *
8 | * Copyright (c) 2015, VOT Committee
9 | * All rights reserved.
10 | *
11 | * Redistribution and use in source and binary forms, with or without
12 | * modification, are permitted provided that the following conditions are met:
13 |
14 | * 1. Redistributions of source code must retain the above copyright notice, this
15 | * list of conditions and the following disclaimer.
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 |
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | * The views and conclusions contained in the software and documentation are those
32 | * of the authors and should not be interpreted as representing official policies,
33 | * either expressed or implied, of the FreeBSD Project.
34 | *
35 | */
36 |
37 | // Uncomment line below if you want to use rectangles
38 | // #define VOT_RECTANGLE
39 | #include "vot.h"
40 |
41 | int main(int argc, char* argv[])
42 | {
43 |
44 | // initialize handle object
45 | VOT vot;
46 |
47 | // get region and first frame
48 | VOTRegion region = vot.region();
49 | string path = vot.frame();
50 |
51 | //track
52 | while (true) {
53 | path = vot.frame();
54 | if (path.empty()) break;
55 | vot.report(region);
56 | }
57 |
58 | return 0;
59 | }
60 |
61 |
--------------------------------------------------------------------------------
/vot-toolkit-master/report/index.md:
--------------------------------------------------------------------------------
1 | Reporting module
2 | ================
3 |
4 | This module contains functions used in generation of reports and visualizations. Most reports rely on report context structure that provides a simple mechanism to generate multi-page reports in a `reports` directory in your workspace.
5 |
6 | Module functions
7 | ----------------
8 |
9 | ### Report
10 |
11 | - [create_report_context](create_report_context.m) - Create report context structure
12 | - [create_document](create_document.m) - Create a document handle
13 | - [report_challenge](report_challenge.m) - Generate an official challenge report
14 | - [report_article](report_article.m) - Generate an article friendly report
15 | - [report_ranking](report_ranking.m) - Generate a report based on A-R ranking
16 | - [report_submission](report_submission.m) - Basic performance scores for given trackers
17 | - [report_ranking_spotlight](report_ranking_spotlight.m) - Generate a spotlight report based on A-R ranking
18 | - [report_failures](report_failures.m) - Generate a statistic overview of occurences of failures
19 | - [report_difficulty](report_difficulty.m) - Generate a difficulty report for tags or sequences
20 | - [report_expected_overlap](report_expected_overlap.m) - Generate a report based on expected overlap
21 | - [report_sequences_preview](report_sequences_preview.m) - Create an overview document for the given sequences
22 | - [report_implementation](report_implementation.m) - Generate an overview of tracker implementations
23 |
24 | ### Resources and graphs
25 |
26 | - [generate_plot](generate_plot.m) - Generate an blank plot
27 | - [generate_ar_plot](generate_ar_plot.m) - Generate an A-R plot
28 | - [generate_ranking_plot](generate_ranking_plot.m) - Generate an A-R ranking plot
29 | - [generate_ordering_plot](generate_ordering_plot.m) - Generate a per-selector ordering plot
30 | - [generate_legend_plot](generate_legend_plot.m) - Generate a tracker legend plot
31 | - [generate_sequence_strip](generate_sequence_strip.m) - Generate an preview of a sequence as a strip of frames
32 | - [generate_timeline](generate_timeline.m) - Generate a timeline plot with intervals
33 | - [generate_sequence_preview](generate_sequence_preview.m) - Generates a sequence preview image
34 |
35 | ### Utilities
36 |
37 | - [report_cache](report_cache.m) - Cache proxy for report generation
38 | - [create_table_cell](create_table_cell.m) - Create a complex table cell structure
39 | - [highlight_best_rows](highlight_best_rows.m) - Adds highlight to the best three cells in a given
40 | - [tight_subplots](tight_subplots.m) - Initializes a grid of axes
41 | - [matrix2html](matrix2html.m) - Generates a HTML table for a given matrix
42 |
--------------------------------------------------------------------------------
/vot-toolkit-master/vot-workspace/tracker/kcf/show_video.m:
--------------------------------------------------------------------------------
1 | % function update_visualization_func = show_video(img_files, video_path, resize_image)
2 | function update_visualization_func = show_video(img_files, resize_image)
3 | %SHOW_VIDEO
4 | % Visualizes a tracker in an interactive figure, given a cell array of
5 | % image file names, their path, and whether to resize the images to
6 | % half size or not.
7 | %
8 | % This function returns an UPDATE_VISUALIZATION function handle, that
9 | % can be called with a frame number and a bounding box [x, y, width,
10 | % height], as soon as the results for a new frame have been calculated.
11 | % This way, your results are shown in real-time, but they are also
12 | % remembered so you can navigate and inspect the video afterwards.
13 | % Press 'Esc' to send a stop signal (returned by UPDATE_VISUALIZATION).
14 | %
15 | % Joao F. Henriques, 2014
16 | % http://www.isr.uc.pt/~henriques/
17 |
18 |
19 | %store one instance per frame
20 | num_frames = numel(img_files);
21 | boxes = cell(num_frames,1);
22 |
23 | %create window
24 | [fig_h, axes_h, unused, scroll] = videofig(num_frames, @redraw, [], [], @on_key_press); %#ok, unused outputs
25 | % set(fig_h, 'Number','off', 'Name', ['Tracker - ' video_path])
26 | set(fig_h, 'Name', 'Tracker - ')
27 | axis off;
28 |
29 | %image and rectangle handles start empty, they are initialized later
30 | im_h = [];
31 | rect_h = [];
32 |
33 | update_visualization_func = @update_visualization;
34 | stop_tracker = false;
35 |
36 |
37 | function stop = update_visualization(frame, box)
38 | %store the tracker instance for one frame, and show it. returns
39 | %true if processing should stop (user pressed 'Esc').
40 | boxes{frame} = box;
41 | scroll(frame);
42 | stop = stop_tracker;
43 | end
44 |
45 | function redraw(frame)
46 | %render main image
47 | % im = imread([video_path img_files{frame}]);
48 | im = imread(img_files{frame});
49 | if size(im,3) > 1,
50 | im = rgb2gray(im);
51 | end
52 | if resize_image,
53 | im = imresize(im, 0.5);
54 | end
55 |
56 | if isempty(im_h), %create image
57 | im_h = imshow(im, 'Border','tight', 'InitialMag',200, 'Parent',axes_h);
58 | else %just update it
59 | set(im_h, 'CData', im)
60 | end
61 |
62 | %render target bounding box for this frame
63 | if isempty(rect_h), %create it for the first time
64 | rect_h = rectangle('Position',[0,0,1,1], 'EdgeColor','g', 'Parent',axes_h);
65 | end
66 | if ~isempty(boxes{frame}),
67 | set(rect_h, 'Visible', 'on', 'Position', boxes{frame});
68 | else
69 | set(rect_h, 'Visible', 'off');
70 | end
71 | end
72 |
73 | function on_key_press(key)
74 | if strcmp(key, 'escape'), %stop on 'Esc'
75 | stop_tracker = true;
76 | end
77 | end
78 |
79 | end
80 |
81 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/md5hash.m:
--------------------------------------------------------------------------------
1 | function hash = md5hash(data, input, output) %#ok
2 | % md5hash Calculate 128 bit MD5 checksum
3 | %
4 | % This function calculates a 128 bit checksum for arrays and files.
5 | %
6 | % Input:
7 | % - data (matrix, string): Data array or file name. Either numerical or CHAR array.
8 | % Currently only files and arrays with up to 2^32 bytes (2.1GB) are
9 | % accepted.
10 | % - input (string): Type of the input, optional. Default: 'Char'.
11 | % 'File': Data is a file name as string. The digest is calculated
12 | % for this file.
13 | % 'Char': Data is a char array to calculate the digest for. Only the
14 | % ASCII part of the Matlab CHARs is used, such that the digest
15 | % is the same as if the array is written to a file as UCHAR,
16 | % e.g. with FWRITE.
17 | % 'Unicode': All bytes of the input are used to calculate the
18 | % digest. This is the standard for numerical input.
19 | % - output (string, optional): Format of the output. Just the first character matters.
20 | % Optional, default: 'hex'.
21 | % - 'hex': [1 x 32] string as lowercase hexadecimal number.
22 | % - 'HEX': [1 x 32] string as uppercase hexadecimal number.
23 | % - 'Dec': [1 x 16] double vector with UINT8 values.
24 | % - 'Base64': [1 x 22] string, encoded to base 64 (A:Z,a:z,0:9,+,/).
25 | %
26 | % Output:
27 | % - hash: A 128 bit number is replied in a format depending on output parameter.
28 | % The chance, that different data sets have the same MD5 sum is about
29 | % 2^128 (> 3.4 * 10^38). Therefore MD5 can be used as "finger-print"
30 | % of a file rather than e.g. CRC32.
31 | %
32 | % Examples:
33 | % Three methods to get the MD5 of a file:
34 | % 1. Direct file access (recommended):
35 | % MD5 = CalcMD5(which('CalcMD5.m'), 'File')
36 | % 2. Import the file to a CHAR array (binary mode for exact line breaks!):
37 | % FID = fopen(which('CalcMD5.m'), 'rb');
38 | % S = fread(FID, inf, 'uchar=>char');
39 | % fclose(FID);
40 | % MD5 = CalcMD5(S, 'char')
41 | % 3. Import file as a byte stream:
42 | % FID = fopen(which('CalcMD5.m'), 'rb');
43 | % S = fread(FID, inf, 'uint8=>uint8');
44 | % fclose(FID);
45 | % MD5 = CalcMD5(S, 'unicode'); // 'unicode' can be omitted here
46 | %
47 | % Author: Jan Simon, Heidelberg, (C) 2009-2010 J@n-Simon.De
48 | % License: This program is derived from the RSA Data Security, Inc.
49 | % MD5 Message Digest Algorithm, RFC 1321, R. Rivest, April 1992
50 | %
51 |
52 | % If the current Matlab path is the parent folder of this script, the
53 | % MEX function is not found - change the current directory!
54 | error(['JSim:', mfilename, ':NoMex'], 'Cannot find MEX script.');
55 |
56 |
--------------------------------------------------------------------------------
/vot-toolkit-master/report/report_sequences_preview.m:
--------------------------------------------------------------------------------
1 | function [document] = report_sequences_preview(context, sequences, varargin)
2 | % report_sequences_preview Create an overview document for the given sequences
3 | %
4 | % The function generates a report document for the given sequences by providing a
5 | % preview of each sequence.
6 | %
7 | % Input:
8 | % - context (structure): A report context structure.
9 | % - sequences (cell): An array of sequence descriptors.
10 | % - varargin[Frames] (integer): Number of frames for each sequence to present in a strip.
11 | %
12 | % Output:
13 | % - document (structure): A document structure.
14 | %
15 |
16 | document = create_document(context, 'sequences', 'title', 'Sequences overview');
17 |
18 | frames = 6;
19 |
20 | for i = 1:2:length(varargin)
21 | switch lower(varargin{i})
22 | case 'frames'
23 | frames = varargin{i+1};
24 | otherwise
25 | error(['Unknown switch ', varargin{i}, '!']) ;
26 | end
27 | end
28 |
29 | tags = {'empty'};
30 | total_size = 0;
31 |
32 | for s = 1:length(sequences)
33 | tags = union(tags, sequences{s}.tags.names);
34 | total_size = total_size + sequences{s}.length;
35 | end;
36 |
37 | document.raw('Total size: %d sequences, %d frames', numel(sequences), total_size);
38 |
39 | if ~isempty(tags)
40 |
41 | document.section('Tags distribution');
42 |
43 | tags_count = zeros(numel(tags), 1);
44 |
45 | for s = 1:length(sequences)
46 | for l = 1:length(tags)
47 | tags_count(l) = tags_count(l) + numel(query_tag(sequences{s}, tags{l}));
48 | end;
49 | end;
50 |
51 | handle = generate_plot('title', 'Tags distribution');
52 |
53 | bar(tags_count ./ total_size);
54 | set(gca, 'TickLabelInterpreter', 'none');
55 | set(gca, 'XTickLabel', tags);
56 |
57 | document.figure(handle, 'tagss_distribution', 'Tags distribution');
58 |
59 | close(handle);
60 |
61 | document.subsection('Tags in sequences');
62 |
63 | for l = 1:length(tags)
64 | subset = cellfun(@(s) ~isempty(sequence_query_tag(s, tags{l})), sequences, 'UniformOutput', true);
65 | document.text('Tag %s: %s', tags{l}, strjoin(cellfun(@(s) s.name, sequences(subset), 'UniformOutput', false), ', '));
66 | end;
67 |
68 | end;
69 |
70 | for s = 1:length(sequences)
71 |
72 | print_indent(1);
73 |
74 | print_text('Processing sequence %s ...', sequences{s}.name);
75 |
76 | document.raw('\n');
77 |
78 | figure_id = sprintf('sequence_preview_%s', sequences{s}.name);
79 |
80 | document.figure(@() generate_sequence_strip(sequences{s}, {}, 'samples', frames, 'window', Inf), ...
81 | figure_id, sprintf('Sequence %s', sequences{s}.name));
82 |
83 | document.raw('
\n');
84 |
85 | print_indent(-1);
86 |
87 | end;
88 |
89 | document.write();
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/vot-toolkit-master/report/generate_plot.m:
--------------------------------------------------------------------------------
1 | function handle = generate_plot(varargin)
2 | % generate_plot Generate an blank plot
3 | %
4 | % The function creates and configures an new plot that can be then populated.
5 | %
6 | % Input:
7 | % - varargin[Title] (string): A title of the plot.
8 | % - varargin[Visible] (boolean): Is the figure visible on the display.
9 | % - varargin[Width] (double): Figure width hint.
10 | % - varargin[Height] (double): Figure height hint.
11 | % - varargin[Box] (boolean): Enable axis box
12 | % - varargin[Grid] (boolean): Enable axis grid
13 | % - varargin[Handle] (handle): Plot on existing figure handle.
14 | % - varargin (other): Forward parameters to axis settings.
15 | %
16 | % Output:
17 | % - handle (handle): A figure handle.
18 | %
19 |
20 | plot_title = [];
21 | visible = false;
22 | width = 4;
23 | height = 4;
24 | axis_box = true;
25 | axis_grid = true;
26 | handle = [];
27 | axis_settings = {};
28 |
29 | for i = 1:2:length(varargin)
30 | switch lower(varargin{i})
31 | case 'title'
32 | plot_title = varargin{i+1};
33 | case 'visible'
34 | visible = varargin{i+1};
35 | case 'width'
36 | width = varargin{i+1};
37 | case 'height'
38 | height = varargin{i+1};
39 | case 'box'
40 | axis_box = varargin{i+1};
41 | case 'grid'
42 | axis_grid = varargin{i+1};
43 | case 'handle'
44 | handle = varargin{i+1};
45 | otherwise
46 | axis_settings{end+1} = varargin{i}; %#ok
47 | axis_settings{end+1} = varargin{i+1}; %#ok
48 | end
49 | end
50 |
51 | if ~isempty(handle) && ishandle(handle)
52 | if strcmp(get(handle, 'type'),'figure')
53 | figure(handle);
54 | elseif strcmp(get(handle, 'type'),'axes')
55 | axes(handle);
56 | else
57 | handle = [];
58 | end
59 | else
60 | handle = [];
61 | end
62 |
63 | if isempty(handle)
64 | if ~visible
65 | handle = figure('Visible', 'off');
66 | else
67 | handle = figure();
68 | end
69 | end;
70 |
71 | hold on;
72 | if axis_box
73 | box on;
74 | end;
75 | if axis_grid
76 | grid on;
77 | end
78 |
79 | if ~isempty(plot_title)
80 | title(plot_title, 'interpreter', 'none');
81 | end;
82 |
83 | if ~isempty(axis_settings)
84 | set(gca, axis_settings{:});
85 | end;
86 |
87 | if strcmp(get(handle, 'type'),'figure')
88 | set(handle, 'PaperUnits', 'inches', 'PaperSize', [width, height], 'PaperPosition', [0, 0, width, height]);
89 | end;
90 |
91 | hold off;
92 |
93 | end
94 |
--------------------------------------------------------------------------------
/vot-toolkit-master/tracker/tracker_list.m:
--------------------------------------------------------------------------------
1 | function [trackers] = tracker_list(varargin)
2 | % tracker_list Creates a set of tracker descriptor structures
3 | %
4 | % Create a cell array of new tracker structures from identifiers or file lists of identifiers.
5 | %
6 | % This functions checks each argument if it is a valid file and openes it as a text file of
7 | % comma and new line separated tracker identifiers. If an argument is not a file then it is
8 | % considered an identifier.
9 | %
10 | % Examples:
11 | %
12 | % trackers = tracker_list('trackers.txt', 'NCC'); % Load tracker identifiers from file trackers.txt and add a tracker NCC
13 | %
14 | % Input:
15 | % - varargin: A list of strings denoting either files containing tracker identifiers or valid identifiers. See `valid_identifier` for more details.
16 | %
17 | % Output:
18 | % - trackers: A cell array of new tracker structures.
19 |
20 | identifiers = {};
21 |
22 | for j = 1:nargin
23 |
24 | %check if the first argument is a file, if so it is a
25 | %text file containing a list of tracker names, ignore directories
26 | %(since the results folder migtht be on the path)
27 | if file_exist(fullfile(pwd(), varargin{j}))
28 |
29 | ids = parsefile(fullfile(pwd(), varargin{j}), 'Delimiter', ',');
30 |
31 | identifiers = [identifiers; ids(:)]; %#ok
32 |
33 | else
34 |
35 | % if the argument is not a file name, but it is still a string ...
36 | if ischar(varargin{j})
37 | identifiers = [identifiers; varargin(j)]; %#ok
38 | end;
39 |
40 | end;
41 |
42 | end;
43 |
44 | % remove the duplicate identifiers
45 | if is_octave
46 | identifiers = unique(identifiers);
47 | print_debug('Warning: Tracker order is not preserved due to Octave limitations.')
48 | else
49 | identifiers = unique(identifiers, 'stable');
50 | end;
51 |
52 | trackers = cell(size(identifiers, 1), 1);
53 |
54 | for i = 1:size(identifiers, 1)
55 | tracker_identifier = strtrim(identifiers{i});
56 |
57 | if isempty(tracker_identifier)
58 | break;
59 | end
60 |
61 | trackers{i} = tracker_load(tracker_identifier);
62 |
63 | end;
64 |
65 | trackers = set_trackers_visual_identity(trackers);
66 |
67 | end
68 |
69 | % Matlab exist function is very flexible but also confuses script names for
70 | % real files, therefore "ncc" will be considered a file if a file "ncc.m" exists
71 | % in Matlab path. This can be problematic in our scenario. Therefore this function
72 | % approaches the problem in a plain C way.
73 | function status = file_exist(file_path)
74 |
75 | fd = fopen(file_path, 'r');
76 |
77 | status = fd > 0;
78 |
79 | if (fd > 0)
80 | fclose(fd);
81 | end;
82 | end
83 |
84 |
--------------------------------------------------------------------------------
/vot-toolkit-master/analysis/estimate_accuracy.m:
--------------------------------------------------------------------------------
1 | function [accuracy, frames] = estimate_accuracy(trajectory, sequence, varargin)
2 | % estimate_accuracy Calculate accuracy score
3 | %
4 | % Calculate accuracy score as average overlap over the entire sequence.
5 | %
6 | % Input:
7 | % - trajectory (cell): A trajectory as a cell array of regions.
8 | % - sequence (cell or structure): Can be another trajectory or a valid sequence descriptor.
9 | % - varargin[Burnin] (integer): Number of frames that have to be ignored after the failure.
10 | % - varargin[IgnoreUnknown] (boolean): Ignore frames where the overlap is
11 | % unknown.
12 | % - varargin[BindWithin] (boolean or vector): Bind the overlap calculation to the region
13 | % within the image. If the sequence variable is a sequence structure then a boolean value
14 | % is sufficient to establishe bounding region. Otherwise a bounding region has to be specified
15 | % manually.
16 | %
17 | % Output:
18 | % - accuracy (double): Average overlap.
19 | % - frames (double vector): Per-frame overlaps.
20 | %
21 |
22 | ignore_unknown = true;
23 | burnin = 0;
24 | bind_within = get_global_variable('bounded_overlap', true);
25 |
26 | for j=1:2:length(varargin)
27 | switch lower(varargin{j})
28 | case 'burnin', burnin = max(0, varargin{j+1});
29 | case 'ignoreunknown', ignore_unknown = varargin{j+1};
30 | case 'bindwithin', bind_within = varargin{j+1};
31 | otherwise, error(['unrecognized argument ' varargin{j}]);
32 | end
33 | end
34 |
35 | if burnin > 0
36 |
37 | mask = cellfun(@(r) numel(r) == 1 && r == 1, trajectory, 'UniformOutput', true);
38 |
39 | if is_octave()
40 | se = logical([zeros(burnin - 1, 1); ones(burnin, 1)]);
41 | else
42 | se = strel('arbitrary', [zeros(burnin - 1, 1); ones(burnin, 1)]);
43 | end;
44 |
45 | % ignore the next 'burnin' frames
46 | mask = imdilate(mask, se);
47 |
48 | else
49 |
50 | mask = false(size(trajectory, 1), 1);
51 |
52 | end;
53 |
54 | if ~ignore_unknown
55 | unknown = cellfun(@(r) numel(r) == 1 && r == 0, trajectory, 'UniformOutput', true);
56 | end;
57 |
58 | trajectory(mask) = {0};
59 |
60 | if islogical(bind_within)
61 | if bind_within && isstruct(sequence)
62 | bounds = [sequence.width, sequence.height] - 1;
63 | else
64 | bounds = [];
65 | end;
66 | else
67 | bounds = bind_within;
68 | end;
69 |
70 | if isstruct(sequence)
71 | frames = calculate_overlap(trajectory, get_region(sequence, 1:sequence.length), bounds);
72 | else
73 | frames = calculate_overlap(trajectory, sequence, bounds);
74 | end;
75 |
76 | if ~ignore_unknown
77 | frames(unknown) = 0;
78 | end;
79 |
80 | overlap = frames(~isnan(frames)); % filter-out illegal values
81 |
82 | % Handle cases, where no overlap is available
83 | if isempty(overlap)
84 | accuracy = 0;
85 | else
86 | accuracy = mean(overlap);
87 | end;
88 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/write_trajectory.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | #include "mex.h"
5 | #include "region.h"
6 |
7 | char* getString(const mxArray *arg) {
8 |
9 | if (mxGetM(arg) != 1)
10 | mexErrMsgTxt("Must be a string");
11 |
12 | int l = mxGetN(arg);
13 |
14 | char* str = (char *) malloc(sizeof(char) * (l + 1));
15 |
16 | mxGetString(arg, str, (l + 1));
17 |
18 | return str;
19 | }
20 |
21 | void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
22 |
23 | region_container** regions = NULL;
24 |
25 | if( nrhs != 2 ) mexErrMsgTxt("Exactly one string input argument and one cell array argument required.");
26 | if( nlhs != 0 ) mexErrMsgTxt("No output arguments required.");
27 |
28 | char* path = getString(prhs[0]);
29 |
30 | if (!mxIsCell(prhs[1]))
31 | mexErrMsgTxt("Second argument must be a cell array");
32 |
33 | int length = MAX(mxGetM(prhs[1]), mxGetN(prhs[1]));
34 |
35 | if ( MIN(mxGetM(prhs[1]), mxGetN(prhs[1])) != 1 )
36 | mexErrMsgTxt("Cell array must be a vector");
37 |
38 | regions = (region_container**) malloc(sizeof(region_container*) * length);
39 |
40 | for (int i = 0; i < length; i++) {
41 |
42 | mxArray* val = mxGetCell (prhs[1], i);
43 |
44 | region_container* region = NULL;
45 |
46 | if (val) {
47 |
48 | double *d = (double*) mxGetPr(val);
49 | int l = MAX(mxGetM(val), mxGetN(val));
50 |
51 | if (!mxIsEmpty(val) && MIN(mxGetM(val), mxGetN(val)) == 1) {
52 |
53 | if (l == 1) {
54 |
55 | region = region_create_special(d[0]);
56 |
57 | } else if (l == 4) {
58 |
59 | region = region_create_rectangle(d[0], d[1], d[2], d[3]);
60 |
61 | } else if (l > 5 && l % 2 == 0) {
62 |
63 | region = region_create_polygon(l / 2);
64 |
65 | for (int j = 0; j < l / 2; j++) {
66 | region->data.polygon.x[j] = d[j * 2];
67 | region->data.polygon.y[j] = d[j * 2 + 1];
68 | }
69 | }
70 |
71 | }
72 |
73 | }
74 |
75 | if (region) {
76 | regions[i] = region;
77 | } else {
78 | char message[128];
79 | sprintf(message, "Not a valid region at position %d, skipping", i+1);
80 | mexWarnMsgTxt(message);
81 | regions[i] = region_create_special(-1);
82 | }
83 |
84 | }
85 |
86 | FILE* fp = fopen(path, "w");
87 |
88 | if (fp != NULL) {
89 |
90 | for (int i = 0; i < length; i++) {
91 |
92 | region_container* region = regions[i];
93 |
94 | char* tmp = region_string(region);
95 |
96 | if (tmp) {
97 | fputs(tmp, fp);
98 | fputc('\n', fp);
99 | free(tmp);
100 | }
101 |
102 | region_release(®ion);
103 |
104 | }
105 |
106 | } else {
107 |
108 | free(path);
109 | mexErrMsgTxt("Unable to open file for writing.");
110 | }
111 |
112 | if (regions)
113 | free(regions);
114 |
115 | fclose(fp);
116 | free(path);
117 | }
118 |
119 |
--------------------------------------------------------------------------------
/vot-toolkit-master/report/resources/js/layout.js:
--------------------------------------------------------------------------------
1 |
2 | $(function () {
3 |
4 | var title = $('h1').first().text();
5 |
6 | $('body').prepend($('').attr('id', 'header')
7 | .append($('').addClass('navbar navbar-default navbar-fixed-top')
8 | .append($('').addClass('container')
9 | .append($('').addClass('navbar-header')
10 | .append($('').addClass('navbar-brand').text(title).attr('href', '#'))))));
11 |
12 | var modal = Object;
13 | modal.wrapper = $('').addClass('modal').attr('tabindex', '-1');
14 | modal.dialog = $('').addClass('modal-dialog modal-lg').appendTo(modal.wrapper);
15 | modal.content = $('').addClass('modal-content').appendTo(modal.dialog);
16 | modal.header = $('').addClass('modal-header').appendTo(modal.content);
17 | modal.title = $('').appendTo(modal.header);
18 | modal.header.append($(''));
19 | modal.body = $('').addClass('modal-body').appendTo(modal.content);
20 | $('body').append(modal.wrapper.modal({'show': false}));
21 |
22 | // Format stacking elements into grid
23 | $('.stacking').each(function(i, candidate) {
24 | candidate = $(candidate);
25 | if (candidate.prev('.stacking').length > 0)
26 | return;
27 |
28 | var sequence = candidate;
29 | var current = candidate;
30 |
31 | for (current = candidate.next('.stacking'); current.length > 0; current = current.next('.stacking')) {
32 | sequence = sequence.add(current);
33 | }
34 |
35 | if (sequence.length < 2)
36 | return;
37 |
38 | var wrapper = $('').addClass("row");
39 |
40 | candidate.before(wrapper);
41 |
42 | sequence.each(function (i, element) {
43 | element = $(element);
44 | element.remove().appendTo($('').addClass('col-md-4').appendTo(wrapper));
45 | });
46 |
47 | });
48 |
49 | $('.image-wrapper img').click(function(event) {
50 |
51 | modal.title.text($(this).parent().find('.title').first().text());
52 |
53 | modal.body.empty().append($(this).clone());
54 |
55 | modal.wrapper.modal('show');
56 |
57 | });
58 |
59 | // Build navigation
60 | var section = null;
61 | var anchorId = 0;
62 |
63 | var menu = $('').addClass('nav navbar-nav').appendTo($('#header .container')).wrap($('').attr('id', 'navbar'));
64 |
65 | $('body > .container h2').each(function(i, header) {
66 | header = $(header);
67 |
68 | section = $('').append($('').attr('href', '#navigation-' + anchorId).text(header.text())).appendTo(menu);
69 |
70 | header.append($('').attr('name', 'navigation-' + anchorId).attr('id', 'navigation-' + anchorId).attr('href', '#'));
71 |
72 | anchorId++;
73 |
74 | });
75 |
76 | $('body').scrollspy({ target: '#navbar' });
77 |
78 | });
79 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/compile_mex.m:
--------------------------------------------------------------------------------
1 | function [success] = compile_mex(name, files, includes, directory, varargin)
2 | % compile_mex Compile given source files to a MEX function
3 | %
4 | % Compiles or recompiles given source files to a MEX function taking
5 | % into account source files timestamps. Also works in Octave by switching
6 | % to mkoctfile command.
7 | %
8 | % Input:
9 | % - name (string): Name of MEX function.
10 | % - files (cell array): Array of source files.
11 | % - includes (cell array): Optional array of include directories.
12 | % - directory (string): Optional path of target directory.
13 | %
14 | % Output:
15 | % - success (boolean): True if successful.
16 | %
17 |
18 | function datenum = file_timestamp(filename)
19 | if ~exist(filename, 'file')
20 | datenum = 0;
21 | return;
22 | end;
23 | file_description = dir(filename);
24 | datenum = file_description.datenum;
25 | end
26 |
27 | mexname = fullfile(directory, sprintf('%s.%s', name, mexext));
28 |
29 | if exist(mexname, 'file') == 2 || exist(mexname, 'file') == 3
30 |
31 | function_timestamp = file_timestamp(mexname);
32 |
33 | older = cellfun(@(x) file_timestamp(x) < function_timestamp, files, 'UniformOutput', true);
34 |
35 | if all(older)
36 | success = true;
37 | return;
38 | end;
39 | end
40 |
41 | arguments = {};
42 |
43 | if is_octave()
44 | arguments{end+1} = '-DOCTAVE';
45 | else
46 | arguments{end+1} = '-lut';
47 | end
48 |
49 | if nargin < 3
50 | includes = cell(0);
51 | end
52 |
53 | if nargin < 4
54 | directory = '';
55 | end;
56 |
57 | includes = cellfun(@(x) sprintf('-I%s', x), includes, 'UniformOutput', false);
58 |
59 | old_dir = pwd;
60 |
61 | try
62 |
63 | if ~isempty(directory)
64 | cd(directory)
65 | end;
66 |
67 | if is_octave()
68 |
69 | [out, status] = mkoctfile('-mex', '-o', name, varargin{:}, includes{:}, files{:}, arguments{:});
70 |
71 | % Clean up mess
72 | for i = 1:numel(files)
73 | [pathstr, name, ext] = fileparts(files{i});
74 | tmpfile = fullfile(directory, [name, '.o']);
75 | if exist(tmpfile, 'file')
76 | delete(tmpfile);
77 | end
78 | end
79 |
80 | if status
81 | error('Compile problem, see compiler output.');
82 | end;
83 |
84 | else
85 |
86 | mex('-output', name, varargin{:}, includes{:}, files{:}, arguments{:});
87 |
88 | end
89 |
90 | cd(old_dir);
91 |
92 | success = true;
93 |
94 | catch e
95 | cd(old_dir);
96 | print_text('ERROR: Unable to compile MEX function: "%s".', e.message);
97 | success = false;
98 |
99 | end
100 |
101 | end
102 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/read_trajectory.cpp:
--------------------------------------------------------------------------------
1 |
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include "mex.h"
9 | #include "region.h"
10 |
11 | using namespace std;
12 |
13 | char* getString(const mxArray *arg) {
14 |
15 | if (mxGetM(arg) != 1)
16 | mexErrMsgTxt("Must be a string");
17 |
18 | int l = (int) mxGetN(arg);
19 |
20 | char* str = (char *) malloc(sizeof(char) * (l + 1));
21 |
22 | mxGetString(arg, str, (l + 1));
23 |
24 | return str;
25 | }
26 |
27 | void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
28 |
29 | if( nrhs != 1 ) mexErrMsgTxt("Exactly one string input argument required.");
30 | if( nlhs != 1 ) mexErrMsgTxt("Exactly one output argument required.");
31 |
32 | char* path = getString(prhs[0]);
33 |
34 | std::ifstream ifs;
35 | ifs.open (path, std::ifstream::in);
36 |
37 | vector regions;
38 |
39 | if (ifs.is_open()) {
40 |
41 | int line_size = sizeof(char) * 2048;
42 | char* line_buffer = (char*) malloc(line_size);
43 | int line = 0;
44 |
45 | while (ifs.good()) {
46 |
47 | line++;
48 |
49 | ifs.getline(line_buffer, line_size);
50 |
51 | if (!ifs.good()) break;
52 |
53 | region_container* region = NULL;
54 |
55 | if (region_parse(line_buffer, ®ion)) {
56 |
57 | regions.push_back(region);
58 |
59 | } else {
60 |
61 | char message[500];
62 | sprintf(message, "Unable to parse region at line %d, skipping.", line);
63 | mexWarnMsgTxt(message);
64 |
65 | }
66 |
67 | }
68 |
69 | free(line_buffer);
70 |
71 | plhs[0] = mxCreateCellMatrix((int)regions.size(), 1);
72 |
73 | for (int i = 0; i < regions.size(); i++) {
74 |
75 | mxArray* val = NULL;
76 | region_container* region = regions[i];
77 |
78 | switch (region->type) {
79 | case RECTANGLE: {
80 | val = mxCreateDoubleMatrix(1, 4, mxREAL);
81 | double *p = (double*) mxGetPr(val);
82 | p[0] = region->data.rectangle.x;
83 | p[1] = region->data.rectangle.y;
84 | p[2] = region->data.rectangle.width;
85 | p[3] = region->data.rectangle.height;
86 | break;
87 | }
88 | case POLYGON: {
89 | val = mxCreateDoubleMatrix(1, region->data.polygon.count * 2, mxREAL);
90 | double *p = (double*) mxGetPr(val);
91 |
92 | for (int i = 0; i < region->data.polygon.count; i++) {
93 | p[i*2] = region->data.polygon.x[i];
94 | p[i*2+1] = region->data.polygon.y[i];
95 | }
96 |
97 | break;
98 | }
99 | case SPECIAL: {
100 | val = mxCreateDoubleMatrix(1, 1, mxREAL);
101 | double *p = (double*) mxGetPr(val);
102 | p[0] = region->data.special;
103 | break;
104 | }
105 | }
106 |
107 | if (val) mxSetCell(plhs[0], i, val);
108 |
109 | region_release(®ion);
110 |
111 | }
112 |
113 | } else {
114 | free(path);
115 | mexErrMsgTxt("Unable to open file for reading.");
116 | }
117 |
118 | ifs.close();
119 | free(path);
120 | }
121 |
122 |
123 |
--------------------------------------------------------------------------------
/vot-toolkit-master/sequence/region_mask.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 |
5 | #include "mex.h"
6 | #include "region.h"
7 |
8 | #define MEX_TEST_DOUBLE(I) (mxGetClassID(prhs[I]) == mxDOUBLE_CLASS)
9 | #define MEX_TEST_VECTOR(I) (mxGetNumberOfDimensions(prhs[I]) == 2 && mxGetM(prhs[I]) == 1)
10 |
11 | #if defined(__OS2__) || defined(__WINDOWS__) || defined(WIN32) || defined(WIN64) || defined(_MSC_VER)
12 | #define strcmpi _strcmpi
13 | #else
14 | #define strcmpi strcasecmp
15 | #endif
16 |
17 | region_container* get_polygon(const mxArray * input) {
18 |
19 | region_container* p = NULL;
20 | double *r = (double*)mxGetPr(input);
21 | int l = mxGetN(input);
22 |
23 | if (l % 2 == 0 && l > 6) {
24 |
25 | p = region_create_polygon(l / 2);
26 |
27 | for (int i = 0; i < p->data.polygon.count; i++) {
28 | p->data.polygon.x[i] = r[i*2];
29 | p->data.polygon.y[i] = r[i*2+1];
30 | }
31 |
32 | } else if (l == 4) {
33 |
34 | region_container* t = NULL;
35 |
36 | t = region_create_rectangle(r[0], r[1], r[2], r[3]);
37 |
38 | p = region_convert(t, POLYGON);
39 |
40 | region_release(&t);
41 |
42 | }
43 |
44 | return p;
45 |
46 | }
47 |
48 | int getSingleInteger(const mxArray *arg) {
49 |
50 | if (mxGetM(arg) != 1 || mxGetN(arg) != 1)
51 | mexErrMsgTxt("Parameter must be a single value");
52 |
53 | if (mxIsInt32(arg))
54 | return ((int*)mxGetPr(arg))[0];
55 |
56 | if (mxIsDouble(arg))
57 | return (int) ((double*)mxGetPr(arg))[0];
58 |
59 | return 0;
60 | }
61 |
62 | char* get_string(const mxArray *arg) {
63 |
64 | if (mxGetM(arg) != 1)
65 | mexErrMsgTxt("Must be an array of chars");
66 |
67 | int l = (int) mxGetN(arg);
68 |
69 | char* cstr = (char *) malloc(sizeof(char) * (l + 1));
70 |
71 | mxGetString(arg, cstr, (l + 1));
72 |
73 | return cstr;
74 | }
75 |
76 | void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
77 |
78 | region_container* p = NULL;
79 |
80 | if( nrhs < 3 ) mexErrMsgTxt("One vector and two integer arguments required.");
81 | if( nlhs != 1 ) mexErrMsgTxt("Exactly one output argument required.");
82 |
83 | if (!MEX_TEST_VECTOR(0) || !MEX_TEST_DOUBLE(0)) mexErrMsgTxt("First argument must be a vector of type double");
84 |
85 | region_clear_flags(REGION_LEGACY_RASTERIZATION);
86 | if (nrhs > 3) {
87 | char* codestr = get_string(prhs[3]);
88 | if (strcmpi(codestr, "legacy") == 0)
89 | region_set_flags(REGION_LEGACY_RASTERIZATION);
90 | free(codestr);
91 | }
92 |
93 | int width = getSingleInteger(prhs[1]);
94 | int height = getSingleInteger(prhs[2]);
95 |
96 | p = get_polygon(prhs[0]);
97 | float* tmp = p->data.polygon.x; p->data.polygon.x = p->data.polygon.y; p->data.polygon.y = tmp;
98 |
99 | plhs[0] = mxCreateLogicalMatrix(height, width);
100 | char *result = (char*) mxGetData(plhs[0]);
101 |
102 | region_get_mask(p, result, width, height);
103 |
104 | if (p) region_release(&p);
105 |
106 | }
107 |
108 |
--------------------------------------------------------------------------------
/vot-toolkit-master/utilities/relativepath.m:
--------------------------------------------------------------------------------
1 | function relative_path = relativepath( target_path, root_path )
2 | % relativepath Returns the relative path from an root path to the target path
3 | %
4 | % Returns the relative path from an root path to the target path.
5 | % Both arguments must be strings with absolute paths.
6 | % The actual path is optional, if omitted the current dir is used instead.
7 | % In case the volume drive letters don't match, an absolute path will be returned.
8 | % If a relative path is returned, it always starts with '.\' or '..\'
9 | %
10 | % Credit: Jochen Lenz
11 | %
12 | % Input:
13 | % - target_path (string): Absolute path.
14 | % - root_path (string, optional): Start for relative path. Defaults to current directory.
15 | %
16 | % Output:
17 | % - relative_path (string): Relative path.
18 | %
19 |
20 |
21 | % 2nd parameter is optional:
22 | if nargin < 2
23 | root_path = cd;
24 | end
25 |
26 | % Predefine return string:
27 | relative_path = '';
28 |
29 | % Make sure strings end by a filesep character:
30 | if isempty(root_path) || ~isequal(root_path(end),filesep)
31 | root_path = [root_path filesep];
32 | end
33 | if isempty(target_path) || ~isequal(target_path(end),filesep)
34 | target_path = [target_path filesep];
35 | end
36 |
37 | if isunix()
38 | [root_path] = fileparts(root_path);
39 | [target_path] = fileparts(target_path);
40 | else
41 | % Convert to all lowercase:
42 | [root_path] = fileparts(lower(root_path));
43 | [target_path] = fileparts(lower(target_path));
44 | end;
45 |
46 | % Create a cell-array containing the directory levels:
47 | act_path_cell = pathparts(root_path);
48 | tgt_path_cell = pathparts(target_path);
49 |
50 | % If volumes are different, return absolute path:
51 | if isempty(act_path_cell) || isempty(tgt_path_cell)
52 | return % rel_path = ''
53 | else
54 | if ~isequal( act_path_cell{1} , tgt_path_cell{1} )
55 | relative_path = target_path;
56 | return
57 | end
58 | end
59 |
60 | % Remove level by level, as long as both are equal:
61 | while ~isempty(act_path_cell) > 0 && ~isempty(tgt_path_cell)
62 | if isequal( act_path_cell{1}, tgt_path_cell{1} )
63 | act_path_cell(1) = [];
64 | tgt_path_cell(1) = [];
65 | else
66 | break
67 | end
68 | end
69 |
70 | % As much levels down ('..\') as levels are remaining in "act_path":
71 | for i = 1 : length(act_path_cell)
72 | relative_path = fullfile('..', relative_path);
73 | end
74 |
75 | % Relative directory levels to target directory:
76 | for i = 1 : length(tgt_path_cell)
77 | relative_path = fullfile(relative_path, tgt_path_cell{i});
78 | end
79 |
80 | % Start with '.' or '..' :
81 | if isempty(relative_path)
82 | relative_path = ['.', filesep];
83 | elseif ~isequal(relative_path(1),'.')
84 | relative_path = fullfile('.', relative_path);
85 | end
86 |
87 | return
88 |
89 | % -------------------------------------------------
90 |
91 | function path_cell = pathparts(path_str)
92 |
93 | path_str = [filesep path_str filesep];
94 | path_cell = {};
95 |
96 | sep_pos = findstr( path_str, filesep );
97 | for i = 1 : length(sep_pos)-1
98 | path_cell{i} = path_str( sep_pos(i)+1 : sep_pos(i+1)-1 );
99 | end
100 |
101 | return
102 |
--------------------------------------------------------------------------------
/vot-toolkit-master/report/generate_ranking_plot.m:
--------------------------------------------------------------------------------
1 | function handle = generate_ranking_plot(trackers, accuracy, robustness, varargin)
2 | % generate_ar_plot Generate an A-R ranking plot
3 | %
4 | % The function generates an A-R ranking plot for a sequence of measurements.
5 | %
6 | % Input:
7 | % - trackers (cell): A cell array of tracker structures.
8 | % - accuracy (matrix): Accuracy ranks.
9 | % - robustness (matrix): Robustness ranks.
10 | % - varargin[Title] (string): A title of the plot.
11 | % - varargin[Limit] (double): A manually set maximum rank.
12 | % - varargin[Visible] (boolean): Is the figure visible on the display.
13 | % - varargin[Width] (double): Figure width hint.
14 | % - varargin[Height] (double): Figure height hint.
15 | % - varargin[Handle] (handle): Plot on existing figure handle.
16 | % - varargin[Legend] (boolean): Render plot legend.
17 | %
18 | % Output:
19 | % - handle (handle): A figure handle.
20 | %
21 |
22 | plot_title = [];
23 | visible = false;
24 | plot_limit = numel(trackers);
25 | width = [];
26 | height = [];
27 |
28 | handle = [];
29 |
30 | show_legend = true;
31 |
32 | for i = 1:2:length(varargin)
33 | switch lower(varargin{i})
34 | case 'title'
35 | plot_title = varargin{i+1};
36 | case 'limit'
37 | plot_limit = varargin{i+1};
38 | case 'visible'
39 | visible = varargin{i+1};
40 | case 'width'
41 | width = varargin{i+1};
42 | case 'height'
43 | height = varargin{i+1};
44 | case 'handle'
45 | handle = varargin{i+1};
46 | case 'legend'
47 | show_legend = varargin{i+1};
48 | otherwise
49 | error(['Unknown switch ', varargin{i},'!']) ;
50 | end
51 | end
52 |
53 | if isempty(handle)
54 | if ~visible
55 | handle = figure('Visible', 'off');
56 | else
57 | handle = figure();
58 | end
59 | else
60 | figure(handle);
61 | end;
62 |
63 | if isempty(width)
64 | width = iff(show_legend, 6, 4);
65 | end
66 |
67 | if isempty(height)
68 | height = 4;
69 | end
70 |
71 | hold on; box on; grid on;
72 | title(plot_title, 'interpreter','none');
73 |
74 | available = true(length(trackers), 1);
75 |
76 | for t = 1:length(trackers)
77 |
78 | if isnan(accuracy(t))
79 | available(t) = 0;
80 | continue;
81 | end;
82 |
83 | plot(robustness(t), accuracy(t), trackers{t}.style.symbol, 'Color', ...
84 | trackers{t}.style.color, 'MarkerSize', 10, 'LineWidth', trackers{t}.style.width);
85 |
86 | end;
87 | plot_labels = cellfun(@(tracker) tracker.label, trackers, 'UniformOutput', 0);
88 | if show_legend
89 | legend(plot_labels(available), 'Location', 'NorthWestOutside', 'interpreter', 'none', 'FontSize', 9);
90 | end;
91 | xlabel('Robustness rank'); set(gca, 'XDir', 'Reverse');
92 | ylabel('Accuracy rank'); set(gca, 'YDir', 'Reverse');
93 | xlim([0.9, plot_limit + 0.1]);
94 | ylim([0.9, plot_limit + 0.1]);
95 |
96 | set(handle, 'PaperUnits', 'inches', 'PaperSize', [width, height], 'PaperPosition', [0, 0, width, height]);
97 |
98 | hold off;
99 |
--------------------------------------------------------------------------------
/vot-toolkit-master/index.md:
--------------------------------------------------------------------------------
1 | VOT toolkit documentation
2 | =========================
3 |
4 | This is the official documentation for the [Visual Object Tracking (VOT) challenge](http://votchallenge.net/) toolkit. The toolkit is a set of
5 | Matlab (Octave compatible) scripts that estimate the performance of visual object trackers.
6 |
7 | The official code repository is available on [Github](https://github.com/vicoslab/vot-toolkit/). You can also
8 | subscribe to the VOT [mailing list](https://service.ait.ac.at/mailman/listinfo/votchallenge) to receive news about challenges and important software updates.
9 |
10 | Platform support
11 | ----------------
12 |
13 | The toolkit is written in Matlab language with a strong emphasis on Octave compatibility as well as support for multiple versions of Matlab (at the moment it was tested with versions from 2011 to 2015).
14 |
15 | The code should work on Windows, Linux and OSX, however, it is hard to verify this on all versions and system configurations. If you therefore find that there are some issues on your computer setup, submit a bug report at [Github](https://github.com/vicoslab/vot-toolkit/issues/new) as soon as possible.
16 |
17 | Inquiries, Question and Comments
18 | --------------------------------
19 |
20 | If you have any further inquiries, question, or comments, please use the official [support forum](https://groups.google.com/forum/?hl=en#!forum/votchallenge-help). If you would like to file a bug report or a feature request, use the [Github issue tracker](https://github.com/vicoslab/vot-toolkit/issues).
21 |
22 | Terminology
23 | -----------
24 |
25 | For better understanding, here are some definitions of important terms that are used in the documentation:
26 |
27 | * _Workspace_ - An directory that contains results for a single stack of experiments and your working scripts. It should not be the same directory that also contains the toolkit.
28 | * _Tracker_ - An executable or a script containing a tracking algorithm that is evaluated.
29 | * _Sequence_ - A single sequence of images with manually annotated ground-truth positions of the object used for evaluation.
30 | * _Annotation_ - Manual or automatic description of visual position of the object.
31 | * _Trajectory_ - A sequence of annotations that describes the motion of the object in the sequence. In the toolkit it is saved to a file in a text format.
32 | * _Tracker run_ - A single execution of a tracker on an entire sequence or its subset.
33 | * _Trial_ - If a tracker fails during tracking it is reinitialized after the first point of failure.
34 | * _Repetition_ - To properly address the potential stochastic nature of the algorithm, several trials are performed on each sequence.
35 | * _Experiment_ - Evaluation of a tracker on a set of sequences in specific conditions. Specific experiment may change the original sequences to simulate some specific kind of circumstances (e.g. image noise, initialization error).
36 | * _Evaluation_ - Performing a set of experiments on a specific tracker.
37 | * _Region overlap_ - Overlap distance between two regions.
38 |
39 | Modules
40 | -------
41 |
42 | The toolkit contains of several interdependent modules:
43 |
44 | - [Workspace](workspace/index.md)
45 | - [Tracker](tracker/index.md)
46 | - [Sequence](sequence/index.md)
47 | - [Analysis](analysis/index.md)
48 | - [Report](report/index.md)
49 | - [Utilities](utilities/index.md)
50 |
51 |
--------------------------------------------------------------------------------
/vot-toolkit-master/experiment/experiment_unsupervised.m:
--------------------------------------------------------------------------------
1 | function [files, metadata] = experiment_unsupervised(tracker, sequence, directory, parameters, scan)
2 |
3 | files = {};
4 | metadata.completed = true;
5 | cache = get_global_variable('experiment_cache', true);
6 | silent = get_global_variable('experiment_silent', false);
7 |
8 | defaults = struct('repetitions', 15);
9 | context = struct_merge(parameters, defaults);
10 | metadata.deterministic = false;
11 |
12 | time_file = fullfile(directory, sprintf('%s_time.txt', sequence.name));
13 |
14 | times = zeros(sequence.length, context.repetitions);
15 |
16 | if ~scan && cache && exist(time_file, 'file')
17 | times = csvread(time_file);
18 | end;
19 |
20 | r = context.repetitions;
21 |
22 | if isfield(tracker, 'metadata') && isfield(tracker.metadata, 'deterministic') && tracker.metadata.deterministic
23 | r = 1;
24 | end
25 |
26 | check_deterministic = ~(scan && nargout < 2); % Ensure faster execution when we only want a list of files by ommiting determinisim check.
27 |
28 | for i = 1:r
29 |
30 | result_file = fullfile(directory, sprintf('%s_%03d.txt', sequence.name, i));
31 |
32 | if cache && exist(result_file, 'file')
33 | files{end+1} = result_file; %#ok
34 | continue;
35 | end;
36 |
37 | if check_deterministic && i == 4 && is_deterministic(sequence, 3, directory)
38 | if ~silent
39 | print_debug('Detected a deterministic tracker, skipping remaining trials.');
40 | end;
41 | metadata.deterministic = true;
42 | break;
43 | end;
44 |
45 | if scan
46 | metadata.completed = false;
47 | continue;
48 | end;
49 |
50 | print_indent(1);
51 |
52 | print_text('Repetition %d', i);
53 |
54 | context.repetition = i;
55 |
56 | data.sequence = sequence;
57 | data.index = 1;
58 | data.context = context;
59 | data.result = repmat({0}, sequence.length, 1);
60 | data.timing = nan(sequence.length, 1);
61 |
62 | data = tracker_run(tracker, @callback, data);
63 |
64 | times(:, i) = data.timing;
65 | write_trajectory(result_file, data.result);
66 | csvwrite(time_file, times);
67 |
68 | print_indent(-1);
69 | end;
70 |
71 | if exist(time_file, 'file')
72 | files{end+1} = time_file;
73 | else
74 | metadata.completed = false;
75 | end;
76 |
77 | end
78 |
79 | function [image, region, properties, data] = callback(state, data)
80 |
81 | region = [];
82 | image = [];
83 | properties = struct();
84 |
85 | % Handle initial frame (initialize for the first time)
86 | if isempty(state.region)
87 | region = data.sequence.initialize(data.sequence, data.index, data.context);
88 | image = get_image(data.sequence, data.index);
89 | return;
90 | end;
91 |
92 | % Store initialization
93 | if data.index == 1
94 | data.result{data.index} = 1;
95 | else
96 | data.result{data.index} = state.region;
97 | end;
98 | data.timing(data.index) = state.time;
99 |
100 | data.index = data.index + 1;
101 |
102 | % End of sequence
103 | if data.index > data.sequence.length
104 | return;
105 | end
106 |
107 | image = get_image(data.sequence, data.index);
108 |
109 | end
110 |
111 |
--------------------------------------------------------------------------------
/vot-toolkit-master/vot-workspace/tracker/kcf/fhog.m:
--------------------------------------------------------------------------------
1 | function H = fhog( I, binSize, nOrients, clip, crop )
2 | % Efficiently compute Felzenszwalb's HOG (FHOG) features.
3 | %
4 | % A fast implementation of the HOG variant used by Felzenszwalb et al.
5 | % in their work on discriminatively trained deformable part models.
6 | % http://www.cs.berkeley.edu/~rbg/latent/index.html
7 | % Gives nearly identical results to features.cc in code release version 5
8 | % but runs 4x faster (over 125 fps on VGA color images).
9 | %
10 | % The computed HOG features are 3*nOrients+5 dimensional. There are
11 | % 2*nOrients contrast sensitive orientation channels, nOrients contrast
12 | % insensitive orientation channels, 4 texture channels and 1 all zeros
13 | % channel (used as a 'truncation' feature). Using the standard value of
14 | % nOrients=9 gives a 32 dimensional feature vector at each cell. This
15 | % variant of HOG, refered to as FHOG, has been shown to achieve superior
16 | % performance to the original HOG features. For details please refer to
17 | % work by Felzenszwalb et al. (see link above).
18 | %
19 | % This function is essentially a wrapper for calls to gradientMag()
20 | % and gradientHist(). Specifically, it is equivalent to the following:
21 | % [M,O] = gradientMag( I,0,0,0,1 ); softBin = -1; useHog = 2;
22 | % H = gradientHist(M,O,binSize,nOrients,softBin,useHog,clip);
23 | % See gradientHist() for more general usage.
24 | %
25 | % This code requires SSE2 to compile and run (most modern Intel and AMD
26 | % processors support SSE2). Please see: http://en.wikipedia.org/wiki/SSE2.
27 | %
28 | % USAGE
29 | % H = fhog( I, [binSize], [nOrients], [clip], [crop] )
30 | %
31 | % INPUTS
32 | % I - [hxw] color or grayscale input image (must have type single)
33 | % binSize - [8] spatial bin size
34 | % nOrients - [9] number of orientation bins
35 | % clip - [.2] value at which to clip histogram bins
36 | % crop - [0] if true crop boundaries
37 | %
38 | % OUTPUTS
39 | % H - [h/binSize w/binSize nOrients*3+5] computed hog features
40 | %
41 | % EXAMPLE
42 | % I=imResample(single(imread('peppers.png'))/255,[480 640]);
43 | % tic, for i=1:100, H=fhog(I,8,9); end; disp(100/toc) % >125 fps
44 | % figure(1); im(I); V=hogDraw(H,25,1); figure(2); im(V)
45 | %
46 | % EXAMPLE
47 | % % comparison to features.cc (requires DPM code release version 5)
48 | % I=imResample(single(imread('peppers.png'))/255,[480 640]); Id=double(I);
49 | % tic, for i=1:100, H1=features(Id,8); end; disp(100/toc)
50 | % tic, for i=1:100, H2=fhog(I,8,9,.2,1); end; disp(100/toc)
51 | % figure(1); montage2(H1); figure(2); montage2(H2);
52 | % D=abs(H1-H2); mean(D(:))
53 | %
54 | % See also hog, hogDraw, gradientHist
55 | %
56 | % Piotr's Image&Video Toolbox Version 3.23
57 | % Copyright 2013 Piotr Dollar. [pdollar-at-caltech.edu]
58 | % Please email me if you find bugs, or have suggestions or questions!
59 | % Licensed under the Simplified BSD License [see external/bsd.txt]
60 |
61 | %Note: modified to be more self-contained
62 |
63 | if( nargin<2 ), binSize=8; end
64 | if( nargin<3 ), nOrients=9; end
65 | if( nargin<4 ), clip=.2; end
66 | if( nargin<5 ), crop=0; end
67 |
68 | softBin = -1; useHog = 2; b = binSize;
69 |
70 | [M,O]=gradientMex('gradientMag',I,0,1);
71 |
72 | H = gradientMex('gradientHist',M,O,binSize,nOrients,softBin,useHog,clip);
73 |
74 | if( crop ), e=mod(size(I),b) 0.2
82 |
83 | description = 'Below average';
84 | css = 'bad';
85 |
86 | elseif value < -0.2
87 |
88 | description = 'Above average';
89 | css = 'good';
90 |
91 | else
92 | description = 'Average';
93 | css = 'average';
94 | end
95 |
96 | description = sprintf('%s (%d of %d)', description, find(O == selection, 1), length(O));
97 |
98 | end
99 |
100 |
--------------------------------------------------------------------------------