Main Content

readRGBAStrip

Read strip data using RGBA interface

Description

example

[RGB,alpha] = readRGBAStrip(t,row) reads a strip of image data specified by row from the TIFF file associated with the Tiff object t using the RGBA interface.

The readRGBAStrip function trims the area in a strip that falls outside of the ImageLength boundary. Therefore, image data from a strip at the bottom edge of the image can have different dimensions.

Examples

collapse all

Read a strip of data from a TIFF file using the RGBA interface.

Create a Tiff object for the image file.

t = Tiff('peppers_RGB_stripped.tif','r');

Get the number of strips and strip size. The readRGBAStrip function trims the area in a strip that falls outside of the ImageLength boundary. Therefore, image data from a strip at the bottom edge of the image can have different dimensions.

numberOfStrips(t)
ans = 6
getTag(t,'RowsPerStrip')
ans = 35

Read the strip containing the fourth row of the image. Since each strip contains 35 rows, specifying any row between 1 and 35 returns the first strip of data.

[RGB,A] = readRGBAStrip(t,4);

Display the image.

imshow(RGB)

Close the Tiff object.

close(t);

Input Arguments

collapse all

Tiff object representing a TIFF file. Use the Tiff function to create the object.

Row number, specified as positive integer. Specify row as a one-based number of any row contained by the strip.

Example: 25

Data Types: double

Output Arguments

collapse all

Image strip data, returned as a m-by-n-by-3 numeric array. Where m and n are the height and width of the strip, respectively.

The value in the RowsPerStrip tag determines the height the strip and the ImageWidth tag determines the width of the strip.

The readRGBAStrip function can transform the pixel values based on specifications in these tags:

PhotometricInterpretation
BitsPerSample
SamplesPerPixel
Orientation
ExtraSamples
ColorMap

Alpha matting associated with the image strip, returned as a numeric array. The number of rows and columns in the alpha matting data are the same as the strip data.

If the image does not have associated alpha matting, then alpha is a matrix with all values set to 255 (transparent).

Algorithms

collapse all

References

This function corresponds to the TIFFReadRGBAStrip function in the LibTIFF C API. To use this function, you must be familiar with the TIFF specification and technical notes. View this documentation at LibTIFF - TIFF Library and Utilities.

Version History

Introduced in R2009b