M-File Help: iread | View code for iread |
Read image from file
im = iread() presents a file selection GUI from which the user can select an image file which is returned as a matrix. On subsequent calls the initial folder is as set on the last call.
im = iread([], OPTIONS) as above but allows options to be specified.
im = iread(path, options) as above but the GUI is set to the folder specified by path. If the path is not absolute it is searched for on the MATLAB search path.
im = iread(file, options) reads the specified image file and returns a matrix. If the path is not absolute it is searched for on MATLAB search path.
The image can be greyscale or color in any of a wide range of formats supported by the MATLAB IMREAD function.
Wildcards are allowed in file names. If multiple files match a 3D or 4D image is returned where the last dimension is the number of images in the sequence.
'uint8' | return an image with 8-bit unsigned integer pixels in the range 0 to 255 |
'single' | return an image with single precision floating point pixels in the range 0 to 1. |
'double' | return an image with double precision floating point pixels in the range 0 to 1. |
'grey' | convert image to greyscale, if it's color, using ITU rec 601 |
'grey_709' | convert image to greyscale, if it's color, using ITU rec 709 |
'gamma', G | apply this gamma correction, either numeric or 'sRGB' |
'reduce', R | decimate image by R in both dimensions |
'roi', R | apply the region of interest R to each image, where R=[umin umax; vmin vmax]. |
Read a color image and display it
>> im = iread('lena.png'); >> about im im [uint8] : 512x512x3 (786.4 kB) >> idisp(im);
Read a greyscale image sequence
>> im = iread('seq/*.png'); >> about im im [uint8] : 512x512x9 (2.4 MB) >> ianimate(im, 'loop');
idisp, ianimate, imono, igamma, imread, imwrite, path
© 1990-2012 Peter Corke.