readRGBATile
使用 RGBA 接口读取图块数据
说明
示例
从 RGBA TIFF 图像获取图块
使用 RGBA 接口从 TIFF 图像文件读取数据图块。
为图像文件创建一个 Tiff
对象。
t = Tiff('peppers_RGB_tiled.tif','r');
获取图块数量和图块大小。
numTiles = numberOfTiles(t)
numTiles = 36
tileSize = [getTag(t,'TileLength') getTag(t,'TileWidth')]
tileSize = 1×2
32 48
从图像中读取包含第 100
行和第 100
列的图块。readRGBATile
函数剪除图块中超出 ImageLength
和 ImageWidth
边界的区域。因此,来自图像右边缘或底边缘的图块的图像数据可能具有不同维度。
row = 100; col = 100; [RGB,A] = readRGBATile(t,row,col);
显示图像。
imshow(RGB,'InitialMagnification','fit') % magnify for display
关闭 Tiff
对象。
close(t);
输入参数
输出参量
RGB
— 图像图块数据
数值数组
图像图块数据,以 m
×n
×3
数值数组形式返回。其中 m
和 n
分别为图块的高度和宽度。
TileLength
标记中的值决定图块数据中的行数,TileWidth
标记中的值确定列数。
readRGBATile
函数可以根据下列标记中的设定来转换像素值:
PhotometricInterpretation |
BitsPerSample |
SamplesPerPixel |
Orientation |
ExtraSamples |
ColorMap |
alpha
— alpha 抠图
数值数组
与图像图块关联的 alpha 抠图,以数值数组形式返回。alpha 抠图数据中的行数和列数与图块数据相同。
如果图像没有相关的 alpha 抠图,则 alpha
是其所有值都设为 255
(透明)的矩阵。
算法
参考
此函数对应于 LibTIFF C API 中的 TIFFReadRGBATile
函数。要使用此函数,您必须熟悉 TIFF 规范和技术说明。请访问 LibTIFF - TIFF 库和实用工具查看此文档。
版本历史记录
在 R2009b 中推出
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)