* Read bar codes of type Codabar
*
create_bar_code_model ([], [], BarCodeHandle)
dev_close_window ()
dev_open_window (0, 0, 120, 300, 'black', WindowHandle)
dev_set_color ('green')
dev_set_draw ('margin')
dev_set_line_width (3)
set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
for I := 1 to 6 by 1
read_image (Image, 'barcode/codabar/codabar'+(I$'.2'))
get_image_size (Image, Width, Height)
dev_set_window_extents (0, 0, Width-1, Height-1)
dev_display (Image)
set_bar_code_param (BarCodeHandle, 'check_char', 'present')
find_bar_code (Image, SymbolRegions, BarCodeHandle, 'Codabar', DecodedDataStrings)
disp_message (WindowHandle, DecodedDataStrings, 'window', 12, 12, 'black', 'false')
LastChar := strlen(DecodedDataStrings)-1
disp_message (WindowHandle, DecodedDataStrings{0}+sum(gen_tuple_const(LastChar-1,' '))+DecodedDataStrings{LastChar}, 'window', 12, 12, 'forest green', 'false')
if (I < 6)
stop ()
endif
endfor
clear_bar_code_model (BarCodeHandle)
阅读程序
1、2 *号用来注释语句
3、create_bar_code_model ([], [], BarCodeHandle)
原型
create_bar_code_model
( : :
GenParamNames
,
GenParamValues
:
BarCodeHandle
)
这个算子是为了读取所有支持的条形码而创建一个通用的模型,它的运行结果就是获取条形码模型的句柄
(
BarCodeHandle
),这个句柄的获取是为了用来对此条形码进一步操作的。
通常,条形码不需要其它任何额外的参数进行调整就可以被解码读出,因此,
GenParamNames
和
GenParamValues
默认情况下是为default值,在条形码图像质量很差或者是异常几何特征的情况下,就需要特殊的参数设置来解码并读出值,这些参数可以在创建条形码模型时进行调整,不这样的话,也可以用
set_bar_code_param
或者
set_bar_code_param_specific
进行调整。
4.dev_close_window()
原型
dev_close_window
( : : : )
这个算子就是关闭所有由
dev_open_window
打开的图形窗口,
5、dev_open_window (0, 0, 120, 300, 'black', WindowHandle)
原型
dev_open_window
( : :
Row
,
Column
,
Width
,
Height
,
Background
:
WindowHandle
)
打开一个新的图新显示窗口,
Row
,
Column
, 这两个参数为窗口的坐标
Width
,
Height
, 这两个为窗口的大小