2847
|
1 ## Copyright (C) 1996, 1997 John W. Eaton |
2313
|
2 ## |
|
3 ## This file is part of Octave. |
|
4 ## |
|
5 ## Octave is free software; you can redistribute it and/or modify it |
|
6 ## under the terms of the GNU General Public License as published by |
|
7 ## the Free Software Foundation; either version 2, or (at your option) |
|
8 ## any later version. |
|
9 ## |
|
10 ## Octave is distributed in the hope that it will be useful, but |
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 ## General Public License for more details. |
|
14 ## |
|
15 ## You should have received a copy of the GNU General Public License |
|
16 ## along with Octave; see the file COPYING. If not, write to the Free |
5307
|
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 ## 02110-1301, USA. |
1024
|
19 |
3381
|
20 ## -*- texinfo -*- |
6257
|
21 ## @deftypefn {Function File} {} image (@var{img}) |
|
22 ## @deftypefnx {Function File} {} image (@var{x}, @var{y}, @var{img}) |
3373
|
23 ## Display a matrix as a color image. The elements of @var{x} are indices |
|
24 ## into the current colormap and should have values between 1 and the |
6257
|
25 ## length of the colormap. |
3651
|
26 ## |
6164
|
27 ## It first tries to use @code{gnuplot}, then @code{display} from |
|
28 ## @code{ImageMagick}, then @code{xv}, and then @code{xloadimage}. |
|
29 ## The actual program used can be changed using the @code{image_viewer} |
|
30 ## function. |
3714
|
31 ## |
3651
|
32 ## The axis values corresponding to the matrix elements are specified in |
6164
|
33 ## @var{x} and @var{y}. If you're not using gnuplot 4.2 or later, these |
|
34 ## variables are ignored. |
|
35 ## @seealso{imshow, imagesc, colormap, image_viewer} |
3373
|
36 ## @end deftypefn |
559
|
37 |
3202
|
38 ## Author: Tony Richardson <arichard@stark.cc.oh.us> |
2312
|
39 ## Created: July 1994 |
|
40 ## Adapted-By: jwe |
904
|
41 |
6257
|
42 function image (x, y, img) |
|
43 |
6368
|
44 ## Deprecated zoom. Remove this hunk of code if old zoom argument |
|
45 ## is outmoded. |
|
46 if ((nargin == 2 && isscalar (y)) || nargin == 4) |
|
47 warning ("image: zoom argument ignored -- use GUI features"); |
|
48 endif |
|
49 if (nargin == 4) |
|
50 nargin = 3; |
|
51 endif |
|
52 if (nargin == 2 && isscalar (y)) |
|
53 nargin = 1; |
|
54 endif |
559
|
55 |
|
56 if (nargin == 0) |
2303
|
57 ## Load Bobbie Jo Richardson (Born 3/16/94) |
6257
|
58 img = loadimage ("default.img"); |
6088
|
59 x = y = []; |
6368
|
60 elseif (nargin == 1) |
6257
|
61 img = x; |
3651
|
62 x = y = []; |
6368
|
63 elseif (nargin == 2 || nargin > 3) |
6257
|
64 print_usage (); |
|
65 endif |
|
66 |
6309
|
67 tmp = __img__ (x, y, img); |
6257
|
68 |
|
69 if (nargout > 0) |
|
70 h = tmp; |
6088
|
71 endif |
559
|
72 |
|
73 endfunction |