imreadcv

Reads an image and returns its handle R, using functions defined in the ComputerVision library.

Syntax

R = imreadcv(file)

R = imreadcv(file, mode)

Inputs

file
Name of the image file to be read.
Type: string
mode (optional)
Optional mode for reading file. If no mode is specified, it will use a value of 1 and be read as a 3-channel RGB image. Valid modes are
-1
The image is read as is, with the alpha channel if applicable.
0
The image is read as a 1-channel grayscale image
1
(Default) The image is read as 3-channel image with RGB data.
2
The image is read as a 16/32 bit image if there is depth and as an 8-bit image otherwise.
4
The image is read in any color format.
8
The image is read using gdal driver.
16
The image is read as a 1-channel grayscale image with its size reduced by 1/2.
17
The image is read as a 3-channel RGB image with its size reduced by 1/2.
32
The image is read as a 1-channel grayscale image with its size reduced by 1/4.
33
The image is read as a 3-channel RGB image with its size reduced by 1/4.
64
The image is read as a 1-channel grayscale image with its size reduced by 1/8.
65
The image is read as a 3-channel RGB image with its size reduced by 1/8.
128
The image is read without rotation.
Type: integer

Outputs

R
Handle to the ComputerVision data of the image read. This handle can be used when accessing other functions in the ComputerVision library.
Type: integer

Examples

Read an image as is, with default options:

R = imreadcv('img1.png');
imfinfocv(R)

ans = struct [
  Channels: 3
  Depth: 0
  Height: 200
  Width: 200
]
Read image as a 1-channel grayscale image, reducing its size by 1/4th:

R = imreadcv('img1.png', 32);
imfinfocv(R)

ans = struct [
  Channels: 1
  Depth: 0
  Height: 50
  Width: 50
]