HDevelop Guide

read_image()读取图片时,从当前目录以及HALCON的image目录(通过环境变量指定)下查找。

程序窗口双击某个算子--》建议菜单--》后继函数,同时状态栏显示光标指向的算子的功能描述。

变量窗口--》选择控制变量(可按Ctrl多选)--》监视

 HDevelop Procedures

Procedures are meant to increase the readability and modularity of HDevelop programs by encapsulating functionality of multiple operator calls in one
or more procedure calls. It also makes it easier to reuse program code in other HDevelop programs by storing repeatedly used functionality in external procedures. Main procedure is always the top-most procedure in the calling hierarchy and cannot be deleted from the system.

文件格式

.hdev  HDevelop程序,例如主程序、局部程序

.hdvp  外部程序

.hdpl  程序库

Procedure Locations

  • Import Location in the program code

import C:/Users/Public/procedures/common

  • Static user-defined locations

  • 标准库路径

标准库路径为 %HALCONROOT%procedures

程序窗口注释:单行注释使用*,代码行后跟注释使用//

续行符

 Variable Scope

HDevelop supports local and global variable,all variables are local by default,they exist only within their procedure.Global variable can be accessed in the entire program,and must declared explicitly using the operator global.

global tuple File //声明一个名为File的全局控制变量

global object Image //声明一个名为Image的全局图像变量

If you want to access a global variable in a different procedure,you have to announce this by using the same call (global object Image ).

 

 vector

A vector is  a container thant can hold an arbitrary number of elements,all of which must have the same variable type(i.e. tuple,iconic object,or vector).

a:={[1],[2],[3]}

for i:=1 to 5 by 1
    vec.at(i):=gen_tuple_const(i,5)
endfor

convert_vector_to_tuple()  vector转换为tuple

convert_tuple_to_vector_1d()  tuple转换为vector

Error handing

There are two approaches to error handing in HDevelop:

1.track the return value(error code) of operator calls

dev_set_check() 指定程序出错时是否弹出错误对话框,dev_error_var()获取最近一次算子调用返回的错误码。get_error_text()获取错误码对应的错误描述。

2.using exception handing

Parallel Execution

Using the operator par_join() to wait for the completion of a single thread or a group of threads.

Image Acquisition

open_framegrabber()  //connect image acquisition devices

set_framegrabber_param()  //set special parameters

get_framegrabber_param()  //query current values of the common and special parameters

grab_image()  //request the acquisition of a new image and then block the program until the acquisition has finished.

grab_image_async()  //images are acquired and processed in paralled,leads to a significant speedup of the applications.

close_framegrabber()  //close image acquisition devices and release resources.

 

原文地址:https://www.cnblogs.com/larry-xia/p/10087883.html