/usr/share/octave/site/m/vlfeat/toolbox/plotop/vl_plotbox.m is in octave-vlfeat 0.9.20+dfsg0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | function [h, t] = vl_plotbox(boxes, varargin)
% VL_PLOTBOX Plot boxes
% VL_PLOTBOX(BOX) plots a box specified by the 4-dimensional column
% vector BOXES = [XMIN YMIN XMAX YMAX]'. If BOXES is a 4 x N matrix,
% a box for each of the N columns is plotted.
%
% H = VL_PLOTBOX(BOXES) returns a handle to the line drawing
% representing the boxes. For multiple boxes, H is a row vector with
% one handle per box.
%
% VL_PLOTBOX(BOXES, 'LABEL', LABEL) annotates the box with the
% string LABEL. If BOXES contains multiple boxes, then LABEL can be
% a cell array with one entry for each box. H is then a 2 x N array
% with handles to boxes and corresponding labels.
%
% VL_PLOTBOX(BOXES, ...) passes any extra argument to the underlying
% plotting function. The first optional argument can be a line
% specification string such as the one used by MATLAB's PLOT()
% function.
%
% See also:: VL_PLOTFRAME().
% Author:: Andrea Vedaldi
% Copyright (C) 2008-13 Andrea Vedaldi
%
% This file is part of the VLFeat library and is made available under
% the terms of the BSD license (see the COPYING file).
opts.label = {} ;
% if the first optional argument is a linespec expand it
if length(varargin) > 0
lineprop = vl_linespec2prop(varargin{1}) ;
varargin = {lineprop{:}, varargin{2:end}} ;
end
% parse optional arguments
[opts, varargin] = vl_argparse(opts, varargin) ;
if ischar(opts.label)
opts.label = {opts.label} ;
end
if size(boxes,2) == 0
h = [] ;
return ;
end
if size(boxes,1) ~= 4
error('BOXES must be a 4 x N matrix') ;
end
Lx = [1 0 0 0 ;
0 0 1 0 ;
0 0 1 0 ;
1 0 0 0 ;
1 0 0 0 ] ;
Ly = [0 1 0 0 ;
0 1 0 0 ;
0 0 0 1 ;
0 0 0 1 ;
0 1 0 0 ] ;
fig = newplot ;
h = line(Lx * boxes, Ly * boxes, varargin{:}) ;
h = h' ;
if ~isempty(opts.label)
ish = ishold ;
hold on ;
t = zeros(1,length(opts.label)) ;
for r = 1:size(boxes,2)
cl = get(h(1,r), 'Color') ;
q = mod(r - 1, length(opts.label)) + 1 ;
h(2,r) = text(mean(boxes([1 3],r)), boxes(2,r), opts.label{q}, ...
'Background', cl, ...
'VerticalAlignment', 'bottom', ...
'HorizontalAlignment', 'center') ;
end
if ~ish, hold off ; end
end
if nargout == 0
clear h ;
end
|