机器视觉 import算子

Posted 沧海一笑-dj

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了机器视觉 import算子相关的知识,希望对你有一定的参考价值。

00. 目录

01. 概述

import - 导入一个或多个外部程序。

02. 签名

import( : : ProcedureSource : )

03. 描述

import语句可用于从HDevelop程序中导入其他外部程序。 导入的程序仅适用于包含导入语句的程序,但不作用于其他程序。

import语句可以出现在程序的任何一行中。 导入的程序只能在导入语句下方使用,并可能被后面的(相同名称)导入程序取代。

  proc()
  * unresolved procedure call

  import ./the_one_dir
  proc()
  * resolves to ./the_one_dir/proc.hdvp

  import ./the_other_dir
  proc()
  * resolves to ./the_other_dir/proc.hdvp

参数ProcedureSource指向外部程序的来源。 它可以是包含要使用的程序(和/或)程序库的目录的路径或者程序库的文件名。 在这两种情况下,路径可能是绝对的或相对的。 在后一种情况下,HDevelop把相对路径解析为包含import语句的程序的文件位置。 如果路径包含一个或多个空格,则路径必须用引号括住,否则程序行将变为无效。

与系统相反,用户定义和会话目录HDevelop(ser-defined, and session directories HDevelop)仅在外部程序的import语句指定的目录中查找,但不在其子目录中递归查找。

请注意,import语句永远不会执行,因此必须在该程序加载时已经对ProcedureSource进行了评估。 因此,ProcedureSource必须是一个常量表达式,特别是不能将一个字符串变量传递给ProcedureSource。

但是,ProcedureSource也可能包含环境变量,HDevelop会相应地进行解析。 无论实际使用的平台如何,环境变量都必须以Windows语法表示,即%VARIABLE%。

import既不检验路径ProcedureSource是否存在,也不检验它是否指向程序库或包含程序的目录。 因此,在任何情况下,具有不存在或无意义路径的import语句仍然保持有效的程序行。

导入路径在HDevelop的程序设置中分别列出。 当然,这些路径不能在程序设置中修改或停用。 此外,仅通过import语句提供的程序标有特殊的图标。

在程序清单中,显示的import语句输入必须没有带括号,以强调该行是声明而不是可执行的算子。

原文描述

The import statement can be used to import additional external procedures from within a HDevelop program. The imported procedures become only available for the procedure that contains the import statement but not for other procedures.

import statements may occur in any line of a procedure. The imported procedures become only available below the import statement and may be overruled by later import statements.

  proc()
  * unresolved procedure call

  import ./the_one_dir
  proc()
  * resolves to ./the_one_dir/proc.hdvp

  import ./the_other_dir
  proc()
  * resolves to ./the_other_dir/proc.hdvp

The parameter ProcedureSource points to the source of the external procedures. It can either be the path of a directory that contains the procedures and/or the procedure libraries to be used or directly the file name of a procedure library. In both cases, the path may either be absolute or relative. In the latter case, HDevelop interprets the path as being relative to the file location of the procedure that contains the import statement. The path has to be in quotes if it contains one or more spaces, otherwise the program line will become invalid.

Contrary to system, user-defined, and session directories HDevelop looks only in the directory specified by an import statement for external procedures but not recursively in its subdirectories.

Note, that an import statement is never executed and, therefore, ProcedureSource has to be evaluated already at the procedure’s loading time. Therefore, ProcedureSource has to be a constant expression, and, in particular, it is not possible to pass a string variable to ProcedureSource.

However, ProcedureSource may also contain environment variables, which HDevelop resolves accordingly. Environment variables, regardless of the platform actually used, must always be denoted in Windows syntax, i.e., %VARIABLE%.

import neither tests whether the path ProcedureSource exists nor whether it points to a procedure library or a directory that contains procedures at all. Therefore, import statements with nonexistent or pointless paths nonetheless stay valid program lines, in any case.

Import paths are listed separately in HDevelop’s procedure settings. Of course, these paths can’t be modified or deactivated from within the procedure settings. Furthermore, procedures that are available only via an import statement are marked with a special icon.

In the program listing, import statements are displayed and must be entered without parenthesis in order to emphasize that the line is a declaration and not an executable operator.

04. 注意

05. 参数

ProcedureSource (input_control)   string → (string)
File location of the external procedures to be loaded: either a directory or a procedure library

要加载的外部程序的文件位置:目录或程序库

06. 结果

import从不执行。

HDevelop例程
variable_types.hdev Define variable types in HDevelop

07. 附录

7.1 机器视觉博客汇总
网址:https://dengjin.blog.csdn.net/article/details/116837497

以上是关于机器视觉 import算子的主要内容,如果未能解决你的问题,请参考以下文章

机器视觉 exit算子

机器视觉 switch算子

机器视觉 export_def算子

机器视觉 insert算子(已废弃)

机器视觉 stop算子

机器视觉 endwhile算子