Preface
Last time in the article "halcon function file and how the script engine calls external function files Part 1" I talked about how to encapsulate a halcon operator. This next article follows the previous article and tells how C# uses the halcon engine to call its own encapsulated operators.
The benefits of this are obvious:
1 Without modifying the C# code, the algorithm can be changed by updating the script. A translation process is eliminated, and the code is easy to maintain.
2 You can use halcon to encrypt the script.
A disadvantage discovered so far: the memory cannot be actively released. When an operator with a large amount of calculation is called, or the picture is very large, the memory will soar quickly.
Specific use
1 reference dll
First you need to reference the dll:hdevenginedotnet.dll
2 Specify the halcon script path
We need to put our encapsulated operators under a path, and then tell the halcon script engine this directory:
//实例化一个halcon脚本引擎
public HDevEngine hDevEngine = new HDevEngine