對不起虛擬問題,但我是新來的,我找不到答案。圖像處理(一般)
- 什麼是圖像跨度?
- 我從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