//pixelvalues存放的1维的R G B 3通道像素值,
//排布顺序为:B G R B G R B G R B G R
double[,] r = new double[with, height];//定义存放单通道的数组
double[,] g = new double[with, height];
double[,] b = new double[with, height];
int ipoint = 0;//索引位,从0开始
//with、 height分别为图像的宽和高
for (int i = 0; i < with; i++)
{
for (int j = 0; j < height; j++)
{
//每执行一行ipoint加1
//例如:执行到第一行:ipoint = 0;执行到第二行:ipoint = 2;执行到第三行:ipoint = 3
//0-b //3-b
//1-g //4-g
//2-r //5-r
b[i, j] = Convert.ToDouble(pixelvalues[ipoint++]);
g[i, j] = Convert.ToDouble(pixelvalues[ipoint++]);
r[i, j] = Convert.ToDouble(pixelvalues[ipoint++]);
}
}
已知获得的RGB像素值为1维数组,将像素分别存入R、G、B 3个通道
最新推荐文章于 2024-08-13 18:54:48 发布