C#存图片
一个WinForm,有一个按钮,点击下,弹出一个文件对话框和另一个Winform,
private void Col_Click(object sender, EventArgs e)//添加模板按钮
{
string str = InputBox.ShowInputBox("输入模板名", string.Empty);//
if (str.Trim() != string.Empty)
{
int i = 0;
persondata.Add(new person(str));
int j = persondata.Count - 1;
Form2 frm = new Form2();
frm.Show();
frm.Text = str;
OpenFileDialog ofd = new OpenFileDialog();
//ofd.Multiselect = true;
if (ofd.ShowDialog() == DialogResult.OK)
{
bmp = (Bitmap)Image.FromStream(GetImgStream(ofd.FileName));
image = new Emgu.CV.Image<Bgr, Byte>(bmp);
sbmp = new Bitmap(128, 128, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
norm = new Emgu.CV.Image<Gray, Byte>(sbmp);
int x = HJFace.FaceLocated(image.Ptr, norm.Ptr, persondata[j].Pfeature[0], 0);
isface.Text = x.ToString();
if (x == 0)
{
sbmp = IplImagePointerToBitmap(norm.Ptr);
}
else
{
pictureBox1.Image = null;
}
}
}
}
如何把图片存到Form2中,有好想法的请提供,高手赐教
------解决方案--------------------有时候,别把问题想的太复杂。
------解决方案--------------------http://www.baidu.com/link?url=a5d39c03e40815194863bb3ced97b09dc7f0c691352db4f112c983c0f48149311549ebb077d4badc31b744cf36e4db167ca74115f36c95bba34fbaf51b01564394726ec1dbb2a48abd326ce2dbe7da193f564c4626868531a7641606b9e3ca6dd85d5d2f0e45c6dbec00f8e7dd4b40c7
------解决方案--------------------
1、把bitmap传过去。
2、转成MemoryStream传过去。