楼主:
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;
//