%
% This code is used to display bounding-boxes which correspond to manually labeled pedestrians (ground-truth).
% Non-occluded pedestrian are shown in red, while partial-occluded are displayed in yellow.
% 
% NOTE: for detection performance purposes, only non-occluded pedestrians are considered.
%     
% By: CPremebida
%-------------------------------
clear; clc;
path_ima = './ISRtest_frames/'; %Extracted from ISRtest_frames.zip
load('ISRtest_gt.mat');         %Extracted from ISRtest_gt.zip
% % %-------------------------------
ima = dir([path_ima,'*.jpg']);
figure(1); rcolor = ['y', 'r'];

for k=1:1:size(ima,1)
% % %----------------------------------------
    fd_ima = fopen([path_ima,ima(k).name],'r');
     if fd_ima > 0
        Ima=imread([path_ima,ima(k).name]);
        fclose(fd_ima);
    else
        fprintf('WARNING::: file not opened: %s \n',ima(k).name);
        keyboard
     end
     
cla;
imshow(Ima); hold on;     
% % %----------------------------------------
% % :::::::::::: Ground truth :::::::::::::::
for r=1:ISRtest_gt(k).nobj
    pos = [ISRtest_gt(k).x1(r),ISRtest_gt(k).y1(r),...
        ISRtest_gt(k).x2(r)-ISRtest_gt(k).x1(r),ISRtest_gt(k).y2(r)-ISRtest_gt(k).y1(r)];
    rectangle('Position',pos,'EdgeColor',rcolor(ISRtest_gt(k).class(r)+1),'LineWidth',2,'LineStyle','--');
end
pause(0.1); %for display purpose
%----------------------------------------
%----------------------------------------  
fprintf('---> Frame %d of %d\n',k,size(ima,1));
% 
end

