本帖最后由 绝地武士 于 2018-8-30 23:22 编辑
- AreaArray:=[]
- list_files ('D:/HalconCase/ExerciseImage', ['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])
- threshold (Image, Regions, 17, 116)
- connection (Regions, Connection)
- area_center(Connection, Area, Row, Column)
- AreaArray:=[AreaArray,Area]
- endfor
复制代码 声明一个新的数组,每次得到面积后附加给数组,让数组存下来就可以了!
|