Main Content

imattributes

Information about image attributes

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');

Figure contains an axes object. The axes object contains an object of type image.

Get the image attributes.

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

h = imshow('gantrycrane.png');

Figure contains an axes object. The axes object contains an object of type image.

im = imagemodel(h);
attrs = imattributes(im)
attrs = 4x2 cell
    {'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 colormap.

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 colormap.

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

Version History

Introduced before R2006a

See Also