Fw: [問題] C# 存picture box問題(已解決)

作者: sky391 (sky)   2015-03-26 17:59:29
※ [本文轉錄自 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;
//
作者: james732 (好人超)   2014-03-26 16:42:00
問錯板了,請洽 C_Sharp
作者: Killercat (殺人貓™)   2014-03-26 16:44:00
左轉樓下C_Sharp
作者: GoalBased (Artificail Intelligence)   2015-03-26 18:38:00
整片code也不整理就貼上來..
作者: feeya (24 August 升格為鄉民)   2015-03-26 21:55:00
pictureBox.image = (Bitmap) bmp; // 用法是這樣
作者: sky391 (sky)   2015-03-27 01:11:00
謝謝各位 已解決

Links booklink

Contact Us: admin [ a t ] ucptt.com