像素插图samplemodel与像素步幅,扫描线路和频带偏移等术语混淆

发布于 2025-02-06 06:34:36 字数 673 浏览 0 评论 0原文

在尝试阅读有关像素数据的过程中,我遇到了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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

同展鸳鸯锦 2025-02-13 06:34:36

我会尝试一下...但是首先,一些有用的“定义”:

  • “交错” 像素意味着每个像素的示例都存储在一个阵列中,例如,r0 g0 b0 R1 G1 B1 ... RN GN BN
  • ...与“平面” 像素相比,g0 g1 ... gn,b0 b1 ... bn
  • a “扫描行” 是图像中的一行或一行像素,

这个答案仅与交错有关案例和pixelinterleavedsamplemodel

像素步骤是同一扫描线上同一频段的两个样品之间的数据阵列元素的数量。

给定扫描线(像素阵列)由RGB三重态组成:

R0 G0 B0 R1 G1 B1 R2 G2 B2 R3 G3 B3 ... Rn Gn Bn
|<-- -->|

...像素步长或“两个样本之间的数据阵列元素数量的同一频段”(在图中,R1到R2的元素数量)为只需3。同样,对于单带灰色样品,像素步幅为1,对于交织的rgba,将为4。

扫描线步幅是给定样品和下一个扫描线同一列中的相应样品之间的数据阵列元素的数量。

同样,给定一个由320个RGB三重态组成的扫描线:

R0 G0 B0 R1 G1 B1 R2 G2 B2 R3 G3 B3 ... R319 G319 B319 R320 B320 G320 ... Rn Gn Bn
|<--               scan line stride               -->|

...扫描线步长将只是960,或3(像素步长)320次(行中的像素数)。

有时,数据阵列在每行末尾包含填充。这是一个示例,扫描线由320个RGB三重态组成,但是数据阵列中的每一行都填充到100个倍数,即40个填充样本:

R0 G0 B0 R1 G1 B1 ... R319 G319 B319 ... x0 ... x39 R320 B320 G320 ... Rn Gn Bn X0 ... X39
|<--                 scan line stride          -->|

...扫描线步行现在是1000 。

频段偏移表示数据阵列元素的数量来自数据库的第一个数据阵列元素,将每个频段存放到频段的第一个示例。乐队的编号为0到N-1。银行索引表示数据缓冲区库和图像数据频段之间的对应关系。

给定相同的扫描线,由RGB三胞胎组成:

R0 G0 B0 R1 G1 B1 R2 G2 B2 R3 G3 B3 ... Rn Gn Bn
0  1  2

...对于R,G和B,频段偏移分别为0、1、2

另一种可能性是由ArgB四核算的扫描线,按顺序排列:

A0 B0 G0 R0 A1 B1 G1 R1 ... An Bn Gn Rn
0  1  2  3

...分别为R,G,B和A分别为3、2、2、1、0(Band Order)在“偏移”阵列中,遵循颜色模型的顺序,最后任何Alpha样本)。

通常这很简单。

如果您想创建一个由唯一的绿色样本或数组的子区域组成的图像,那就是这些值变得更有趣(它们将是相同的,因为它们描述了内存中的“物理”数据布局,但是它们是相同的将与栅格/图像的不同。

I'll give it a try... But first some useful "definitions":

  • "interleaved" pixels means the samples for each pixels are stored together in a single array like, R0 G0 B0 R1 G1 B1 ... Rn Gn Bn
  • ...in contrast to "planar" pixels where all samples for one component is stored together, like R0 R1 ... Rn, G0 G1 ... Gn, B0 B1 ... Bn
  • a "scan line" is one line or row of pixels in an image

This answer is only about the interleaved case and the PixelInterleavedSampleModel.

Pixel stride is the number of data array elements between two samples for the same band on the same scanline.

Given a scan line (pixel array) consisting of RGB triplets:

R0 G0 B0 R1 G1 B1 R2 G2 B2 R3 G3 B3 ... Rn Gn Bn
|<-- -->|

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

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.

Again, given a scan line consisting of 320 RGB triplets:

R0 G0 B0 R1 G1 B1 R2 G2 B2 R3 G3 B3 ... R319 G319 B319 R320 B320 G320 ... Rn Gn Bn
|<--               scan line stride               -->|

...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:

R0 G0 B0 R1 G1 B1 ... R319 G319 B319 ... x0 ... x39 R320 B320 G320 ... Rn Gn Bn X0 ... X39
|<--                 scan line stride          -->|

...the scan line stride is now 1000.

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.

Given the same scan line consisting of RGB triplets:

R0 G0 B0 R1 G1 B1 R2 G2 B2 R3 G3 B3 ... Rn Gn Bn
0  1  2

...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:

A0 B0 G0 R0 A1 B1 G1 R1 ... An Bn Gn Rn
0  1  2  3

...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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文