基于Halcon学习的一维码识别【十八】gs1databar_composite.hdev
作者:互联网
GS1扩展条形码符号
总代码:
*创建条形码阅读器
create_bar_code_model ('element_size_min', 1.5, BarCodeHandle)
*
* Initialization
*初始化
NumImages := 2
dev_close_window ()
*读取图片
read_image (Image, 'barcode/gs1databar_expanded/gs1databar_expanded_01')
*打开自适应图片的窗口
dev_open_window_fit_image (Image, 0, 0, -1, -1, WindowHandle)
dev_set_draw ('margin')
dev_set_color ('green')
dev_set_line_width (3)
set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
*
* Read bar codes
*读条形码
for I := 1 to NumImages by 1
*读取图片
read_image (Image, 'barcode/gs1databar_expanded/gs1databar_expanded_' + I$'.2d')
dev_display (Image)
*寻找条形码
find_bar_code (Image, SymbolRegions, BarCodeHandle, 'GS1 DataBar Expanded', DecodedDataStrings)
dev_display (SymbolRegions)
*显示信息
disp_message (WindowHandle, DecodedDataStrings, 'window', 12, 12, 'black', 'true')
if (I < NumImages)
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
endif
endfor
*
* Release memory allocated by the bar code reader
*释放条形码阅读器分配的内存
clear_bar_code_model (BarCodeHandle)
逐段分析:
*创建条形码阅读器
create_bar_code_model ('element_size_min', 1.5, BarCodeHandle)
*初始化
NumImages := 2
dev_close_window ()
*读取图片
read_image (Image, 'barcode/gs1databar_expanded/gs1databar_expanded_01')
*打开自适应图片的窗口
dev_open_window_fit_image (Image, 0, 0, -1, -1, WindowHandle)
dev_set_draw ('margin')
dev_set_color ('green')
dev_set_line_width (3)
set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
*读条形码
for I := 1 to NumImages by 1
*读取图片
read_image (Image, 'barcode/gs1databar_expanded/gs1databar_expanded_' + I$'.2d')
dev_display (Image)
*寻找条形码
find_bar_code (Image, SymbolRegions, BarCodeHandle, 'GS1 DataBar Expanded', DecodedDataStrings)
dev_display (SymbolRegions)
*显示信息
disp_message (WindowHandle, DecodedDataStrings, 'window', 12, 12, 'black', 'true')
if (I < NumImages)
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
endif
endfor
*释放条形码阅读器分配的内存
clear_bar_code_model (BarCodeHandle)
标签:hdev,set,bar,条形码,gs1databar,Image,dev,Halcon 来源: https://blog.csdn.net/BoomBiuBiu/article/details/123102062