0001 function WBCcropSample()
0002
0003
0004 clc;
0005 load _param/_wbc;
0006 FN = wbc.experiment(1).FN;
0007 FP = wbc.experiment(1).FP;
0008 TP = wbc.experiment(1).TP;
0009
0010 P = initParam('wbc');
0011 for seq = 1: length(P.IFOLDERS)
0012 fprintf('\nCropping samples at sequence %s', P.IFOLDERS(seq).Name);
0013 for subSeq = 1: size(P.IFOLDERS(seq).Ra,1)
0014 frStart = P.IFOLDERS(seq).Ra(subSeq,1);
0015 frEnd = P.IFOLDERS(seq).Ra(subSeq,2);
0016 for fr = frStart: frEnd
0017
0018 visName = strcat(P.IFOLDERS(seq).Name,'/VIS/VIS_',...
0019 P.IFOLDERS(seq).Name,num2str(fr),'.png');
0020 im = imread(visName);
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 tpFrame = TP(TP(:,1)==seq & TP(:,2)==fr , :);
0046 for pos = 1: size(tpFrame,1)
0047 col = tpFrame(pos,4) - (P.DIMENSION+20)/2;
0048 row = tpFrame(pos,5) - (P.DIMENSION+20)/2;
0049 cropIm = imcrop(im, [col row P.DIMENSION+20 P.DIMENSION+20] );
0050
0051 cropName = strcat('_sample/TP/TP_', num2str(tpFrame(pos,3)), '.png' );
0052 imwrite(cropIm, cropName);
0053 end
0054
0055 end
0056 end
0057 end