This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

imattributes

Information about image attributes

Syntax

attrs = imattributes
attrs = imattributes(img)
attrs = imattributes(imgmodel)

Description

attrs = imattributes returns information about an image in the current figure. If the current figure does not contain an image, then imattributes returns an empty array.

example

attrs = imattributes(img) returns information about the image specified by image object img. The imattributes function gets the image attributes by querying the image object's CData.

example

attrs = imattributes(imgmodel) returns information about the image represented by the image model object, imgmodel.

Examples

collapse all

Read a grayscale image into the workspace.

h = imshow('liftingbody.png');

Get the image attributes.

attrs = imattributes(h)
attrs = 6x2 cell array
    {'Width (columns)'  }    {'512'      }
    {'Height (rows)'    }    {'512'      }
    {'Class'            }    {'uint8'    }
    {'Image type'       }    {'intensity'}
    {'Minimum intensity'}    {'0'        }
    {'Maximum intensity'}    {'255'      }

h = imshow('gantrycrane.png');

im = imagemodel(h);
attrs = imattributes(im)
attrs = 4x2 cell array
    {'Width (columns)'}    {'400'      }
    {'Height (rows)'  }    {'264'      }
    {'Class'          }    {'uint8'    }
    {'Image type'     }    {'truecolor'}

Input Arguments

collapse all

Image, specified as an image object.

Image model, specified as an imagemodel object.

Output Arguments

collapse all

Image attributes, returned as a cell array of character vectors. The cell array has size 4-by-2 for binary and truecolor images and size 6-by-2 for grayscale (intensity) and indexed images. The first column of the cell array contains the name of the attribute. The second column contains the value of the attribute.

The table lists these attributes in the order they appear in the cell array.

Attribute Name

Value

'Width (columns)'

Number of columns in the image.

'Height (rows)'

Number of rows in the image.

'Class'

Data type used by the image, such as uint8.

'Image type'

One of the image types identified by the Image Processing Toolbox™ software: 'intensity, 'truecolor', 'binary', or 'indexed'.

'Minimum intensity'

  • For intensity images, this value represents the lowest intensity value of any pixel.

  • For indexed images, this value represents the lowest index value into a color map.

This attribute is not included for 'binary' or 'truecolor' images.

'Maximum intensity'

  • For intensity images, this value represents the highest intensity value of any pixel.

  • For indexed images, this value represents the highest index value into a color map.

This attribute is not included for 'binary' or 'truecolor' images.

See Also

Introduced before R2006a