showboxes.m 741 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
% --------------------------------------------------------
% Fast R-CNN
% Copyright (c) 2015 Microsoft
% Licensed under The MIT License [see LICENSE for details]
% Written by Ross Girshick
% --------------------------------------------------------

function showboxes(im, boxes)

image(im);
axis image;
axis off;
set(gcf, 'Color', 'white');

if ~isempty(boxes)
  x1 = boxes(:, 1);
  y1 = boxes(:, 2);
  x2 = boxes(:, 3);
  y2 = boxes(:, 4);
  c = 'r';
  s = '-';
  line([x1 x1 x2 x2 x1]', [y1 y2 y2 y1 y1]', ...
       'color', c, 'linewidth', 2, 'linestyle', s);
  for i = 1:size(boxes, 1)
    text(double(x1(i)), double(y1(i)) - 2, ...
         sprintf('%.3f', boxes(i, end)), ...
         'backgroundcolor', 'r', 'color', 'w');
  end
end