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