function draw_success_plot_emphasis (tracker, videos, gt, r , db_vids, target)

load('cc');
threshold_steps = 100;

fprintf('Calculating Overlaps [')
k = 0;
for vid = 1:length(videos)
    fprintf('-')
    seq_len = r{vid,1}.seq_len;
    
    for fr = 1:seq_len
        g = gt{vid}(fr,:);
        k = k+1;
        
        for tr = 1:length(tracker)
            ov(k,tr) = overlap_score(r{vid,tr}.res(fr,:) , g);
        end
    end
end
disp(']')


for to = 0:threshold_steps
    for tr = 1:length(tracker)
        s(tr,to+1) = sum(ov(:,tr)>= (to/threshold_steps))/k;
    end
end

auc = sum(s,2)/threshold_steps;

[~,trackers_sorted_indices] = sort(auc,'descend');

figure_handle = figure;
set(gcf,'Color','w');
hold on;

X = 1.0/threshold_steps:1.0/threshold_steps:1;

leg = cell(1,length(tracker));
for i = 1:length(tracker)
    tr = trackers_sorted_indices(i);
    
    if (strcmp(tracker{tr},'STRUCK'))
        txt = 'STRK';
    else
        txt = tracker{tr};
    end
    leg{i} = [txt sprintf(' (%0.2f)', auc(tr))];
    Yi = s(tr,2:end);
    
    pl = plot(X,Yi,'Color',cc(tr,:), 'LineWidth', 2);
end

legend(leg,'Location','NorthEast');
xlim([0 1]);
ylim([0 1.01]);
xlabel('Overlap Threshold');
ylabel('Success Rate');
disp(['Sucess plot of ' int2str(length(tracker)) ' trackers plotted.'])

% search for the target
for i = 1:length(tracker)
    if (strcmp(tracker{i},target))
        tr = trackers_sorted_indices(i);
        Yi = s(tr,2:end);
        plot(X,Yi,'Color',cc(tr,:), 'LineWidth', 4);
    end
end


%set(gcf,'Position',[0,0,1,1]);
box on
saveas(gcf, ['vis//success_plot_' db_vids], 'png') %Save figure

img = imread(['vis//success_plot_' db_vids '.png']);
img2 = img(65:end-35,86:end-110,:);
imwrite(img2,['vis//success_plot_' db_vids '.png']);


