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