[Top] [Up] [Prev] [Next] [Up] [Basic Concepts] [Demonstrations] [Functions] SDC Morphology Toolbox V1.1 15Jan02

mmreadgray - Read an image from a commercial file format and stores it as a gray-scale image.


Synopsis
y = mmreadgray( filename )
Input
filename: String. Name of file. Possible extensions: tif, hdf, jpg, bmp, pcx, xwd.
Output
y: Gray-scale (uint8 or uint16) or binary image (logical uint8).
Description
mmimread reads the image in filename and stores it in y, an uint8 gray-scale image (without colormap). If the input file is a color image, it is converted to gray-scale. This function calls the MATLAB function imread.
Examples
a=mmreadgray('small_bw.tif');
mmshow(a)

a_aux(:,:,1) =
  Columns 1 through 12
     0     0     0     0     0     0     0     0     0     0     0     0
     0     0     0     0     0     0     0   255   255     0     0     0
     0     0     0     0     0     0   255   255   255   255     0     0
     0     0     0     0     0   255   255   255   255   255   255     0
     0     0     0     0   255   255   255   255   255   255   255   255
     0     0     0   255   255   255   255   255   255   255   255   255
     0     0   255   255   255   255   255   255   255   255   255   255
     0   255   255   255   255   255   255   255   255   255   255   255
     0   255   255   255   255   255   255   255   255   255   255   255
     0   255   255   255   255   255   255   255   255   255   255   255
     0     0   255   255   255   255   255   255   255   255   255   255
     0     0     0   255   255   255   255   255   255   255   255   255
     0     0     0     0     0     0     0   255   255     0     0     0
     0     0     0     0     0     0   255   255   255   255     0     0
     0     0     0     0     0   255   255   255   255   255   255     0
     0     0     0     0     0     0     0     0     0     0     0     0
  Columns 13 through 16
     0     0     0     0
     0     0     0     0
     0     0     0     0
     0     0     0     0
     0     0     0     0
   255     0     0     0
   255   255     0     0
   255   255   255     0
   255   255   255     0
   255   255   255     0
   255   255     0     0
   255     0     0     0
     0     0     0     0
     0     0     0     0
     0     0     0     0
     0     0     0     0
a_aux(:,:,2) =
  Columns 1 through 12
     0     0     0     0     0     0     0     0     0     0     0     0
     0     0     0     0     0     0     0   255   255     0     0     0
     0     0     0     0     0     0   255   255   255   255     0     0
     0     0     0     0     0   255   255   255   255   255   255     0
     0     0     0     0   255   255   255   255   255   255   255   255
     0     0     0   255   255   255   255   255   255   255   255   255
     0     0   255   255   255   255   255   255   255   255   255   255
     0   255   255   255   255   255   255   255   255   255   255   255
     0   255   255   255   255   255   255   255   255   255   255   255
     0   255   255   255   255   255   255   255   255   255   255   255
     0     0   255   255   255   255   255   255   255   255   255   255
     0     0     0   255   255   255   255   255   255   255   255   255
     0     0     0     0     0     0     0   255   255     0     0     0
     0     0     0     0     0     0   255   255   255   255     0     0
     0     0     0     0     0   255   255   255   255   255   255     0
     0     0     0     0     0     0     0     0     0     0     0     0
  Columns 13 through 16
     0     0     0     0
     0     0     0     0
     0     0     0     0
     0     0     0     0
     0     0     0     0
image
(a)
Equation

equation

equation

where H and W are, respectively, the number of rows and columns of the image f. f(1,1) is the top-left pixel of f.

equation

where k=1, 255 and 65535, respectively, for binary images, uint8, and uint16 gray-scale images.
See Also
mmwrite - Write a gray-scale image into a commercial file format.
Source code
mmreadgray.m

[Top] [Up] [Prev] [Next] [Up] [Basic Concepts] [Demonstrations] [Functions] Valid XHTML 1.0!
Copyright (c) 1998-2002 by SDC Information Systems