C#调用Halcon程序三种方法

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

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
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值