作者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