对不起虚拟问题,但我是新来的,我找不到答案。图像处理(一般)
- 什么是图像跨度?
- 我从Bitframe创建一个缓冲区字节[](没有问题)。位帧宽度是1200,位帧高度是900.所以(正如我怀疑的)缓冲区必须是1200 * 900 = 108,0000。 但是缓冲区大小是stride * height = 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;
};
而且也有像素处理功能像素processPixel(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)
}
}
我刚刚搜索了一下“image stride”,第一次打击看起来相当不错,有没有什么具体的你找不到? –
谢谢。我刚刚发现这个问题的第二部分呢? – curiousity