本文主要是介绍基于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)
这篇关于基于Halcon学习的一维码识别【十八】gs1databar_composite.hdev的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!