<< imdisplay Image Reading, Display and Exploration imreadmulti >>

IPCV >> Image Reading, Display and Exploration > imread

imread

Reads image file - Add modes support

Syntax

im = imread(filename)
im = imread(filename,modes)
im = imread(url)

Parameters

filename,url :

A string, the image filename or a valid URL to be read. For the case of URL, the full syntax must be used. For example, "https://gitlab.com/uploads/-/system/project/avatar/3330423/puffin.png".

modes :

imread mode to be specified for different image format

im :

All images will be converted to gray images or RGB images. For gray images, this is a MxN unsigned char matrix; For RGB images, this is a MxNx3 unsigned char matrix.

Description

imread reads many types of image files into Scilab. The format of the file is inferred from the extension in the filename parameter. Currently the following file formats are supported:

im = imread(filename)

reads image in filename into im matrix. If filename contains a truecolor image, im is a MxNx3 hypermatrix, so for example im(:,:,1) stands for the red channel. For gray images, im is a MxNx1 unsigned char matrix.

The imread mode can be controlled by setting any of these optional arguments to 1:

IMREAD_UNCHANGED (return the loaded image as is (with alpha channel, otherwise it gets cropped). Ignore EXIF orientation)

IMREAD_GRAYSCALE (convert image to the single channel grayscale image)

IMREAD_COLOR (convert image to the 3 channel color image)

IMREAD_ANYDEPTH (return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it to 8-bit)

IMREAD_ANYCOLOR (the image is read in any possible color format)

IMREAD_LOAD_GDAL (use the gdal driver for loading the image)

IMREAD_REDUCED_GRAYSCALE_2 (convert image to the single channel grayscale image and the image size reduced 1/2)

IMREAD_REDUCED_COLOR_2 (convert image to the 3 channelcolor image and the image size reduced 1/2)

IMREAD_REDUCED_GRAYSCALE_4 (convert image to the single channel grayscale image and the image size reduced 1/4)

IMREAD_REDUCED_COLOR_4 (convert image to the 3 channelcolor image and the image size reduced 1/4)

IMREAD_REDUCED_GRAYSCALE_8 (convert image to the single channel grayscale image and the image size reduced 1/8)

IMREAD_REDUCED_COLOR_8 (convert image to the 3 channelcolor image and the image size reduced 1/8)

IMREAD_IGNORE_ORIENTATION (do not rotate the image according to EXIF's orientation flag)

Examples

im = imread(fullpath(getIPCVpath() + "/images/" + 'baboon.png'));
imshow(im);

im = imread(fullpath(getIPCVpath() + "/images/" + 'puffin.png'),IMREAD_UNCHANGED=1);
imshow(im);

See also

Authors


Report an issue
<< imdisplay Image Reading, Display and Exploration imreadmulti >>