-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathload_video_info.m
45 lines (40 loc) · 1.77 KB
/
load_video_info.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
% -------------------------------------------------------------------------------------------------
function [img_files, pos, target_sz] = load_video_info(base_path, video)
%LOAD_VOT_VIDEO_INFO
% Loads all the relevant information for the video in the given path:
% the list of image files (cell array of strings), initial position
% (1x2), target size (1x2), the ground truth information for precision
% calculations (Nx4, for N frames), and the path where the images are
% located. The ordering of coordinates and sizes is always [y, x].
%
% Joao F. Henriques, 2014
% http://www.isr.uc.pt/~henriques/
% -------------------------------------------------------------------------------------------------
%full path to the video's files
if base_path(end) ~= '/' && base_path(end) ~= '\',
base_path(end+1) = '/';
end
video_path = [base_path video '/'];
%load ground truth from text file
%ground_truth = csvread([base_path '/' video '/' 'groundtruth.txt']);
%vottir
ground_truth = csvread([base_path video '/' 'groundtruth.txt']);
region = ground_truth(1, :);
[cx, cy, w, h] = get_axis_aligned_BB(region);
pos = [cy cx]; % centre of the bounding box
target_sz = [h w];
%load all jpg files in the folder
%img_files = dir([video_path '*.jpg']);
img_files = dir([video_path '*.png']);% vottir png
assert(~isempty(img_files), 'No image files to load.')
img_files = sort({img_files.name});
%eliminate frame 0 if it exists, since frames should only start at 1
img_files(strcmp('00000000.jpg', img_files)) = [];
img_files = strcat(video_path, img_files);
% read all frames at once
% imgs = vl_imreadjpeg(img_files,'numThreads', 12);
% imgs=ceil(1,numel(img_files));
% for i=1:numel(img_files)
% imgs{1,i}=imread(img_files{1,i});
% end
end