【发布时间】:2011-11-28 09:35:45
【问题描述】:
抱歉,我提出了一个愚蠢的问题,但我是这方面的新手,我找不到答案。
- 什么是图像步幅?
- 我正在从位帧创建一个缓冲区字节[](没有问题。)位帧宽度为 1200,位帧高度为 900。所以(我怀疑)缓冲区必须为 1200*900 = 108,0000。 但是缓冲区大小是步幅 * 高度 = 432,0000 (4 * 108,0000)。
步幅计算为bitFrame.PixelWidth * ((bitFrame.Format.BitsPerPixel + 7) / 8);
然后我使用bitFrame.CopyPixels(pixels, stride, 0); //(byte[] pixels) 并且我有处理当前像素的功能(也就是一个结构体)
struct pixel {
float r;
float g;
float b;
};
还有像素处理函数pixelprocessPixel(int x, int y)。我如何在缓冲区中使用此功能?我认为它必须以某种方式这样称呼:
for(int i = 0; i < height; i++) {
for(int j = 0; j < height; j++) {
processPixel(i, j);
// But how could I use this function with my byte[] buffer?
// And what exactly in this buffer?
// (why stride*height = 4*width*height? cause there are 3 values for pixel RGB)
}
}
【问题讨论】:
-
我刚刚用谷歌搜索了“图像步幅”,第一次点击看起来不错,有什么具体的内容你找不到吗?
-
谢谢。我刚找到这个/问题的第二部分呢?
标签: c# image-processing stride