*这个项目展示了’‘majority_voting’'对一维码读取的影响

  • This example program shows the effect of the bar code
  • parameter ‘majority_voting’.
  • 一维码读取器分析并且解码多个扫描行。默认的,当一找到一行可以成功解码的扫描行时,就停止解码。
    *在有些场合,由于打印质量原因,这一行代码有可能会是错的
  • The bar code reader analyses multiple scanlines and tries
  • to decode them. By default, this process is terminated as soon
  • as one scanline can be decoded successfully. In some cases,
  • the result derived from this scanline may be wrong due to
  • local printing errors.
  • 如果这个参数设定为’True’,不管正确与否,所有的扫描都会被分析与解码。最终结果由扫描到的最多数决定
  • If the parameter ‘majority_voting’ is set to ‘true’, all
  • scanlines are analysed. The final reading result is then
  • determined by a majority voting of all successful decoding
  • results.
  • 准备可视化设置和对象
  • Prepare visualization settings and objects
    *关闭窗体更新
    dev_update_off ()
    *关闭窗体先
    dev_close_window ()
    *读取图像
    read_image (Image, ‘barcode/ean13/ean13_label’)
    *获取图像尺寸
    get_image_size (Image, WidthI, HeightI)
    *打开适合图像尺寸的窗体
    dev_open_window_fit_image (Image, 0, 0, 600, 500, WindowHandle)
    *显示图像
    dev_display (Image)
    *设置填充方式
    dev_set_draw (‘margin’)
    *设置显示字体
    set_display_font (WindowHandle, 14, ‘mono’, ‘true’, ‘false’)
    *限制窗体尺寸
    get_window_extents (WindowHandle, Row, Column, Width, Height)
    *定义窗体放大因子
    WindowZoomFactor := real(WidthI) / Width
    *打开窗体
    dev_open_window (0, Width + 5, 400, 300, ‘white’, WindowHandleText)
    **设置显示字体
    set_display_font (WindowHandleText, 14, ‘mono’, ‘true’, ‘false’)
  • 创建一维码读取器
  • Create bar code reader model
    create_bar_code_model ([], [], BarCodeHandle)
  • 第一部分:设置参数majority voting为FALSE
  • PART I, read bar code without majority voting
    MajorityVotingSetting := ‘false’
    *设置majority voting参数
    set_bar_code_param (BarCodeHandle, ‘majority_voting’, MajorityVotingSetting)
    *设置是否保留一些必要的参数,以作后期处理和评估
    set_bar_code_param (BarCodeHandle, ‘persistence’, 1)
    *定义与之变化差值?
    set_bar_code_param (BarCodeHandle, ‘meas_thresh’, 0.1)
    *定义与之变化差值绝对值??
    set_bar_code_param (BarCodeHandle, ‘meas_thresh_abs’, 30)
  • 解码和准备结果
  • Perform decoding and prepare results
    *聚焦这个窗体
    dev_set_window (WindowHandle)
    *解码区域内的信息
    decode_bar_code_rectangle2 (Image, BarCodeHandle, ‘EAN-13’, 280, 223, 3.14125 / 2.0, 200, 50, DecodedDataStrings)
    *获取解码结果之条码区域
    get_bar_code_object (SymbolRegion, BarCodeHandle, ‘all’, ‘symbol_regions’)
    *获取解码结果之条码类型
    get_bar_code_result (BarCodeHandle, ‘all’, ‘decoded_types’, DecodedTypes)
    *获取解码结果之条码内容
    get_bar_code_result (BarCodeHandle, ‘all’, ‘decoded_strings’, DecodedData)
    *获取解码结果之条码有效扫描行
    get_bar_code_object (ValidScanlines, BarCodeHandle, ‘all’, ‘scanlines_valid’)
    *本地函数,获取有效行数
    get_majority_voting_example_symbols (SymbolRegion, ValidScanlines, DecodedData, BarCodeHandle, DecodedTypes, DecodedData)
    *选择有效行数
    select_obj (ValidScanlines, FirstScanline, 5)
  • 显示结果和条码
  • Display results and labels
    *显示信息
    disp_message (WindowHandle, [‘Looking for bar codes’,’‘majority_voting’ = ‘’ + MajorityVotingSetting + ‘’’], ‘window’, 12, 12, ‘black’, ‘true’)
    ColorsText := [‘forest green’,‘red’]
    *设置线宽
    dev_set_line_width (2)
    *生成条码区域
    smallest_rectangle1 (SymbolRegion, Row1, Column1, Row2, Column2)
    *设置显示颜色
    dev_set_color (‘red’)
    *显示条码区域
    dev_display (SymbolRegion)
    *显示第一个有效扫描行
    dev_display (FirstScanline)
  • 显示结果
    Message := ['Codetype: ','Data: '] + [DecodedTypes,DecodedData]
    disp_message (WindowHandle, Message, ‘image’, Row1 - 40 * WindowZoomFactor, Column2 - 100, ColorsText[1], ‘true’)
  • 显示一些描述信息
  • Display description
    Message := ‘By default ‘majority_voting’ is set to ‘false’.’
    Message[1] := ’ ’
    Message[2] := ‘If the parameter ‘majority_voting’ is set to ‘false’, the reading result is set to the decoding result of the first scanline that could be decoded.’
    Message[3] := ’ ’
    Message[4] := ‘Here, an ‘EAN-13’ code is detected wrongly inside of another ‘EAN-13’ because of a printing error.’
    MessageWrapped := regexp_replace(Message + ’ ‘,[’(.{0,35})\s’,‘replace_all’],’$1\n’)
    disp_message (WindowHandleText, MessageWrapped, ‘window’, 12, 12, ‘black’, ‘false’)
    *右下角显示’Press F5 TO CONTINUE’
    disp_continue_message (WindowHandle, ‘black’, ‘true’)
    stop ()
  • 第二部分,*
  • PART II, enable majority voting
  • 第一部分:设置参数majority voting为FALSE
    MajorityVotingSetting := ‘true’
    set_bar_code_param (BarCodeHandle, ‘majority_voting’, MajorityVotingSetting)
    • 解码和准备结果
  • Perform decoding and prepare results
    *解码区域内的信息
    decode_bar_code_rectangle2 (Image, BarCodeHandle, ‘EAN-13’, 280, 223, 3.14125 / 2.0, 200, 50, DecodedDataStrings)
    *同上
    get_bar_code_object (SymbolRegion, BarCodeHandle, ‘all’, ‘symbol_regions’)
    get_bar_code_result (BarCodeHandle, ‘all’, ‘decoded_types’, DecodedTypes)
    get_bar_code_result (BarCodeHandle, ‘all’, ‘decoded_strings’, DecodedData)
    get_bar_code_object (ValidScanlines, BarCodeHandle, ‘all’, ‘scanlines_valid’)
    select_obj (ValidScanlines, MajorityScanlines, [[1:4],6,7])
  • 显示结果和信息
  • Display results and labels
    dev_display (Image)
    disp_message (WindowHandle, [‘Looking for bar codes’,’‘majority_voting’ = ‘’ + MajorityVotingSetting + ‘’’], ‘window’, 12, 12, ‘black’, ‘true’)
    *同上
    dev_set_draw (‘margin’)
    dev_set_color (‘green’)
    dev_set_line_width (2)
    smallest_rectangle1 (SymbolRegion, Row1, Column1, Row2, Column2)
    dev_display (SymbolRegion)
    dev_display (MajorityScanlines)
    Message := ['Codetype: ','Data: '] + [DecodedTypes,DecodedData]
    disp_message (WindowHandle, Message, ‘image’, Row1 - 40 * WindowZoomFactor, Column2 - 100, ‘forest green’, ‘true’)
  • Display description
    dev_set_window (WindowHandleText)
    Message := ‘If majority voting is enabled, the bar code reader uses a majority voting scheme to determine the reading results. It returns the result that has been decoded from the majority of all scanlines.’
    Message[1] := ’ ’
    Message[2] := ‘Here, the correct ‘EAN-13’ code is found.’
    MessageWrapped := regexp_replace(Message + ’ ‘,[’(.{0,35})\s’,‘replace_all’],’$1\n’)
    dev_clear_window ()
    disp_message (WindowHandleText, MessageWrapped, ‘window’, 12, 12, ‘black’, ‘false’)
    stop ()
  • 释放内存
  • Clean up memory
    clear_bar_code_model (BarCodeHandle)

Barcode读取之barcode_param_majority_voting.hdev相关推荐

  1. Barcode读取之barcode_para_contrast_min.hdev

    *本例展示了如何使用一维码参数'contrast_min' Example program for the usage of the bar code parameter 'contrast_min' ...

  2. 二维码读取之2d_data_codes_rectify_symbol.hdev

    *这个实例展示了如何读取一个经过修正的倾斜的条码 This program demonstrates how to read a slanted 2d data code by preprocessi ...

  3. 二维码读取之PDF_417_bottle.hdev

    *本例子展示了如何读取PDF 417的条码 This programs shows how to read 2d data codes of type PDF 417. 关闭更新 dev_update ...

  4. 二维码读取之ecc200_small_modules_robustness.hdev

    *这个实例演示了如何读取非常小的ECC200二维码 This example program shows how to find and decode ECC200 symbols that have ...

  5. 二维码读取之ecc200_contrast_tolerance.hdev

    *这个示例程序演示了contrast_tolerance(对比差异,也就是在某些场合检测表面对比度不均匀情况下需要这个参数) *这个参数对条码读取效果的影响 This example demonstr ...

  6. Halcon解决方案指南(16)一维码识别

    第16章 一维码识别_BarCode create_bar_code_model创建条形码模型.返回的句柄提供有关条形码结构的所有必要信息. find_bar_code读取条形码.可以指定要搜索的模型 ...

  7. 轻松使用OpenCV Python控制Webcam,读取Barcode

    2019独角兽企业重金招聘Python工程师标准>>> 虽然手机上Barcode应用已经非常流行,但是工作的时候还是用Webcam比较方便.比如需要检测Barcode,我只需要拿We ...

  8. 基于Halcon学习的一维码识别【六】barcode.param_majority_voting.hdev

    该示例程序显示了条形码参数'majority_voting'的效果.条形码阅读器分析多条扫描线,并尝试对其进行解码.默认情况下,一旦一条扫描线被成功解码,该过程就会终止.在某些情况下,由于本地打印错误 ...

  9. 条形码识别软件linux,条形码读取器Barcode Reader Toolkit 2021全新升级!支持Windows和Linux,算法升级!...

    Barcode Reader Toolkit for Windows是一个工具包,允许开发人员在其应用程序中添加条形码检测.该工具包将图像文件或内存位图作为输入,并返回有关每个条形码的信息,包括值,类 ...

最新文章

  1. python22期_python学习第22期
  2. SAP MM MRP运行后触发的PR单据里没有Assign采购组织?
  3. Objective-C Runtime
  4. :/index.php,http://localhost/my/INDEX.PHP/INDEX/INDEX无法正常运行:解决时找不到Options FollowSymLinks谢谢...
  5. 一步一步学Silverlight 2系列(33):Silverlight 2应用Web Service两例
  6. Pandas 表连接(Merge,join,concatenate)
  7. Oracle 分页查询
  8. Spring 源码分析(四) ——MVC(六)M 与 C 的实现
  9. python 字符串子串_Python字符串子字符串
  10. vue中使用echarts地图
  11. Java 代码访问 SMB 协议
  12. 西瓜书学习之绪论部分
  13. 分糖果系列一(DP+暴力)
  14. 计算机硬件调查和报价600字,600字调查报告.docx
  15. IPv6地址基础理论讲解
  16. pdf转json_pdf转长图工具
  17. python股票接口_在Python中使用股票接口
  18. 【几维安全】共享单车安全漏洞频现 女黑客轻松破解4款共享单车app
  19. MogaFX—ServiceNow的Bill McDermott正在关注货币汇率
  20. Spring嵌套事务异常Transaction rolled back because it has been marked as rollback-only

热门文章

  1. ebs 系统 登录 java_Oracle EBS登录页面显示空白
  2. Python学习日记1——python3.8.3安装以及配置环境
  3. 前端面试技巧和注意事项_面试Web前端需要注意什么?会面试哪些问题?
  4. 2016中欧绿色和智慧城市奖正式启动
  5. SparkStreaming读Kafka- Couldn't find leaders for Set
  6. 【C++FunCode】基于Funcode使用C++语言编写小游戏(小鲨鱼历险记)
  7. 2019 Gartner 商业智能分析平台与数据分析报告解读
  8. 移动电源充电宝新国标GB/T 35590-2017检测报告测试项目
  9. 机器学习算法(一): 基于逻辑回归的分类预测③
  10. 读书笔记---Head First 设计模式--- 装饰者模式