1.halcon导出C#文件,在C#里面调用
2.在C#里面使用Halcon引擎调用Halcon程序,直接运行主程序
3.在C#里面使用Halcon引擎调用.hdev下本地函数或者.hdvp外部函数
Halcon引擎手册:C:/Program Files/MVTec/HALCON-21.11-Progress/doc_en_US/html/manuals/programmers_guide/programmers_guide_0120.html

1.导出C#(代码我只给出类,需要调用)
using VIA.ImageProcessing;
using HalconDotNet;
using System.Runtime.InteropServices;
using Halcon_接口;
class Test
{
/// <summary>
/// C#调用接口
/// </summary>
/// <returns></returns>
public bool Measure(Imagecustom Image_Light, Imagecustom Image_Gray, string LeftOrRight,out double[] Result_Distance,out double[] Result_Height,out HTuple Display_Handle)
{
HObject Display = new HObject();
HTuple result_Distance=new HTuple();
HTuple result_Height=new HTuple();
try
{
int Len = Image_Light.Length;
int Width = Image_Light.Width;
ToHobject3D(Image_Gray.Data, Width, Len, out HObject Image_Gray_A);
ToHobject3D(Image_Light.Data, Width, Len, out HOb

这篇博客详细介绍了如何在C#环境中使用Halcon引擎进行图像处理。首先展示了如何导出C#代码并调用Halcon算法,接着演示了直接运行Halcon主程序的方法。此外,还解释了如何在不运行主程序的情况下调用.hdev中的本地函数或.hdvp外部函数,同时提供了参数设置和结果获取的步骤。
1万+

被折叠的 条评论
为什么被折叠?



