Halcon部分语法【3】

来源:互联网 发布:linux acl chown 区别 编辑:程序博客网 时间:2024/05/11 20:59

四季豆又要学习啦!!!
1、等号 :=
2、不等号 #
3、注释符号 *
4、字符串赋值 str:=’halcon’
5、等于比较符号 if(x=10)
6、与运算 if(A>1 and A<30)
7、或运算 if(A>1 or A<30)
8、求反 if(not(A=10))
9、for循环 for I := 0 to NumBalls - 1 by 1
、、、、、(操作代码)
endfor
这是以for循环批量加载图片的例子(test是存放图片的文件夹)

list_files ('F:/test', ['files','follow_links'], ImageFiles)tuple_regexp_select (ImageFiles, ['\\.(tif|tiff|gif|bmp|jpg|jpeg|jp2|png|pcx|pgm|ppm|pbm|xwd|ima|hobj)$','ignore_case'], ImageFiles)for Index := 0 to |ImageFiles| - 1 by 1    read_image (Image, ImageFiles[Index])    * Image Acquisition 01: Do somethingendfor

10、While 循环
while (x== 1)

       Endwhile

11、异常获取:
Try

       catch (Exception)       Endtry

12、Switch多分支:

switch (Index)case 1:    breakcase 2:    breakcase 3:    breakdefault:    breakendswitch 

暂时没了,放戳怡情这里写图片描述

原创粉丝点击