halcon联合C# 保存图像
private void btn_saveimage_Click(object sender, EventArgs e)//保存图片
{
string _str = "";
try
{
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
string path = saveFileDialog1.FileName;
if (!path.Equals(""))
{
HOperatorSet.WriteImage(ho_Image, "bmp", 0, path + ".bmp");
_str = "图片保存完成";
MessageBox.Show(_str);
}
}
}
catch (System.Exception ex)
{
_str = "图片保存失败:" + ex.Message.ToString();
MessageBox.Show(_str);
}
}