我是靠谱客的博主 老迟到柜子,最近开发中收集的这篇文章主要介绍DSST算法MATLAB代码中,load_video_info.m文件修改,使其适合数据集,觉得挺不错的,现在分享给大家,希望可以做个参考。
概述
全选load_video_info.m
代码,直接替换为下面代码即可
function [img_files, pos, target_sz, ground_truth, video_path] = load_video_info(video_path)
% [img_files, pos, target_sz, ground_truth, video_path] = load_video_info(video_path)
% text_files = dir([video_path '*_frames.txt']);
% f = fopen([video_path text_files(1).name]);
% frames = textscan(f, '%f,%f');
% fclose(f);
text_files = dir([video_path 'groundtruth_rect.txt']);
assert(~isempty(text_files), 'No initial position and ground truth (*_gt.txt) to load.')
f = fopen([video_path text_files(1).name]);
ground_truth = textscan(f, '%f,%f,%f,%f'); %[x, y, width, height]
ground_truth = cat(2, ground_truth{:});
fclose(f);
frames{1} = 1;
frames{2} = size(ground_truth,1);
%set initial position and size
target_sz = [ground_truth(1,4), ground_truth(1,3)];
pos = [ground_truth(1,2), ground_truth(1,1)];
ground_truth = [ground_truth(:,[2,1]) + (ground_truth(:,[4,3]) - 1) / 2 , ground_truth(:,[4,3])];
%see if they are in the 'imgs' subfolder or not
if exist([video_path num2str(frames{1}, 'img/%04i.png')], 'file'),
video_path = [video_path 'img/'];
img_files = num2str((frames{1} : frames{2})', '%04i.png');
elseif exist([video_path num2str(frames{1}, 'img/%04i.jpg')], 'file'),
video_path = [video_path 'img/'];
img_files = num2str((frames{1} : frames{2})', '%04i.jpg');
elseif exist([video_path num2str(frames{1}, 'img/%04i.bmp')], 'file'),
video_path = [video_path 'img/'];
img_files = num2str((frames{1} : frames{2})', '%04i.bmp');
else
error('No image files to load.')
end
%list the files
img_files = cellstr(img_files);
end
最后
以上就是老迟到柜子为你收集整理的DSST算法MATLAB代码中,load_video_info.m文件修改,使其适合数据集的全部内容,希望文章能够帮你解决DSST算法MATLAB代码中,load_video_info.m文件修改,使其适合数据集所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复