*这个项目展示了如何去处理错误的解码
- This program demonstrates how to handle false bar code
- decoding.
*以下两个参数可以解决这个问题 - For this, the following two parameters can be used:
-
- min_identical_scanlines
-
- start_stop_tolerance
*在这个特殊的例子中,这个参数用来抑制Code 128的错误检测
- start_stop_tolerance
- In this particular example these parameters are used to
- suppress the false detection of a Code 128 in a Code 39
- symbol.
- 关闭更新
dev_update_off ()
*设置填充方式
dev_set_draw (‘margin’) - 创建一个一维码读取器
create_bar_code_model ([], [], BarCodeHandle)
*设置扫描行数
set_bar_code_param (BarCodeHandle, ‘num_scanlines’, 10)
*用来识别条码边沿,一般取值[0.05,0.2]
set_bar_code_param (BarCodeHandle, ‘meas_thresh’, 0.1)
*保存解码的中间结果
set_bar_code_param (BarCodeHandle, ‘persistence’, 1)
*读取图像
read_image (Image, ‘barcode/code39/code3905’)
*获取图像尺寸
get_image_size (Image, Width, Height)
StatusHeight := 200
*关闭窗体
dev_close_window ()
*打开窗体
dev_open_window (0, 0, Width, Height + StatusHeight, ‘white’, WindowHandle)
*图像铺满窗口
dev_set_part (0, 0, Height + StatusHeight - 1, Width - 1)
*设置显示字体
set_display_font (WindowHandle, 16, ‘mono’, ‘true’, ‘false’) - 图像中一维码类别是Code 39
- The code in the image is a Code 39 symbol.
*读取条码
find_bar_code (Image, SymbolRegions, BarCodeHandle, ‘Code 39’, Data)
*显示图像
dev_display (Image)
*设置显示颜色
dev_set_color (‘green’)
*设置线宽
dev_set_line_width (3)
*显示条码区域
dev_display (Sy