This file is indexed.

/usr/share/octave/packages/image-2.2.2/findbounds.m is in octave-image 2.2.2-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
## Copyright (C) 2012 Pantxo Diribarne
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Octave; see the file COPYING.  If not, see
## <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
## @deftypefn  {Function File} {@var{outbnd} =} findbounds (@var{T}, @var{inbnd})
## Estimate bounds for spatial transformation.
##
## Given a transformation structure @var{T} (see e.g. maketform) 
## and bounds @var{inbnd} (2-by-ndims_in) in an input space, returns
## an estimation of the bounds in the output space @var{outbnd} 
## (2-by-ndims_out). For instance two dimensionnal bounds could 
## be represented as : [xmin ymin; xmax ymax]. If @var{T} does not
## define a forward trasform (i.e. for 'polynomial'), the output
## bounds are infered using fsolve and the inverse transform.
##
## @seealso{maketform, cp2tform, tformfwd}
## @end deftypefn

## Author: Pantxo Diribarne <pantxo@dibona>

function [outbnd] = findbounds (T, inbnd)
  if (nargin != 2)
    print_usage ();
  elseif (! istform (T))
    error ("imtransform: T must be a transformation structure (see `maketform')");
  elseif (! all (size (inbnd) == [2 T.ndims_in]))
    error ("imtransform: INBDN must have same size as T.ndims_in");
  endif

  ## Control points grid
  if (columns (inbnd) == 2)
    [xcp, ycp] = meshgrid (linspace (inbnd(1,1), inbnd(2,1), 3),
                           linspace (inbnd(1,2), inbnd(2,2), 3));
    xcp = reshape (xcp, numel (xcp), 1);
    ycp = reshape (ycp, numel (ycp), 1);
    xycp = [xcp, ycp];
  else
    error ("findbounds: support only 2D inputbounds.");
  endif

  ## Output bounds
  if (!is_function_handle (T.forward_fcn))
    outbnd = zeros (size (xycp));
    for ii = 1:rows (xycp)
      fun = @(x) tforminv (T, x) - xycp(ii,:);
      outbnd(ii,:) = fsolve (fun, xycp(ii,:));
    endfor
  else
    outbnd = tformfwd (T, xycp);
  endif
  outbnd = [min(outbnd); max(outbnd)];
endfunction

%!test
%! im = checkerboard ();
%! theta = pi/6;
%! T = maketform ('affine', [cos(theta) -sin(theta); ...
%!                           sin(theta) cos(theta); 0 0]);
%! inbnd = [0 0; 1 1];
%! outbnd = findbounds (T, inbnd);
%! diag = 2^.5;
%! ang = pi/4;
%! assert (diff (outbnd(:,1)), diag * abs (cos (theta - ang)), eps)
%! assert (diff (outbnd(:,2)), diag * abs (cos (theta - ang)), eps)