/usr/share/octave/packages/image-2.6.1/subimage.m is in octave-image 2.6.1-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 | ## Copyright (C) 2014 Carnë Draug <carandraug@octave.org>
##
## 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 this program; if not, see
## <http:##www.gnu.org/licenses/>.
## -*- texinfo -*-
## @deftypefn {Function File} {} subimage (@var{bw})
## @deftypefnx {Function File} {} subimage (@var{img})
## @deftypefnx {Function File} {} subimage (@var{rgb})
## @deftypefnx {Function File} {} subimage (@var{ind}, @var{cmap})
## @deftypefnx {Function File} {} subimage (@var{x}, @var{y}, @dots{})
## @deftypefnx {Function File} {@var{h} =} subimage (@dots{})
## Display images in subplots.
##
## A single figure, even with multiple subplots, is limited to a single
## colormap. With the exception of truecolor images, images will use the
## figure colormap which make it impossible to have multiple images with
## different display. This function transforms any image in truecolor
## to workaround this limitation.
##
## The new subimage is displayed as if using @code{image}. The optional
## arguments @var{x} and @var{y} are passed to @code{image} to specify the
## range of the axis labels.
##
## @seealso{image, imagesc, imshow, subplot}
## @end deftypefn
function h = subimage (varargin)
if (nargin < 1 || nargin > 4)
print_usage ();
endif
if (nargin < 3)
alternative_xy = false;
im_ind = 1;
else
alternative_xy = true;
im_ind = 3;
if (numel (varargin{1}) == 2 && numel (varargin{2}) == 2)
x = varargin{1};
y = varargin{2};
else
error ("subimage: X and Y must be two element vectors each");
endif
endif
im = varargin{im_ind};
if (numel (varargin) > im_ind)
rgb = ind2rgb (im, varargin{im_ind +1});
elseif (isbw (im))
rgb = repmat (im2uint8 (im), [1 1 3 1]);
elseif (isgray (im))
rgb = repmat (im, [1 1 3 1]);
elseif (isrgb (im))
rgb = im;
else
error ("subimage: no valid BW, IMG, IND, or RGB images in input arguments");
endif
if (alternative_xy)
tmp_h = image (x, y, rgb);
else
tmp_h = image (rgb);
endif
if (nargout > 0)
h = tmp_h;
endif
endfunction
|