Main Content

readEncodedStrip

Read data from specified strip

Description

example

stripData = readEncodedStrip(t,stripNumber) returns the image data from the strip specified by stripNumber from the TIFF file represented by the Tiff object t.

The readEncodedStrip 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.

example

[Y,Cb,Cr] = readEncodedStrip(t,stripNumber) returns the YCbCr components of the strip data specified by stripNumber from the TIFF file represented by the Tiff object t. Use this syntax only with images that have a YCbCr photometric interpretation.

Depending upon the values of the YCbCrSubSampling tag, the size of the Cb component can differ from the Y component.

Examples

collapse all

Read a strip of image data from a TIFF file that contains an image with a stripped layout.

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

Determine the number of strips and the length of the strip in the image.

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

Read and display the third strip of the image. The readEncodedStrip 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.

strip = readEncodedStrip(t,3);
imshow(strip);
title('3^{rd} Strip Peppers Image');

Figure contains an axes object. The axes object with title 3 toThePowerOf r d baseline blank S t r i p blank P e p p e r s blank I m a g e contains an object of type image.

Close the Tiff object.

close(t);

Read a strip of image data from a YCbCr TIFF file that contains an image with a stripped layout.

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

Determine the number of strips and the length of each strip in the image.

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

Read and display the Y component of the third strip of the image. The readEncodedStrip 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.

[Y,Cb,Cr] = readEncodedStrip(t,3);
imshow(Y);
title('3^{rd} Strip of Peppers Image (YCbCr)')

Figure contains an axes object. The axes object with title 3 toThePowerOf r d baseline blank S t r i p blank o f blank P e p p e r s blank I m a g e blank ( Y C b C r ) contains an object of type image.

Close the Tiff object.

close(t);

Input Arguments

collapse all

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

Strip number, specified as a positive integer. Strip numbers are one-based numbers.

Example: 15

Data Types: double

Output Arguments

collapse all

Strip data, returned as a numeric array.

Luma component of the strip data, returned as a two-dimensional numeric array.

Blue-difference chroma component of the strip data, returned as a two-dimensional numeric array.

Red-difference chroma component of the strip data, returned as a two-dimensional numeric array.

Limitations

  • readEncodedStrip returns image data from SVS files as RGB data only, even for SVS files with YCbCr photometric interpretation.

Algorithms

collapse all

References

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

Introduced in R2009b