C#配置halcon,C# HALCON联合编程实例
private void hWindowControl1_HMouseMove(object sender, HalconDotNet.HMouseEventArgs e)
{
}
public partial class HDevelopExport
{
public HTuple hv_ExpDefaultWinHandle;
// Main procedure
private void action()
{
HObject ho_Image;
HTuple hv_Width = null, hv_Height = null;
// Initialize local and output iconic variables
HOperatorSet.GenEmptyObj(out ho_Image);
//dev_close_window(...);
ho_Image.Dispose();
HOperatorSet.ReadImage(out ho_Image, "D:/3-2.bmp");
HOperatorSet.GetImageSize(ho_Image, out hv_Width, out hv_Height);
//dev_open_window(...);
HOperatorSet.DispObj(ho_Image, hv_ExpDefaultWinHandle);
ho_Image.Dispose();
}
public void InitHalcon()
{
// Default settings used in HDevelop
HOperatorSet.SetSystem("width", 512);
HOperatorSet.SetSystem("height", 512);
}
public void RunHalcon(HTuple Window)
{
hv_ExpDefaultWinHandle = Window;
action();
}
}
private void button1_Click(object sender, EventArgs e)
{
HDevelopExport HD = new HDevelopExport();
HD.RunHalcon(hWindowControl1.HalconWindow);
}
}
评论