Mercurial > octave-antonio
comparison scripts/image/imread.m @ 16984:997efb8d0b19
imread: implement options Index, Frames, and Info.
* imread.m: write documentation about options of param/key style.
* private/core_imread.m: write parsing of options in the param/key style.
Implement the option for Index, Frames, and Info. Also write parsing
for PixelRegion but comment out the code until it's implemented in
__magick_read__(). Add comments about, and deprecate, Octave's native
image format which is completely undocumented. Remove tests since they
are duplicated from the ones in imread.m.
* __magick_read__.cc: move input check to the m file calling it. Rewrite
parsing of options which are now in a non-optional struct (default values
are now set on the m function).
* private/imageIO.m: fix call to other functions with varargout with
multiple output values.
author | Carnë Draug <carandraug@octave.org> |
---|---|
date | Sat, 13 Jul 2013 12:41:59 +0100 |
parents | 52c1b832d98e |
children | a1d091243d11 |
comparison
equal
deleted
inserted
replaced
16983:4660d047955e | 16984:997efb8d0b19 |
---|---|
1 ## Copyright (C) 2013 Carnë Draug | |
1 ## Copyright (C) 2008-2012 Thomas L. Scofield | 2 ## Copyright (C) 2008-2012 Thomas L. Scofield |
2 ## Copyright (C) 2008 Kristian Rumberg | 3 ## Copyright (C) 2008 Kristian Rumberg |
3 ## Copyright (C) 2006 Thomas Weber | 4 ## Copyright (C) 2006 Thomas Weber |
4 ## Copyright (C) 2005 Stefan van der Walt | 5 ## Copyright (C) 2005 Stefan van der Walt |
5 ## Copyright (C) 2002 Andy Adler | 6 ## Copyright (C) 2002 Andy Adler |
23 ## -*- texinfo -*- | 24 ## -*- texinfo -*- |
24 ## @deftypefn {Function File} {[@var{img}, @var{map}, @var{alpha}] =} imread (@var{filename}) | 25 ## @deftypefn {Function File} {[@var{img}, @var{map}, @var{alpha}] =} imread (@var{filename}) |
25 ## @deftypefnx {Function File} {[@dots{}] =} imread (@var{filename}, @var{ext}) | 26 ## @deftypefnx {Function File} {[@dots{}] =} imread (@var{filename}, @var{ext}) |
26 ## @deftypefnx {Function File} {[@dots{}] =} imread (@var{url}) | 27 ## @deftypefnx {Function File} {[@dots{}] =} imread (@var{url}) |
27 ## @deftypefnx {Function File} {[@dots{}] =} imread (@dots{}, @var{idx}) | 28 ## @deftypefnx {Function File} {[@dots{}] =} imread (@dots{}, @var{idx}) |
29 ## @deftypefnx {Function File} {[@dots{}] =} imread (@dots{}, @var{param1}, @var{val1}, @dots{}) | |
28 ## Read images from various file formats. | 30 ## Read images from various file formats. |
29 ## | 31 ## |
30 ## Reads an image as a matrix from the file @var{filename}. If there is | 32 ## Reads an image as a matrix from the file @var{filename}. If there is |
31 ## no file @var{filename}, and @var{ext} was specified, it will look for | 33 ## no file @var{filename}, and @var{ext} was specified, it will look for |
32 ## a file named @var{filename} and extension @var{ext}, i.e., a file named | 34 ## a file named @var{filename} and extension @var{ext}, i.e., a file named |
45 ## Some file formats, such as TIFF and GIF, are able to store multiple | 47 ## Some file formats, such as TIFF and GIF, are able to store multiple |
46 ## images in a single file. @var{idx} can be a scalar or vector | 48 ## images in a single file. @var{idx} can be a scalar or vector |
47 ## specifying the index of the images to read. By default, Octave | 49 ## specifying the index of the images to read. By default, Octave |
48 ## will only read the first page. | 50 ## will only read the first page. |
49 ## | 51 ## |
52 ## Depending on the file format, it is possible to configure the reading | |
53 ## of images with @var{param}, @var{val} pairs. The following options | |
54 ## are supported: | |
55 ## | |
56 ## @table @asis | |
57 ## @item Frames or Index | |
58 ## This is an alternative method to specify @var{idx}. When specifying it | |
59 ## in this way, its value can also be the string "all". | |
60 ## | |
61 ## @item Info | |
62 ## This option exists for @sc{Matlab} compatibility and has no effect. For | |
63 ## maximum performance while reading multiple images from a single file, | |
64 ## use the Index option. | |
65 ## @end table | |
66 ## | |
50 ## @seealso{imwrite, imfinfo, imformats} | 67 ## @seealso{imwrite, imfinfo, imformats} |
51 ## @end deftypefn | 68 ## @end deftypefn |
52 | 69 |
70 ## Author: Carnë Draug <carandraug@octave.org> | |
53 ## Author: Thomas L. Scofield <scofield@calvin.edu> | 71 ## Author: Thomas L. Scofield <scofield@calvin.edu> |
54 ## Author: Kristian Rumberg <kristianrumberg@gmail.com> | 72 ## Author: Kristian Rumberg <kristianrumberg@gmail.com> |
55 ## Author: Thomas Weber <thomas.weber.mail@gmail.com> | 73 ## Author: Thomas Weber <thomas.weber.mail@gmail.com> |
56 ## Author: Stefan van der Walt <stefan@sun.ac.za> | 74 ## Author: Stefan van der Walt <stefan@sun.ac.za> |
57 ## Author: Andy Adler | 75 ## Author: Andy Adler |
70 filename = {varargin{1}}; | 88 filename = {varargin{1}}; |
71 if (nargin > 1 && ischar (varargin {2})) | 89 if (nargin > 1 && ischar (varargin {2})) |
72 filename{2} = varargin{2}; | 90 filename{2} = varargin{2}; |
73 endif | 91 endif |
74 | 92 |
75 varargout{1:nargout} = imageIO (@core_imread, "read", filename, varargin{:}); | 93 [varargout{1:nargout}] = imageIO (@core_imread, "read", filename, varargin{:}); |
76 endfunction | 94 endfunction |
77 | 95 |
78 %!testif HAVE_MAGICK | 96 %!testif HAVE_MAGICK |
79 %! vpng = [ ... | 97 %! vpng = [ ... |
80 %! 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, ... | 98 %! 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, ... |