作者doladolphin2 (\(^.^)/做自己~好自在)
看板C_Sharp
标题[问题] 也是影像处理
时间Wed May 12 17:57:15 2010
请问各位
要怎麽将读入的图片存到矩阵
存到矩阵要怎麽做其他运算@@ 我这边卡好久咧
目前 只简单做了灰阶 反转 如下
private void button2_Click(object sender, EventArgs e)
{
Bitmap bm1 = (Bitmap)pictureBox1.Image;
//宣告宽高变数
int w1 = pictureBox1.Image.Width;
int h1 = pictureBox1.Image.Width;
int x,y;
//扫影像每一个pixel并做处理
for (y = 0; y<=h1 - 1; y++)
{
for (x = 0; x<=w1 - 1; x++)
{
Color c1 = bm1.GetPixel(x, y);
int r1 = c1.R;
int g1 = c1.G;
int b1 = c1.B;
int avg1 = (r1 + g1 + b1) / 3;
bm1.SetPixel(x, y, Color.FromArgb(avg1, avg1,avg1));
}
}
pictureBox2.Image = bm1;
}
之後要做直方图均衡 还有滤波等等 梯度计算 以及
听说要转成矩阵 才能作
而我不想用指标
所以就想来请问@@ 我有先假设如下
Bitmap bm1 = (Bitmap)pictureBox1.Image;
int[,] r = new int[bm1.Height, bm1.Width];
int[,] g = new int[bm1.Height, bm1.Width];
int[,] b = new int[bm1.Height, bm1.Width];
那接下来要怎麽读出每个pixel值 好让我做後续动作??
希望大家能指点一下Q_Q
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 203.64.128.53