Read tile data using RGBA interface
uses the RGBA interface to read a tile from the TIFF file associated with the
alpha] = readRGBATile(
t. The tile is specified by
col which are the one-based row
and column numbers of any pixel in the requested tile.
readRGBATile function trims the area in a tile that falls
outside of the
boundaries. Therefore, image data from tiles that occur on the bottom edge or the
right edge of the image can have different dimensions.
Read a tile of data from a TIFF image file using the RGBA interface.
Tiff object for the image file.
t = Tiff('peppers_RGB_tiled.tif','r');
Get the number of tiles and tile size.
numTiles = numberOfTiles(t)
numTiles = 36
tileSize = [getTag(t,'TileLength') getTag(t,'TileWidth')]
tileSize = 1×2 32 48
Read the tile containing the
100th row and
100th column from the image. The
readRGBATile function trims the area in a tile that is outside of the
ImageWidth boundaries. Therefore, image data from tiles that occur on the right edge or the bottom edge of the image can have different dimensions.
row = 100; col = 100; [RGB,A] = readRGBATile(t,row,col);
Display the image.
imshow(RGB,'InitialMagnification','fit') % magnify for display
t— Tiff object
Tiff object representing a TIFF file. Use the
Tiff function to create the object.
row— Row number
Row number, specified as positive integer. Specify
as a one-based row index of any pixel in the tile.
col— Column number
Column number, specified as positive integer. Specify
col as a one-based column index of any pixel in the
RGB— Image tile data
Image tile data, returned as an
numeric array. Where
n are the
height and width of the tile, respectively.
The value in the
TileLength tag determines the number
of rows and the
TileWidth tag determines the number of
columns in the tile data.
readRGBATile function can transform the pixel
values based on specifications in these tags:
alpha— Alpha matting
Alpha matting associated with the image tile, returned as a numeric array. The number of rows and columns in the alpha matting data are the same as the tile data.
If the image does not have associated alpha matting, then
alpha is a matrix with all values set to