home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21eb.zip / octave / SCRIPTS.ZIP / scripts.fat / image / image.m < prev    next >
Text File  |  1998-07-01  |  2KB  |  57 lines

  1. ## Copyright (C) 1996 John W. Eaton
  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
  17. ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  18. ## 02111-1307, USA.
  19.  
  20. ## Display an octave image matrix.
  21. ##
  22. ## image (x) displays a matrix as a color image. The elements of x are
  23. ## indices into the current colormap and should have values between 1
  24. ## and the length of the colormap.
  25. ##
  26. ## image (x, zoom) changes the zoom factor.  The default value is 1.
  27. ##
  28. ## SEE ALSO: imshow, imagesc, colormap.
  29.  
  30. ## Author: Tony Richardson <amr@mpl.ucsd.edu>
  31. ## Created: July 1994
  32. ## Adapted-By: jwe
  33. ## Modified by Klaus Gebhardt, 1996 - 1997
  34.  
  35. function image (x, zoom)
  36.  
  37.   if (nargin == 0)
  38.     ## Load Bobbie Jo Richardson (Born 3/16/94)
  39.     [x, map] = loadimg ("default.img");
  40.   elseif (nargin == 1)
  41.     zoom = 1;
  42.   elseif (nargin > 2)
  43.     usage ("image (matrix, [zoom])");
  44.   endif
  45.  
  46.   pnm_name = tmpnam ();
  47.  
  48.   saveimg (pnm_name, x, "pnm");
  49.  
  50.   ## Start the viewer.
  51.   i = findstr (pnm_name, "/");
  52.   pnm_name (i) = "\\";
  53.  
  54.   system (sprintf ("oct-view %s %f", pnm_name, zoom));
  55.  
  56. endfunction
  57.