Transform the vot dataset into 4 corner format

Matlab code to change the 8 value ground truth into 4 corner format: (x1, y1, width, height).

clc;  close all;  clear all;

path = '/Tracking_Benchmark/VOT2018/';
videoFiles = dir(path);
videoFiles = videoFiles(:end); for i =:size(videoFiles, )
videoName = videoFiles(i).name;
disp(videoName); gt_path = [path videoName '/groundtruth.txt'];
gt = importdata(gt_path); if size(gt, ) >=
x = gt(:,::end);
y = gt(:,::end);
gt = [min(x,[],), min(y,[],), max(x,[],) - min(x,[],), max(y,[],) - min(y,[],)];
end imgFiles = dir([path videoName '/color/*.jpg']);
firstFrame = imread([path videoName '/color/' imgFiles().name]);
targetObject = imcrop(firstFrame, gt(, :)); imshow(targetObject); new_gt_path = [path videoName '/groundtruth_new.txt'];
fid = fopen(new_gt_path, 'w') ; for j =:size(gt, )
fprintf(fid, '%s', num2str(gt(j, )));
fprintf(fid, '%s', ',');
fprintf(fid, '%s', num2str(gt(j, )));
fprintf(fid, '%s', ',');
fprintf(fid, '%s', num2str(gt(j, )));
fprintf(fid, '%s', ',');
fprintf(fid, '%s \n', num2str(gt(j, )));
end end
05-26 09:01