※ [本文轉錄自 C_and_CPP 看板 #1L4wqcPN ]
作者: sky391 (sky) 看板: C_and_CPP
標題: [問題] C# 存picture box問題
時間: Thu Mar 26 14:54:28 2015
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) VC++
問題:
目前讀圖進來然後做了影像處理顯示在picture box 然後把picture box儲存
結果存的圖還是原本讀圖的那張,第一次使用C# 不知道是否存錯?
Code 貼上影像處理到存圖部分
private void button2_Click_1(object sender, EventArgs e)
{
Bitmap b = pictureBox1.Image as Bitmap;
if (b == null)
{
MessageBox.Show("請載入圖片", "error"); //
if user don't load file will return
return;
}
int width = b.Width;
int height = b.Height;
BitmapData bd = b.LockBits(new Rectangle(0, 0, width, height),
ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
IntPtr imgPtr = bd.Scan0;
int stride = bd.Stride;
int widthByte = width * 3;
int skipByte = stride - widthByte;
int[, ,] rgbData = new int[width, height, 3];
double[] Blend_value = new double[50] { 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
double s, sum = 1;
double s_state = 1;
int blend_width = 50;
s = (double)1 / blend_width;
//