matlab为long term visual tracking数据集生成groundtruth.txt

csvpath=\'/media/yangrui/yrE/dataset/long_term_visual_tracking/annotations/dev.csv\';
savepath=\'/media/yangrui/yrE/dataset/long_term_visual_tracking/images/dev/\';
gt=importdata(csvpath);
data=gt.data;
datatext=gt.textdata;
for i=1:length(data)
  video=datatext(i,1);
  video=video{1};
  txtpath=[savepath video \'/groundtruth.txt\'];
  jpgname=datatext(i,7);
  jpgname=jpgname{1};
  l=length(jpgname);
  for j=1:(6-l)
    jpgname=[\'0\' jpgname];
  end
  jpgpath=[savepath video \'/\'  jpgname \'.jpeg\'];
  image=imread(jpgpath);
  [height,width,chan]=size(image);
  xmin=data(i,1)*width;
  ymin=data(i,3)*height;
  w=(data(i,2)-data(i,1))*width;
  h=(data(i,4)-data(i,3))*height;
  fp=fopen(txtpath,\'a\');
  fprintf(fp,\'%f,%f,%f,%f\r\n\' ,xmin,ymin,w,h);
  fclose(fp);
end

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzpfys.html