Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

imattributes

Information about image attributes

Syntax

attrs = imattributes
attrs = imattributes(himage)
attrs = imattributes(imgmodel)

Description

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

attrs = imattributes(himage) returns information about the image specified by himage, a handle to an image object. imattributes gets the image attributes by querying the image object's CData.

imattributes returns image attribute information in attrs, a 4-by-2 or 6-by-2 cell array, depending on the image type. The first column of the cell array contains the name of the attribute. The second column contains the value of the attribute. Both attribute names and values are character vectors. The following 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.

    Note:   For single or int16 images, imageinfo returns a class value of double, because image objects convert CData of these classes to double.

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

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.

Not included for 'binary' or 'truecolor' images.

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

Examples

Retrieve the attributes of a grayscale image.

h = imshow('liftingbody.png');
attrs = imattributes(h)
attrs = 

    'Width (columns)'      '512'      
    'Height (rows)'        '512'      
    'Class'                'uint8'    
    'Image type'           'intensity'
    'Minimum intensity'    '0'        
    'Maximum intensity'    '255'

Retrieve the attributes of a truecolor image.

h = imshow('gantrycrane.png');
im = imagemodel(h);
attrs = imattributes(im)
attrs = 

    'Width (columns)'    '400'      
    'Height (rows)'      '264'      
    'Class'              'uint8'    
    'Image type'         'truecolor'

See Also

Introduced before R2006a

Was this topic helpful?