function DA = PROCEDURE_CollectDetectionList(Root,Filetemplate,idxlist,bisToyota)
%function DA = PROCEDURE_CollectDetectionList(Root,Filetemplate,idxlist,bisToyota)
%
%

DA = [];
for i = idxlist
  tDA = GetDA(Root,Filetemplate,i);
  DA = [DA,tDA];
end

if(nargin < 4)
  bisToyota = 0;
end
if(bisToyota)
  DA = RectifyToyota(DA);
end


function tDA = GetDA(Root,Filetemplate,i);
tDA =[];
load(fullfile(Root,sprintf(Filetemplate,i)));%-->DL
if(exist('DetectionList'));
  DL = DetectionList.ped;
end
for j = 1:length(DL)
  tDA(1,end+1) = i;
  tDA(2,end) = DL(j).str;
  tDA(3,end) = DL(j).rel_loc_xy(1);
  tDA(4,end) = DL(j).rel_loc_xy(2);
  tDA(5,end) = DL(j).scale;
end  

function D = RectifyToyota(D);
%function D = RectifyToyota(D);

Tscale = 0:1:16;
Tscale = 64 * (2).^(Tscale/4);
Tscale = floor(Tscale);
D(3,:) = D(3,:) * 1280;%x
D(4,:) = D(4,:) * 960;%y
D(5,:) = Tscale(D(5,:));