像素插图samplemodel与像素步幅,扫描线路和频带偏移等术语混淆
在尝试阅读有关像素数据的过程中,我遇到了PixelInterleavedSamplemodel
并使用了此链接获取更多信息。但是,文档中的术语像素步幅,扫描线速度和 bandoffsets 使我感到困惑。特别是以下细节使我感到困惑:
像素步幅是两个样本之间的数据阵列元素的数量 对于同一扫描线上的同一带。扫描线大步是数字 给定样本和相应样本之间的数据阵列元素 在下一个扫描线的同一列中采样。乐队偏移表示 来自第一个数据阵列元素的数据数组元素的数量 数据库的库将每个乐队持有到第一个样本 乐队。乐队的编号为0到N-1。银行指数表示 数据缓冲区库和一个频段之间的对应关系 图像数据。
谁能用示例数据给我一个简单的解释,以便我可以看到如何可视化ARGB数据?另外,请使用示例数据来解释术语像素步骤和 scanline stride 和 bandoffsets 。
While trying to read about pixel data, I came across PixelInterleavedSampleModel
and used this link to get more information. However the terms Pixel Stride, Scanline Stride and bandoffsets in the documentation has confused me. Especially the below details are confusing me :
Pixel stride is the number of data array elements between two samples
for the same band on the same scanline. Scanline stride is the number
of data array elements between a given sample and the corresponding
sample in the same column of the next scanline. Band offsets denote
the number of data array elements from the first data array element of
the bank of the DataBuffer holding each band to the first sample of
the band. The bands are numbered from 0 to N-1. Bank indices denote
the correspondence between a bank of the data buffer and a band of
image data.
Can anyone please give me an easy explanation with a sample data so that I could see how we can visualize a ARGB data? Also please explain the terms pixel stride and scanline stride and bandoffsets using the sample data.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会尝试一下...但是首先,一些有用的“定义”:
r0 g0 b0 R1 G1 B1 ... RN GN BN
这个答案仅与交错有关案例和
pixelinterleavedsamplemodel
。给定扫描线(像素阵列)由RGB三重态组成:
...像素步长或“两个样本之间的数据阵列元素数量的同一频段”(在图中,R1到R2的元素数量)为只需
3
。同样,对于单带灰色样品,像素步幅为1,对于交织的rgba,将为4。同样,给定一个由320个RGB三重态组成的扫描线:
...扫描线步长将只是
960
,或3(像素步长)320次(行中的像素数)。有时,数据阵列在每行末尾包含填充。这是一个示例,扫描线由320个RGB三重态组成,但是数据阵列中的每一行都填充到100个倍数,即40个填充样本:
...扫描线步行现在是
1000 。
给定相同的扫描线,由RGB三胞胎组成:
...对于R,G和B,频段偏移分别为
0、1、2
。另一种可能性是由ArgB四核算的扫描线,按顺序排列:
...分别为R,G,B和A分别为
3、2、2、1、0
(Band Order)在“偏移”阵列中,遵循颜色模型的顺序,最后任何Alpha样本)。通常这很简单。
如果您想创建一个由唯一的绿色样本或数组的子区域组成的图像,那就是这些值变得更有趣(它们将是相同的,因为它们描述了内存中的“物理”数据布局,但是它们是相同的将与栅格/图像的不同。
I'll give it a try... But first some useful "definitions":
R0 G0 B0 R1 G1 B1 ... Rn Gn Bn
R0 R1 ... Rn, G0 G1 ... Gn, B0 B1 ... Bn
This answer is only about the interleaved case and the
PixelInterleavedSampleModel
.Given a scan line (pixel array) consisting of RGB triplets:
...the pixel stride or "the number of data array elements between two samples for the same band" (in the figure, the number of elements from R1 to R2) is simply
3
. Similarly, for single band gray samples the pixel stride would be 1, for interleaved RGBA it would be 4.Again, given a scan line consisting of 320 RGB triplets:
...the scan line stride would simply be
960
, or 3 (the pixel stride) times 320 (the number of pixels in the row).Some times the data array contains padding at the end of each line. Here's an example where the scan line consists of 320 RGB triplets, but each line in the data array is padded to a multiple of 100, that is 40 samples of padding:
...the scan line stride is now
1000
.Given the same scan line consisting of RGB triplets:
...the band offsets would be
0, 1, 2
for R, G and B respectively.Another possibility is a scan line consisting of ARGB quads, in ABGR order:
...the band offsets would be
3, 2, 1, 0
for R, G, B and A respectively (the band order in the offsets array follow the order of the color model, with any alpha sample last).Normally it's that simple.
If you want to create an image consisting of the only green sample, or a sub region of the array, that's when these values become more interesting (they would be the same, as they describe the "physical" data layout in memory, but they would differ from that of the raster/image).