|
机器学习算法应用时,图像序号名称的提取很关键,因为halcon的图像读取不是严格按照1-100排列的,而是1,10,11,……2,20,21,……等等
- path:='.//图库'
- list_image_files(path, 'default', [], ImageFiles)
- FileName:='ysw.csv'
- file_exists(FileName,FileExists)
- if(FileExists)
- open_file(FileName,'append',FileHandle)
- else
- open_file(FileName,'output',FileHandle)
- endif
- for i:= 0 to |ImageFiles|-1 by 1
- read_image(Image, ImageFiles[i])
- tuple_split(ImageFiles[i],'/',Substrings)
- tuple_split(Substrings,'.',Substrings1)
- tuple_select(Substrings1,1,Selected)
- fwrite_string(FileHandle,'number='+','+Selected+'\n')
- * stop()
- endfor
- close_file(FileHandle)
复制代码 |
|