Halcon读取图像--单张读取、有序批量读取、无序批量读取

(1) 读取单张图片

* (1)-Halcon读取图像--读取单张图片
read_image(Image, ‘./imgs/1.bmp‘)

助手读取--》选择文件--》插入代码:?

Halcon读取图像--单张读取、有序批量读取、无序批量读取

* Image Acquisition 01: Code generated by Image Acquisition 01
read_image (Image, ‘E:/Practice/Halcon/Halcon_Study/Function_Study/imgs/1.bmp‘)

?(2) 批量读取图片--有序

* (2)-Halcon读取图像--批量读取(命名有序图片)
* i取值为1,2,3,图片路径为‘./imgs/1.bmp‘, ‘./imgs/2.bmp‘, ‘./imgs/3.bmp‘
for i:=1 to 3 by 1
    read_image (Image2, ‘./imgs/‘ + i + ‘.bmp‘)
endfor

??(3) 批量读取图片--无序

* (3)-Halcon读取图像--批量读取(命名无序图片)
* 列出imgs文件夹下所有文件路径
list_files (‘./imgs‘, ‘files‘, ImageFiles)
* 选择符合条件的文件(jpg/png/bmp)
tuple_regexp_select (ImageFiles, ‘.*jpg|png|bmp‘, Selection)
* 循环读取文件夹中的图像
for i:=0 to |Selection| - 1 by 1
    read_image (Image_Test, Selection[i])
endfor

助手读取--》选择路径--》插入代码:??

Halcon读取图像--单张读取、有序批量读取、无序批量读取

* Image Acquisition 01: Code generated by Image Acquisition 01
list_files (‘E:/Practice/Halcon/Halcon_Study/Function_Study/imgs‘, [‘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 something
endfor

?完整代码:

* (1)-Halcon读取图像--读取单张图片
read_image(Image, ‘./imgs/1.bmp‘)
*--------------------------------------------------*

* (2)-Halcon读取图像--批量读取(命名有序图片)
* i取值为1,2,3,图片路径为‘./imgs/1.bmp‘, ‘./imgs/2.bmp‘, ‘./imgs/3.bmp‘
for i:=1 to 3 by 1
    read_image (Image2, ‘./imgs/‘ + i + ‘.bmp‘)
endfor
*--------------------------------------------------*

* (3)-Halcon读取图像--批量读取(命名无序图片)
* 列出imgs文件夹下所有文件路径
list_files (‘./imgs‘, ‘files‘, ImageFiles)
* 选择符合条件的文件(jpg/png/bmp)
tuple_regexp_select (ImageFiles, ‘.*jpg|png|bmp‘, Selection)
* 循环读取文件夹中的图像
for i:=0 to |Selection| - 1 by 1
    read_image (Image_Test, Selection[i])
endfor

?

Halcon读取图像--单张读取、有序批量读取、无序批量读取

Halcon读取图像--单张读取、有序批量读取、无序批量读取

上一篇:配置静态路由


下一篇:使用KubeOperator安装k8s集群后,节点主机yaml文件路径