Halcon编程语法.pdf

上传人:索**** 文档编号:76254758 上传时间:2023-03-08 格式:PDF 页数:4 大小:15.68KB
返回 下载 相关 举报
Halcon编程语法.pdf_第1页
第1页 / 共4页
Halcon编程语法.pdf_第2页
第2页 / 共4页
点击查看更多>>
资源描述

《Halcon编程语法.pdf》由会员分享,可在线阅读,更多相关《Halcon编程语法.pdf(4页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、输入控制参数可以是表达式,但图形参数、输出参数均应为变量;String 类型变量由单引号 括起来;此外还有一些特殊字符;Boolean 型变量包括true(=1)、false(=0);不为零的整数将被认为true;但绝大多数的 Halcon 函数接受字符串型的表达:true false,而非逻辑型表达;函数返回常量用于标识错误:?H_MSG_TRUE no error 2?H_MSG_FALSE logical false 3?H_MSG_FAIL operator did not succeed 5 可以放在try catch endtry块中,也可以用dev_error_var()与 de

2、v_set_check()来捕获;控制语句结构:(与一般语言略有不同,它们也有输入输出变量)?if .endif/if.else .endif/if.elseif.else.endif?for .endfor?while .endwhile?repeat.until 此外,也有关键字break、continue、return、exit、stop 用来控制语句的执行;赋值语句在Halcon 中也被当作函数来使用:标准赋值?assign(Expression,ResultVariable)/编辑形式,永远都是输入在前,输出在后?ResultVariable:=Expression/代码形式元组插入

3、赋值?insert(Tuple,NewValue,Index,Tuple)/编辑形式?TupleIndex:=NewValue/代码形式控制变量元组操作?t,t concatenation of tuples?|t|number of elements?t selection of an element?ti:j selection of a part of a tuple?subset(t1,t2)selection from t1 by indices in t2 图形元组操作对应函数?gen_empty_obj()?|t|count_obj(p,num)?t1,t2 concat_obj

4、(p1,p2,q)?t select_obj(p,q,i+1)?ti:j copy_obj(p,q,i+1,j-i+1)?subset(t1,t2)select_obj(p,q,t2+1)元组的数学运算,如:A*B,令 m=|A|,n=|B|;若 m、n 不相等,且都大于 1,则错误;否则返回三种情况:?m=n=1,返回一个值;?m=n1,返回一个包含 m 个数的元组,值为两元组各对于值的操作结果;?m1,n=1,返回一个包含 m 个数的元组,值为第二个数与第一元组各值的操作结果;Halcon 的数学运算算术运算?a/a division?a%a rest of the integer div

5、ision?a*a multiplication?v+v addition and concatenation of strings?a-a subtraction?-a negation 位运算?lsh(i,i)left shift?rsh(i,i)right shift?i band i bit-wise and?i bor i bit-wise or?i bxor i bit-wise xor?bnot i bit-wise complement 字符串操作?v$s conversion to string/字符串的格式化,有很丰富的参数?v+v concatenation of str

6、ings and addition?strchr(s,s)search character in string?strstr(s,s)search substring?strrchr(s,s)search character in string(reverse)?strrstr(s,s)search substring(reverse)?strlen(s)length of string?si selection of one character?si:i selection of substring?split(s,s)splitting to substrings 比较操作符?t t gr

7、eater than?t=t greater or equal?t=t equal?t#t not equal 逻辑操作符?not l negation?l and l logical and?l or l logical or?l xor l logical xor 数学函数?sin(a)sine of a?cos(a)cosine of a?tan(a)tangent of a?asin(a)arc sine of a in the interval-p/2,p/2,a?-1,1?acos(a)arc cosine a in the interval-p/2,p/2,a?-1,1?atan

8、(a)arc tangent a in the interval-p/2,p/2,a?-1,1?atan2(a,b)arc tangent a/b in the interval-p,p?sinh(a)hyperbolic sine of a?cosh(a)hyperbolic cosine of a?tanh(a)hyperbolic tangent of a?exp(a)exponential function?log(a)natural logarithm,a 0?log10(a)decade logarithm,a 0?pow(a1,a2)power?ldexp(a1,a2)a1 po

9、w(2,a2)其他操作(统计、随机数、符号函数等)?min(t)minimum value of the tuple?max(t)maximum value of the tuple?min2(t1,t2)element-wise minimum of two tuples?max2(t1,t2)element-wise maximum of two tuples?find(t1,t2)indices of all occurrences of t1 within t2?rand(i)create random values from 0.1(number specified by i)?sg

10、n(a)element-wise sign of a tuple?sum(t)sum of all elements or string concatenation?cumul(t)cumulative histogram of a tuple?mean(a)mean value?deviation(a)standard deviation?sqrt(a)square root of a?deg(a)convert radians to degrees?rad(a)convert degrees to radians?real(a)convert integer to real?int(a)c

11、onvert a real to integer?round(a)convert real to integer 四舍五入?number(v)convert string to a number?is_number(v)test if value is a number?abs(a)absolute value of a(integer or real)?fabs(a)absolute value of a(always real)?ceil(a)smallest integer value not smaller than a?floor(a)largest integer value no

12、t greater than a?fmod(a1,a2)fractional part of a1/a2,with the same sign as a1?sort(t)sorting in increasing order?uniq(t)eliminate duplicates of neighboring values(typically used in combination with sort)?sort_index(t)return index instead of values?median(t)Median value of a tuple(numbers)?select_ran

13、k(t,v)Select the element(number)with the given rank?inverse(t)reverse the order of the values?subset(t1,t2)selection from t1 by indices in t2?remove(t1,t2)Remove of values with the given indices?environment(s)value of an environment variable?ord(a)ASCII number of a character?chr(a)convert an ASCII number to a character?ords(s)ASCII number of a tuple of strings?chrt(i)convert a tuple of integers into a string

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 技术资料 > 实施方案

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁