基于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)

基于Halcon学习的一维码识别【十八】gs1databar_composite.hdev

    *寻找条形码
    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

基于Halcon学习的一维码识别【十八】gs1databar_composite.hdev

上一篇:Docker基础内容之资源限制


下一篇:Matlab中属性访问方法