imread
Reads an image with the pixel data stored in a matrix R, with functions defined in the omlimgtoolbox.
Syntax
[R, dummy, alpha] = imread(file)
[R, dummy, alpha] = imread(file, ext)
[R, dummy, alpha] = imread(file, ..., 'PixelRegion', region)
Inputs
- file
- Name of the image file to be read.
- ext (optional)
- Specifies the extension to use for the image file to be read. If this option is used, file should be the base name with no extension specified.
- region (optional)
- Name-value pair to specify the pixel region of the image to be read. If specified, region is specified as a cell array, with two matrices of at least two elements each specifying the rows and columns. If the matrix elements of region have two elements, they specify the start and end pixels to be read for the rows/columns of the image region, respectively. If the matrix elements of region have more than two elements, they specify the start, increment, and end pixels to be read for the rows/columns of the image region, respectively.
Outputs
- R
- The resulting matrix contains the pixel data for the image read. R is a 2-D matrix for gray scale images and a 3-D matrix otherwise.
- dummy
- Dummy parameter which is ignored. It is there for script compatibility.
- alpha
- 2-D matrix with values of the alpha channel.
Examples
addtoolbox('omlimgtoolbox')
m = imread('img_1640.jpg');
[m, dummy, alpha] = imread('productCompose-16', '.png', 'PixelRegion', {[2 7], [1 10]});
[m, dummy, alpha] = imread('productCompose-16', '.png', 'PixelRegion', {[2 2 7], [1 10]});