Recherche Images Maps Play YouTube Actualités Gmail Drive Plus »
Connexion
Les utilisateurs de lecteurs d'écran peuvent cliquer sur ce lien pour activer le mode d'accessibilité. Celui-ci propose les mêmes fonctionnalités principales, mais il est optimisé pour votre lecteur d'écran.

Brevets

  1. Recherche avancée dans les brevets
Numéro de publicationCN102521558 B
Type de publicationOctroi
Numéro de demandeCN 201110367610
Date de publication2 avr. 2014
Date de dépôt18 nov. 2011
Date de priorité18 nov. 2011
Autre référence de publicationCN102521558A
Numéro de publication201110367610.1, CN 102521558 B, CN 102521558B, CN 201110367610, CN-B-102521558, CN102521558 B, CN102521558B, CN201110367610, CN201110367610.1
Inventeurs李佐广, 李运秀, 梁日雄, 李耀华, 彭青峰, 于兆和, 张俊
Déposant深圳市宝捷信科技有限公司
Exporter la citationBiBTeX, EndNote, RefMan
Liens externes:  SIPO, Espacenet
Bar code identifying method and device
CN 102521558 B
Résumé  Langue du texte original : Chinois
本发明适用于条码识别技术领域,提供了一种条码识别方法及装置,所述方法包括下述步骤:获取二值化处理后的待识别条码图像及该图像的多个扫描起始点坐标;按照预设的该多个扫描起始点的顺序,依次从每一个扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取所述图像中条码的外接矩形;根据所述外接矩形的特征和/或所述外接矩形中条码的特征信息,判断获取所述条码的维数。 The present invention is applicable to bar code recognition technology in the field, there is provided a barcode recognition method and apparatus, the method comprising the steps of: obtaining a plurality of scanning starting point coordinates after the binarization processing of barcode images to be recognized and the image; according to The preset plurality of scanning starting point of the sequence, in order from the starting point of each scan, up, down, left, and right directions, respectively, and the image line by line-by-column scanning, acquiring the image of the bar code circumscribed rectangle; according to the circumscribed rectangle features and / or the bar code in the circumscribed rectangular feature information is determined to obtain the dimension of the bar code. 本发明实现了对未知维数的条码进行识别判断的目的,且提高了识别性能。 The present invention achieves the object of unknown dimension barcode recognition judgment, and to improve the recognition performance.
Revendications(10)  Langue du texte original : Chinois
1.一种条码识别方法,其特征在于,所述方法包括下述步骤: 获取二值化处理后的待识别条码图像及所述图像的多个扫描起始点坐标; 按照预设的所述多个扫描起始点的顺序,依次从每一个扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取所述图像中条码的外接矩形; 根据所述外接矩形的特征和/或所述外接矩形中条码的特征信息,判断获取所述条码的维数。 1. A barcode recognition method, characterized in that the method comprises the steps of: obtaining a plurality of scanning starting point coordinates after the binarization processing of barcode images to be recognized and the image; according to the preset multi- sequential scan starting point, sequentially from each scan starting point, up, down, left, and right directions respectively, and the image line by line-by-column scanning, acquiring the bar code image in a circumscribed rectangle; in accordance with the said circumscribed rectangle features and / or the bar code in the circumscribed rectangular feature information is determined to obtain the dimension of the bar code.
2.如权利要求1所述的方法,其特征在于,所述方法还包括以下步骤: 当所述图像中存在多个条码时,获取所述图像中每个条码的外接矩形; 按照检测到所述多个条码的顺序,根据每个条码的外接矩形的特征和/或所述外接矩形中条码的特征信息,判断获取所述每个条码的维数。 2. The method according to claim 1, characterized in that said method further comprises the steps of: when a plurality of images in the barcode, acquiring the barcode image in a circumscribed rectangle of each; according to the detected the order of said plurality of bar code, the bar code based on a circumscribed rectangle of each character and / or the bar code in the circumscribed rectangular feature information is determined to obtain the dimension of each of said bar code.
3.如权利要求1所述的方法,其特征在于,所述图像的多个扫描起始点坐标包括所述图像的中心点坐标,所述条码的特征信息指所述条码的条空宽度信息。 3. The method of claim 1, wherein the plurality of scanning starting point coordinates of the center coordinates of the image that includes the image feature information of the bar code refers to the width of the bar code bar-space information.
4.如权利要求1所述的方法,其特征在于,所述方法还包括以下步骤: 当判断该条码的维数为一维时,根据该外接矩形中条码的特征信息,或者对该图像进行预处理后获取的条空信息,判断预设的多种条码类型表中是否存在匹配的条空信息;当存在匹配的条空信息时,获取与所述匹配的条空信息对应的条码类型。 4. The method according to claim 1, characterized in that said method further comprises the steps of: when the number of dimensions is judged that the bar code is a one-dimensional time, according to the characteristic information of the circumscribed rectangle of the bar code, or the image Article empty information obtained after pretreatment, strips empty information to determine whether there is a matching preset multiple barcode types in the table; when there is a matching strip empty information, access to information and the corresponding empty bar code type the match.
5.如权利要求1所述的方法,其特征在于,所述方法还包括以下步骤: 当判断所述条码的维数为二维时,判断所述外接矩形中是否存在与预设的多种条码类型表中的一种类型的条码特征相匹配的特征; 当存在匹配的特征时,获取与所述特征对应的条码类型。 5. The method according to claim 1, characterized in that, said method further comprising the steps of: when it is determined dimension of said two-dimensional bar code, it is determined whether there is the circumscribed rectangle with the preset multiple barcode types in Table One type of bar code matches the characteristic feature; when there is a matched features, obtaining the corresponding barcode types and characteristics.
6.如权利要求3所述的方法,其特征在于,所述方法还包括以下步骤: 当所述外接矩形的长小于预设的长度值,或所述外接矩形的高小于预设的高度值时,则所述条码的维数是一; 当所述外接矩形的长小于预设的长度值,且所述外接矩形的高小于预设的高度值时,则所述图像中不存在条码; 当所述外接矩形的长大于预设的长度值,且所述外接矩形的高大于预设的高度值时,则根据所述外接矩形中条码的条空宽度信息,进一步确定所述条码的维数是一或者二。 6. The method according to claim 3, characterized in that, said method further comprising the steps of: when the length of a circumscribed rectangle of length less than a preset value, or the circumscribed rectangle of height less than a preset high value when the number of dimensions of the bar code is one; when the length of a circumscribed rectangle of length less than a preset value, and the circumscribed rectangle of height less than a preset high value, then the image does not exist in the bar code; when the external rectangle length longer than the preset value, and the external rectangle when tall in height preset value, in accordance with Article empty rectangle the width information of the external bar code, bar code and further determining the dimensions is a number or two.
7.—种条码识别装置,其特征在于,所述装置包括: 扫描起始点获取单元,用于获取二值化处理后的待识别条码图像及所述图像的多个扫描起始点坐标; 外接矩形获取单元,用于按照预设的所述多个扫描起始点的顺序,依次从每一个扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取所述图像中条码的外接矩形;以及维数获取单元,用于根据所述外接矩形的特征和/或所述外接矩形中条码的特征信息,判断获取所述条码的维数。 7.- kinds of bar code identification means, characterized in that said apparatus comprising: a scanning starting point acquiring unit, for acquiring be identified after binarizing the barcode image and the image coordinates of a plurality of scanning starting point; the circumscribed rectangular acquiring unit according to a preset order of the plurality of scanning starting point, sequentially from each of the scan starting point, up, down, left, and right directions, respectively, the image is scanned line by line and column by column, and the dimension acquisition unit, in accordance with the number of dimensions for the circumscribed rectangle features and / or the bar code in the circumscribed rectangular characteristic information, determines the acquired barcode; obtaining the circumscribed rectangle of the bar code image.
8.如权利要求7所述的装置,其特征在于,所述装置还包括: 匹配单元,用于当判断该条码的维数为一维时,根据该外接矩形中条码的特征信息,或者对该图像进行预处理后获取的条空信息,判断预设的多种条码类型表中是否存在匹配的条空信息;以及一维条码类型获取单元,用于当存在匹配的条空信息时,获取与所述匹配的条空信息对应的条码类型。 8. The apparatus according to claim 7, characterized in that said apparatus further comprising: a matching unit for judging when the dimension of the one-dimensional bar code, the bar code based on the circumscribed rectangle in the characteristic information, or for bar-space information of the image obtained after the preprocessing, the bar-space matching judgment information whether there is a preset multiple barcode types of the table; and one-dimensional bar type acquiring unit for, when there is a match of the bar-space information acquisition with the matching barcode type information corresponding empty bar.
9.如权利要求7所述的装置,其特征在于,所述装置还包括:判断单元,用于当判断所述条码的维数为二维时,判断所述外接矩形中是否存在与预设的多种条码类型表中的一种类型的条码特征相匹配的特征;以及二维条码类型获取单元,用于当存在匹配的特征时,获取与所述特征对应的条码类型。 9. The apparatus according to claim 7, characterized in that said apparatus further comprises: judging means for judging when the number of dimensions of the two-dimensional bar code, it is determined whether there is the circumscribed rectangular with a preset multiple barcode types in the table of one type of bar code that matches the characteristic features; and two-dimensional bar code type acquisition unit for barcode types of features when there is a match, access to the corresponding feature.
10.如权利要求7所述的装置,其特征在于,所述维数获取单元具体包括:第一判断单元,用于当所述外接矩形的长小于预设的长度值,或所述外接矩形的高小于预设的高度值时,则确定所述条码的维数是一;第二判断单元,用于当所述外接矩形的长小于预设的长度值,且所述外接矩形的高小于预设的高度值时,则认为所述图像中不存在条码;以及第三判断单元,用于当所述外接矩形的长大于预设的长度值,且所述外接矩形的高大于预设的高度值时,则根据所述外接矩形中条码的条空宽度信息,进一步确定所述条码的维数是一或者二。 10. The apparatus according to claim 7, characterized in that the dimension obtaining unit comprises: a first judging means for, when the length of a circumscribed rectangle of length less than a preset value, or the circumscribed rectangular When the height is less than the preset height value, it is determined that the dimension is a bar code; second determination means for, when the length of a circumscribed rectangle of length less than a preset value, and the circumscribed rectangle height is less than height preset value, the image is considered not present in the bar code; and a third judgment unit for, when the circumscribed rectangle is longer than the preset length value, and the circumscribed rectangle of height greater than a preset the height value, in accordance with Article empty rectangle the width information of the external bar code, to further define the dimension of the bar code is one or two. ` `
Description  Langue du texte original : Chinois

—种条码识别方法及装置 - Kind of bar code recognition method and apparatus

技术领域 FIELD

[0001] 本发明属于条码识别技术领域,尤其涉及一种条码识别方法及装置。 [0001] The present invention belongs to the field of bar code recognition technology, particularly to a barcode recognition method and apparatus.

背景技术 BACKGROUND

[0002] 条码技术是在信息技术和计算机技术基础上发展起来的一门集编码、印刷、识别、数据采集和处理于一身的新兴技术。 [0002] barcode technology is developed in the information technology and computer technology, based on a set of coding, printing, identification, data collection and processing in one of the emerging technologies. 由于其识别快速、准确、可靠以及成本低等优点,被广泛应用于商业、图书管理、仓库、邮电、交通和工业控制等领域,并且势必在逐渐兴起的“物联网”应用中发挥重大的作用。 Because of its recognition fast, accurate, reliable and low cost, is widely used in commercial, library management, storage, telecommunications, transportation and industrial control and other fields, and is bound to gradually rise of the "Internet of Things" applications play a significant role .

[0003] 常见电子条码为广泛采用的一维条码,国际上对其进行的编码标准有EAN-8,EAN-13, UPC-A及UPC-E等各种编码标准,这些标准应用已经相当广泛,然而,其内含的信息量相当少,其只限于使用数字,在这信息爆炸的时代已不再使用。 [0003] The common electronic bar code is a one-dimensional bar codes, coding standards internationally its widespread adoption has EAN-8, EAN-13, UPC-A and UPC-E and other coding standards, these standards have been applied quite widely However, it contains a relatively small amount of information, its use is limited to digital, is no longer used in this era of information explosion. 随着信息技术及硬件发展的进步,使我们得以扩展电子条码的容量,因而产生了二维条码的标准及技术,常见的二维条码的国际标准有roFAU'Data Matrix、MaxiCode及QR Code等各种标准,除了数字及符号外,有些编码方式还可以加入各国语言文字集。 With the advances in information technology and hardware development, enabling us to expand the capacity of the electronic bar code, resulting in a two-dimensional bar code standards and technology, a common international standard two-dimensional bar code has roFAU'Data Matrix, MaxiCode and QR Code and other kinds of standard, in addition to numbers and symbols, but some coding can also be added to the national language character set. 目前,世界上约有225种以上的一维条形码,每种一维条码都有自己的一套编码规格,以规定每个字母(可能是文字或数字)是由几个线条(Bar)及几个空白(Space)组成,以及字母的排列。 Currently, some of the world more than 225 kinds of one-dimensional bar codes, each one has its own set of dimensional bar coding specifications to the provisions of each letter (may be text or numbers) is composed of several lines (Bar) and a few blank (Space) composition, and arrangement of the letters. 一般较流行的一维条码有39码,EAN码,UPC码,128码,以及专门用于书刊管理的ISBN, ISSN等。 Generally more popular one-dimensional bar code has 39 yards, EAN codes, UPC, Code 128, as well as books and periodicals devoted to the management of ISBN, ISSN, etc.

[0004] 现有条码识别方法一般只能对已知是一维或者二维的条码进行识别,或者只对一维或者二维条码的一、二种类型条码进行识别判断,而且识别性能不高。 [0004] existing bar code identification method is generally only known one-dimensional or two-dimensional bar code identification, or only for a one-dimensional or two-dimensional bar code, two types of bar code recognition judgment, but not high recognition performance .

发明内容 SUMMARY

[0005] 本发明实施例的目的在于提供一种条码识别方法及装置,旨在解决由于现有技术没有实现对未知维数的条码进行识别判断,且识别性能不高的问题。 [0005] The object of an embodiment of the present invention to provide a barcode recognition method and apparatus is intended to address the prior art does not achieve due to the unknown dimension of the bar code recognition judgment, and the recognition performance is not high.

[0006] 本发明实施例是这样实现的,一种条码识别方法,所述方法包括下述步骤: [0006] The embodiment of the invention is achieved A barcode recognition method, said method comprising the steps of:

[0007] 获取二值化处理后的待识别条码图像及所述图像的多个扫描起始点坐标; [0007] Get barcode images to be recognized and a plurality of scanning starting point of the image coordinate after binarization process;

[0008] 按照预设的所述多个扫描起始点的顺序,依次从每一个扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取所述图像中条码的外接矩形; [0008] in the order of the plurality of scan preset starting point, sequentially from the beginning of each scanning starting point, up, down, left, and right directions, respectively, and the image line by line-by-column scanning, acquires Barcode external reference image rectangle;

[0009] 根据所述外接矩形的特征和/或所述外接矩形中条码的特征信息,判断获取所述条码的维数。 [0009] According to the circumscribed rectangle features and / or the bar code in the circumscribed rectangular feature information is determined to obtain the dimension of the bar code.

[0010] 本发明实施例的另一目的在于提供一种条码识别装置,所述装置包括: [0010] Another object of an embodiment of the present invention to provide a barcode recognition apparatus, the apparatus comprising:

[0011] 扫描起始点获取单元,用于获取二值化处理后的待识别条码图像及所述图像的多个扫描起始点坐标; [0011] scanning starting point acquiring unit, for acquiring a plurality of scanning starting point coordinates after the binarization processing of barcode images to be recognized and the image;

[0012] 外接矩形获取单元,用于按照预设的所述多个扫描起始点的顺序,依次从每一个扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取所述图像中条码的外接矩形;以及 [0012] circumscribed rectangles acquiring unit according to a preset order of the plurality of scanning starting point, sequentially from the beginning of each scanning starting point, up, down, left, and right directions respectively on the image line by line and by-column scanning, access to the images of the external barcode rectangle; and

[0013] 维数获取单元,用于根据所述外接矩形的特征和/或所述外接矩形中条码的特征信息,判断获取所述条码的维数。 [0013] dimension acquiring unit configured in accordance with the number of dimensions of the circumscribed rectangle features and / or the bar code in the circumscribed rectangular feature information is determined to obtain the barcode.

[0014] 本发明实施例通过获取二值化处理后的待识别条码图像及该图像的多个扫描起始点坐标,按照预设的该多个扫描起始点的顺序,依次从每一个扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取该图像中条码的外接矩形;根据该外接矩形的特征和/或该外接矩形中条码的特征信息,判断获取该条码的维数,解决了由于现有技术没有实现对未知维数的条码进行识别判断,且识别性能不高的问题,从而能够自动识别条码维数,识别性能也得到提高。 By acquiring a plurality of scanning starting point coordinates after the binarization processing of barcode images to be recognized and the image, according to a preset order of the plurality of scanning starting point, sequentially from the scanning start point of each embodiment [0014] The present invention start, up, down, left and right, respectively, of the four directions of the image line by line and column by column scan bar codes to get the image in an external rectangle; rectangle under the external features and / or the external rectangle barcode feature information , is determined to obtain the dimension of the bar code, due to the prior art does not solve the unknown dimension to achieve bar code recognition judgment, and the recognition performance is not high, it is possible to automatically identify the bar code dimension, recognition performance is also improved.

附图说明 Brief Description

[0015] 图1是本发明第一实施例提供的条码识别方法的实现流程图; [0015] FIG. 1 is a flow diagram provided to achieve the barcode recognition method of the first embodiment of the present invention;

[0016] 图2是本发明第一实施例提供的条码识别方法的实现流程图; [0016] FIG. 2 is a flow diagram provided to achieve the barcode recognition method of the first embodiment of the present invention;

[0017] 图3是本发明实施例提供的一维条码的示意图; [0017] FIG. 3 is a schematic view of a one-dimensional bar code according to an embodiment of the present invention;

[0018] 图4a、4b分别是本发明实施例提供的一维条码与二维条码的示意图; [0018] Figures 4a, 4b are schematic embodiment of the present invention is a one-dimensional barcode and two-dimensional bar code provided in the embodiment;

[0019] 图5是本发明第一实施例提供的条码识别方法的实现流程图; [0019] FIG. 5 is a flow diagram provided to achieve the barcode recognition method of the first embodiment of the present invention;

[0020] 图6是本发明第二实施例提供的条码识别方法中最佳亮度值的获取流程图; [0020] FIG. 6 is a flowchart of the optimum luminance value acquired barcode recognition method of the second embodiment of the present invention provides;

[0021] 图7是本发明第三实施例提供的条码识别方法的实现流程图; [0021] FIG. 7 is a flow diagram provided to achieve the barcode recognition method of the third embodiment of the present invention;

[0022] 图8是本发明第四实施例提供的条码识别装置的结构图。 [0022] FIG. 8 is a configuration diagram of a fourth embodiment of the present invention, the barcode recognition apparatus of embodiment provided.

具体实施方式 DETAILED DESCRIPTION

[0023] 为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。 [0023] In order to make the objects, technical solutions and advantages of the present invention will be more clearly understood, the accompanying drawings and the following embodiments, the present invention will be described in further detail. 应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。 It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0024] 本发明实施例通过获取待识别图像的外接矩形,根据该外接矩形和/或该外接矩形中条码的特征信息来获取该图像中条码的维数,实现了对未知维数的条码进行识别判断以及对一幅图像所包含的多个条码的识别判断,也使得识别性能得到提高。 [0024] The embodiment of the invention to be recognized by acquiring the image bounding box rectangle based on the external and / or the external rectangle barcode feature information to obtain the dimension of the image in the bar code, the realization of unknown dimension barcode and a plurality of barcode recognition judgment on an image included in the recognition judgment, but also makes the recognition performance is improved.

[0025] 本发明实施例提供了一种条码识别方法,所述方法包括下述步骤: [0025] embodiment of the invention there is provided a bar code identification, said method comprising the steps of:

[0026] 获取二值化处理后的待识别条码图像及所述图像的多个扫描起始点坐标; [0026] Get barcode images to be recognized and a plurality of scanning starting point of the image coordinate after binarization process;

[0027] 按照预设的所述多个扫描起始点的顺序,依次从每一个扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取所述图像中条码的外接矩形; [0027] in the order of the plurality of scan preset starting point, sequentially from the beginning of each scanning starting point, up, down, left, and right directions, respectively, and the image line by line-by-column scanning, acquires Barcode external reference image rectangle;

[0028] 根据所述外接矩形的特征和/或所述外接矩形中条码的特征信息,判断获取所述条码的维数。 [0028] According to the circumscribed rectangle features and / or the bar code in the circumscribed rectangular feature information is determined to obtain the dimension of the bar code.

[0029] 本发明实施例还提供了一种条码识别装置,所述装置包括: [0029] Embodiments of the present invention further provides a barcode recognition apparatus, the apparatus comprising:

[0030] 扫描起始点获取单元,用于获取二值化处理后的待识别条码图像及所述图像的多个扫描起始点坐标; [0030] The scanning starting point acquiring unit, for acquiring a plurality of scanning starting point coordinates after the binarization processing of barcode images to be recognized and the image;

[0031] 外接矩形获取单元,用于按照预设的所述多个扫描起始点的顺序,依次从每一个扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取所述图像中条码的外接矩形;以及 [0031] circumscribed rectangles acquiring unit according to a preset order of the plurality of scanning starting point, sequentially from the beginning of each scanning starting point, up, down, left, and right directions respectively on the image line by line and by-column scanning, access to the images of the external barcode rectangle; and

[0032] 维数获取单元,用于根据所述外接矩形的特征和/或所述外接矩形中条码的特征信息,判断获取所述条码的维数。 [0032] dimension acquiring unit configured in accordance with the number of dimensions of the circumscribed rectangle features and / or the bar code in the circumscribed rectangular feature information is determined to obtain the barcode. [0033] 本发明实施例通过获取二值化处理后的待识别条码图像以及该图像的多个扫描起始点坐标,按照预设的该多个扫描起始点的顺序,依次从每一个扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取该图像中条码的外接矩形;根据该外接矩形的特征和/或该外接矩形中条码的特征信息,判断获取该条码的维数,实现了对未知维数的条码进行识别判断以及对一幅图像所包含的多个条码的识别判断,也提高了识别性能的目的。 EXAMPLES [0033] The present invention is to be recognized by acquiring the barcode image after binarization processing and the scanning start point coordinates of the image, according to a preset order of the plurality of scanning starting point, sequentially from each scanning starting point start, up, down, left and right, respectively, of the four directions of the image line by line and column by column scan bar codes to get the image in an external rectangle; rectangle under the external features and / or the external rectangle barcode feature information determine the dimension of the bar code acquisition, achieve the purpose of the unknown dimension barcode recognition and multiple barcode judgment contained an image recognition judgment, but also improve the recognition performance.

[0034] 以下结合具体实施例对本发明的具体实现进行详细描述: [0034] The following detailed examples of specific implementations of the invention described in detail:

[0035] 一维条码又称线形条码,是由平行排列的多个“条”和“空”单元组成,条码信息依靠条和空的不同宽度和位置来表达。 [0035] The one-dimensional bar codes, also known as a linear bar code, are arranged in parallel by a plurality of "strips" and "empty" units, rely on bar code information of the bars and spaces of different widths and positions expressed. 二维条码是由按一定规律在二维方向上分布的黑白相间的特定几何图形组成,其可以在二维方向上表达信息。 Dimensional bar code is made according to certain rules specific geometry in two dimensions the distribution of black and white, whose information can be expressed in two dimensions. 二维条码可以分为行列式二维条码和矩阵式二维条码。 Dimensional bar code can be divided into two-dimensional bar code and matrix determinant two-dimensional bar code. 行列式二维条码是由多行短截的一维条码堆叠而成,代表性的行列式二维条码包括PDF417、Code49、Code 16k等。 Determinant dimensional bar code is composed of a multi-line stubs are piled one-dimensional bar codes, two-dimensional bar code representation of the determinant, including PDF417, Code49, Code 16k, etc. 行列式二维条码信息表示方法与一维条码类似,也是依靠条和空的不同宽度和位置来表达。 Determinant of two-dimensional bar code information, said method similar to the one-dimensional bar codes, but also rely on the bars and spaces of different widths and positions expressed. 矩阵式二维条码是由按预定规则分布于矩阵中的黑、白模块组成,代表性的矩阵式二维条码包括QR码、Data Matrix码、Maxi码、Aztec码、汉信码等。 Matrix-dimensional bar code is distributed in the matrix according to predefined rules in black and white modules, representative matrix QR code is a two-dimensional bar code includes, Data Matrix code, Maxi codes, Aztec codes, Han letter codes.

[0036] 实施例一: [0036] Embodiment 1:

[0037] 图1示出了本发明第一实施例提供的条码识别方法的实现流程,详述如下: [0037] Figure 1 illustrates a process embodiment of the present invention provided to achieve the barcode recognition method of the first embodiment, as detailed below:

[0038] 在步骤SlOl中,获取二值化处理后的待识别条码图像以及该图像的多个扫描起始点坐标。 [0038] In step SlOl, the acquired barcode image to be recognized after the binarization processing, and a plurality of scanning starting point coordinates of the image.

[0039] 在具体实施过程中,首先从摄像头获取待识别的彩色条码图像,并将该彩色条码图像进行灰度化处理,接着获取灰度化处理后的该图像,计算该图像的直方图,由于条码一般是黑色亮度和白色亮度组成,则在该直方图中将出现靠近黑色亮度区域的波峰和一个靠近白色亮度区域的波峰,因此可以确定两个波峰之间的一个最佳亮度值,对该图像进行分害I],若两个峰值的距离比较接近,小于预设的距离值,则认为该图像的对比度不够,不存在条码的条件;两个峰值比较远,则认为存在条码,获取该两个峰值中间的某个最佳亮度值,以该值作为图像二值化的判断阈值,将图像中大于阈值的灰度值设为1,否则为0,从而获取二值化处理后的待识别图像,进而可以获取该图像的多个扫描起始点坐标,该图像的多个扫描起始点坐标包括所述图像的中心点坐标等,例如以(Xe, Yc)表示该中心点的坐标。 [0039] In a specific implementation process, the first to be identified from the camera to obtain a color bar code image, and the gray color barcode image processing, and then get the gray-scale image processing to calculate the histogram of the image, Because the bar code is generally composed of black luminance and white luminance, black luminance region near the peak white brightness of the area and one near the peak of the histogram will appear in, so you can determine an optimum brightness value between two peaks of The image is divided harm I], if the distance between two peaks relatively close distance less than a preset value, the contrast of the image is considered insufficient, there is no bar code conditions; distant two peaks is considered the existence of the bar code, to obtain one of the two best middle peak brightness value to the value as a binary image determination threshold value, the image gray value greater than the threshold set to 1, and 0 otherwise, and thus obtain the binary process images to be recognized, and thus can obtain the coordinates of a plurality of scanning starting point of the image, a plurality of scanning starting point coordinates of the center point coordinates of the image that includes the image and the like, for example, (Xe, Yc) represent the coordinates of the center point. 具体地,首先需要对待识别条码图像进行预设个数的分块,获取分块后每一块图像的中心点,则分块后每一块图像的中心点即为该图像的扫描起始点,则获取了该图像的多个扫描起始点,在实际识别过程中,可以将该待识别条码图像分成四块,获取分块后该四块分块图像的中心点,加上该整幅待识别图像的中心点,可以获取5个扫描起始点。 Specifically, first need to be treated to identify the barcode image into blocks of a preset number, to obtain an image of the center point of each block after block, the block after the image of the center point of each block is the starting point of the scanned image, the acquisition multiple scanning starting point of the image in the actual identification process can identify the barcode image to be divided into four parts, get the center of the four sub-block after block of the image, with the whole image to be recognized the center, you can get five scanning starting point.

[0040] 具体地,获取该作为图像二值化的最佳亮度值或者阈值的具体过程如下实施例二所述,但不限于该实施例的获取过程,在此不再赘述。 [0040] In particular, access to the binary image as a specific process optimum brightness threshold value or two of the following examples, but not limited to the acquisition process of the embodiment, not repeat them here.

[0041] 在本发明实施例中,由于现有的一维或者二维条码是由灰度值为O的黑色和灰度值为I的白色组成,对图像进行二值化处理后,再进行条码的获取及维数的判断,使得结果更准确。 [0041] In the embodiment of the invention, since the existing one-dimensional or two-dimensional bar code by the gray level value of O is black and white gray value I composition, the image after binarization processing, and then acquisition and judgment dimension barcode, making the results more accurate.

[0042] 在步骤S102中,按照预设的该多个扫描起始点的顺序,依次从每一个扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取该图像中条码的外接矩形。 [0042] In step S102, according to a preset order of the plurality of scanning starting point, sequentially from the beginning of each scanning starting point, up, down, left, and right directions, respectively, of the image line by line and column by column scan the bar code image to get the external rectangle.

[0043] 其中,该预设的该多个扫描起始点的顺序可以根据用户需要预先设定,比如可以将该多个扫描起始点所包括的该待识别图像的中心点作为第一扫描起始点,其他按照图像的左上、右上、左下、右下的顺序对剩余的扫描起始点排序。 [0043] wherein, the preset order of the plurality of scanning starting point may be previously set according to user needs, for example, can be the center point of the image to be recognized by including a plurality of scanning starting point as the first scanning starting point Other images sorted in order of upper left, upper right, lower left, lower right starting point for the rest of the scan.

[0044] 该步骤S102具体包括以下步骤,该待识别图像的中心点坐标为(Xc,Yc),如图2所示: [0044] The step S102 includes the following steps, the center coordinates of the image to be recognized as (Xc, Yc), as shown in Figure 2:

[0045] 步骤S221中,获取该多个扫描起始点的第一扫描起始点。 [0045] In step S221, the scanning starting point to obtain a first plurality of scan starting point.

[0046] 步骤S222中,从该扫描起始点开始,对该条码图像进行逐行扫描,确定最小纵坐标和最大纵坐标。 [0046] step S222, start scanning from the starting point, the bar code image is progressively scanned, determining the minimum and maximum ordinate ordinate.

[0047] 具体地,以图像的左上角为坐标系XY的原点(0,0),水平向右为X方向,横坐标值从左至右逐渐增加,垂直方向为Y方向,纵坐标从上到下逐渐增加。 [0047] Specifically, the upper left corner of the image for the XY coordinate system of the origin (0,0), horizontally to the right as the X direction, abscissa value gradually increases from left to right, the vertical direction is the Y direction, the vertical axis from the gradually increased to the next. 则从扫描起始点开始往下逐行扫描(水平扫描)该图像,纵坐标值逐渐增大,逐行加1,按照扫描顺序,计算扫描方向上每一行图像中出现像素值连续为1(表示白色)的个数,若该个数大于预设的像素阈值,该预设的像素阈值可以为该条码图像每一行像素总个数的1/4,则认为是条码的边界,条码周围是白色区域,此时该行对应的纵坐标即为最大的纵坐标Ymax值,否则继续扫描,获取该Ymax。 Scanning from the starting point down progressive scan (horizontal scan) the image, the ordinate value increases, a progressive increase, according to the scan order, each row of pixels values appear in the image on the computer as a continuous scanning direction (indicated White) number, if the number of pixels greater than a preset threshold value, the pixel thresholds may be preset for the barcode image for each row of pixels is 1/4 of the total number, is considered to be the boundary of the bar code, the bar code is surrounded by white area, then the line corresponding to the vertical axis of ordinate Ymax is the maximum value, otherwise continue to scan, get the Ymax. 同样,从扫描起始点开始往上逐行扫描该图像,纵坐标值逐渐较小,逐行减1,则按照扫描顺序,计算扫描方向上每一行图像中,出现像素值连续为1(表示白色)的个数,若该个数大于预设的像素阈值,该预设的像素阈值可以为图像每一行的像素总个数的1/4,则认为是条码的边界,条码周围是白色区域,此时该行的纵坐标即为最小的纵坐标Ymin 值。 Similarly, from the scan start point up the progressive scan image, ordinate value is gradually smaller, progressive minus 1, then according to the scan order, calculated for each line of the image in the scanning direction, the pixel appears as a continuous value (represented white ) number, if the number of pixels greater than a preset threshold, the threshold may be preset to the image pixel of each line 1/4 of the total number of pixels, is considered to be the boundary of the bar code, the bar code is surrounded by a white area, At this point the line is the ordinate minimum value Ymin of the vertical axis.

[0048] 在具体实施过程中,对于条码类型为一维的横向水平条码,此时获取的Ymax值与Ymin值范围较小,而对于一维的竖向垂直条码或者二维条码,此时获取的Ymax值与Ymin值范围较大。 [0048] In the specific implementation process, bar code type for horizontal level one-dimensional bar codes, the smaller the value of this time acquired Ymax Ymin value range, and for a one-dimensional or two-dimensional bar code barcode vertical vertical, then get The Ymax and Ymin value larger range of values.

[0049] 步骤S223中,从该扫描起始点开始,对该图像进行逐列扫描,确定最小横坐标和最大横坐标。 [0049] In step S223, start scanning from the starting point, the image is scanned row by row, to determine the minimum and maximum abscissa abscissa.

[0050] 具体地,从该扫描起始点开始往左逐列扫描(垂直扫描)该图像,横坐标值逐渐减小,逐列减1,按照扫描顺序,计算扫描方向上每一列图像中,出现像素值连续为1(表示白色)的个数,若该个数大于预设的像素阈值,该预设的像素阈值可以为图像每一列的像素总个数的1/4,则认为是条码的边界,条码周围是白色区域,此时该列的横坐标即为最小的横坐标Xmin。 [0050] Specifically, from the scanning start point to the left by the column scanning (vertical scanning) the image, the abscissa value is gradually decreased, row by row by 1, in accordance with the scanning order, the scanning direction calculated for each column in the image, appears pixel value is continuously 1 (represented white) number, if the number of pixels greater than a preset threshold, the threshold may be preset to the image pixel of each column of 1/4 of the total number of pixels, the bar code is considered to be boundary, the white area surrounded by the bar code, then the column is the minimum abscissa abscissa Xmin. 同样,从该扫描起始点开始往右逐列扫描(垂直扫描)该图像,横坐标值逐渐增加,逐列加1,按照上述条件,可以获取最大的横坐标值Xmax。 Similarly, the right starting point from which scanning by the column scanning (vertical scanning) the image, the abscissa value is gradually increased, by adding a column, under the above conditions, can obtain the maximum abscissa value Xmax.

[0051] 在具体实施过程中,对于条码类型为一维的竖向垂直条码,此时获取的Xmax值与Xmin值范围较小,而对于一维的横向水平条码或者二维条码,此时获取的Xmax值与Xmin值范围较大。 [0051] In the specific implementation process, for a one-dimensional bar code type vertical vertical bar codes, the smaller this time acquired Xmax value Xmin value range, and for a one-dimensional or two-dimensional bar code transverse horizontal bar code, then get The Xmax value Xmin larger range of values.

[0052] 步骤S224中,根据获取的最大横坐标、最小横坐标、最大纵坐标、最小纵坐标,获取并保存该条码的外接矩形。 [0052] In step S224, based on the abscissa to obtain the maximum, minimum, the abscissa, ordinate maximum and minimum ordinate, to obtain and save the circumscribed rectangle of the bar code.

[0053]具体地,以(Xmin, Ymin)、(Xmax, Ymin)、(Xmin、Ymax)、(Xmax, Ymax)为四边形的四个顶点,确定外接矩形。 [0053] Specifically, the (Xmin, Ymin), (Xmax, Ymin), (Xmin, Ymax), (Xmax, Ymax) for the four vertices of a quadrilateral, determining a circumscribed rectangle.

[0054] 步骤S225中,判断该扫描起始点是否为该多个扫描起始点的最后一个扫描起始点,是,则执行步骤S227,退出,否,则执行步骤S226。 [0054] In step S225, it is determined whether the scanning starting point for the final starting scan multiple scans starting point, yes, proceed to Step S227, exit, no, proceed to step S226.

[0055] 步骤S226中,获取该多个扫描起始点的下一扫描起始点,并返回执行步骤S222。 [0055] Step S226, the start point of the next scan to obtain a plurality of scanning starting point, and returns to step S222.

[0056] 在本发明实施例中,该条码识别方法支持一幅图像中多个条码的识别,当该图像中存在多个条码时,利用上述步骤S221至S227可以获取该图像中每个条码的外接矩形。 [0056] In the embodiment of the invention, the barcode recognition method capable of recognizing an image of a plurality of bar code, when a plurality of bar codes in the image, the above steps S221 to S227 can obtain the image of each bar code External rectangle. 另夕卜,如果用户只需要识别该待识别图像中心附近的条码,则可以设定以将该多个扫描起始点所包括的该待识别图像的中心点作为第一扫描起始点,从而在获取第一个外接矩形后就直接退出,执行下述步骤S103即可,同样可以根据实际需要,获取该待识别图像其他部位附近的条码的外接矩形,从而提高识别效率。 Another Xi Bu, if the user only needs to identify the image to be recognized near the center of the bar code, you can set in the center of the image to be recognized more than covered by the scanning starting point as the starting point of the first scan, thereby obtaining The first exit after circumscribed rectangle, you can perform the following steps S103 can also be based on actual needs, to get the image to be recognized in other parts of the bar code near the bounding box to improve recognition efficiency.

[0057] 在步骤S103中,根据该外接矩形的特征和/或该外接矩形中条码的特征信息,判断获取该条码的维数。 [0057] In step S103, according to the circumscribed rectangle features and / or the external rectangle barcode feature information to determine the acquisition dimension barcode.

[0058] 在具体实施过程中,该外接矩形的特征包外接矩形的长、高等,该外接矩形的长是指外接矩形在X方向上的长度或者是Xmax与Xmin之间的距离,外接矩形的高是指外接矩形在Y方向上的长度Ymax与Ymin之间的距离,在获取条码的外接矩形后,若该外接矩形的长(Xmax与Xmin之间的距离)小于预设的长度值,或该外接矩形的高(Ymax与Ymin之间的距离)小于预设的高度值时,则认为该条码不是二维条码,确定该条码的维数是一;当该外接矩形的长小于预设的长度值,且该外接矩形的高小于预设的高度值时,则认为不存在条码;当该外接矩形的长小于预设的长度值,而该外接矩形的高大于预设的高度值时,则认为该一维条码为竖直型条码,如图3所示;当该外接矩形的高小于预设的高度值,而该外接矩形的长大于预设的长度值时,则认为该一维条码为水平型条码,而不是二维条码;若该外接矩形的长大于预设的长度值,且该外接矩形的高大于预设的高度值时,则需要进一步结合该条码的特征信息来确定该条码的维数,该条码的特征信息是指该条码的条空宽度信息,包括条空宽度值,条空分布信息等,该条空分布信息是指任意2行或者多行的条空分布是否相同等。 [0058] In the specific implementation process, the external rectangle circumscribing rectangle length feature package, higher, the add-long rectangle circumscribed rectangle length is the distance in the X direction or between Xmax and Xmin, circumscribed rectangle High circumscribed rectangle is the distance in the Y-direction length between Ymax and Ymin, obtaining circumscribed rectangles after the bar code, if the circumscribed rectangle length (the distance between Xmax and Xmin) is less than the predetermined length value, or The external rectangle height (distance between Ymax and Ymin) is less than the predetermined height value, then that is not a two-dimensional bar code in the bar code to determine the dimension of the bar code is one; when the add-long rectangle smaller than the preset length value, and when the external rectangle height is less than a preset height value, it is considered there is no bar code; when the add-long rectangle smaller than a preset length value, and the circumscribed rectangle tall in height preset value, is considered as a vertical one-dimensional bar-type bar code, as shown in Figure 3; when the external rectangle height is less than a preset height value, and the circumscribed rectangle length longer than the preset value, it is considered that the one-dimensional Barcode horizontal bar code, rather than the two-dimensional bar code; if the external rectangle grew at a preset length value, and the circumscribed rectangle tall in height preset value, the need for further information on the binding characteristics of the bar code to determine dimensionality of the barcode, the barcode feature information refers to information of the barcode stripe width is empty, including bar-space width values, bar-space distribution information or the like, which air distribution information refers to any two or more lines of the bar-space distribution are the same and so on.

[0059] 具体地,若该外接矩形的长大于预设的长度值,且该外接矩形的高大于预设的高度值时,可以随机多次垂直或者水平扫描该外接矩形中任意2列或者2行条码,若该2列条码中存在相同的条空宽度信息或者该2行条码中存在相同的条空宽度信息,则认为该条码为一维条码,如图4a所示,且若各行条空宽度基本上相等,则认为条码是水平的;若各列条空宽度基本上相等,则认为条码是垂直的,否则认为该条码为二维条码,如图4b所示,该扫描的次数可以根据用户需要设定,扫描次数越多,数据的可靠性越稳定,判断结果越准确。 [0059] Specifically, if the external rectangle grew at a preset length value, and the circumscribed rectangle tall in height preset value, you can randomly repeatedly scanning the external vertical or horizontal rectangle any 2 or 2 Barcode line, if there is the same strip width information that two empty barcode or the presence of two identical pieces empty line width information bar code, bar code is considered as one-dimensional bar code, shown in Figure 4a, and if each row strip empty width substantially equal, the bar code is considered level; if each column is substantially equal to the space width bar, the bar code is vertical is considered it is understood that the bar code is a two-dimensional bar code, shown in Figure 4b, the number of the scan can the user needs to set, the more the number of scans, the more stable the reliability of the data, the more accurate the determination result.

[0060] 另外,在确定该条码为一维条码后,根据该2列或者2行条码中相同的条空宽度的条空线的方向,若该条空线的方向为垂直或者偏向垂直方向,则在以后条码种类判定时,可以只进行垂直扫描,具体可以隔列进行从上到下与从下到上垂直交替扫描,就可以确定该条码的类型,同样,若该条空线的方向为水平或者偏向水平方向,则在以后条码种类判定时,可以只进行水平扫描,具体可以隔行进行从左到右与从右到左水平交替扫描,从而不管条码顺着放,倒着放,旋转着放,都可以对其类型进行识别,使得该确定该一维条码的类型的方法具有较强的适应性,且能够提高条码类型的识别速度。 [0060] Further, in determining the one-dimensional bar code for bar code, the bar-space line depending on the direction of the two rows or two identical bar code empty strip width, if the direction of the air line which is perpendicular or vertical deflection, then later when determining the type of bar code that can be scanned only vertical concrete columns can be separated from top to bottom with the type of the bar code from the bottom to the vertical scanning alternately, you can determine the same, if the direction of the section line is empty horizontally or biased horizontally, then later when determining the type of bar code that can be scanned horizontally only, specifically interlaced from left to right and right to left, alternating horizontal scan, so regardless of the barcode put down, put backwards, spinning put, you can identify its type, so that the one-dimensional bar codes that determine the type of method has strong adaptability, and can improve recognition speed barcode types.

[0061 ] 在本发明实施例中,该条码识别方法支持一幅图像中多个条码的识别,当该图像中存在多个条码时,按照检测到该多个条码的顺序,判断获取该多个条码的维数,具体地,首先需要对待识别条码图像进行预设个数的分块,比如分成五块,获取分块后每一块图像的中心点,则在对待识别条码图像进行二值化处理后,从每一块图像的中心点开始,也即从扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取该图像中每个条码的外接矩形,接着逐个获取该每个条码的外接矩形的特征和/或该外接矩形中条码的特征信息,根据每个条码的外接矩形的特征和/或该外接矩形中条码的特征信息判断获取该条码的维数,由于在识别一幅图像所包含的多个条码时,预先对条码图像进行预设个数的分块,再获取分块后每一块图像的中心点或者扫描起始点,可以保证所获取的扫描起始点落在该多个条码中,从而可以进行下一步的条码维数识别,也使得该方法能够适应多种条码的应用场景,具有较强的自适应性。 [0061] In the embodiment of the invention, the barcode recognition method capable of recognizing an image of a plurality of bar code, the bar code when a plurality of images, in the order of the plurality of bar code is detected, it is determined to obtain the plurality of dimension bar code, specifically, first need to be treated to identify the barcode image into blocks of a preset number, for example divided into five, the center point of each piece of the image after acquisition block, then treat identification barcode image binarization processing After starting from the center point of each block of the image, i.e. starting from the scanning starting point, up, down, left, and right directions, respectively, and the image line by line-by-column scanning, each bar code to obtain the image of the external rectangle, then one by one to get the bar code of each rectangle external features and / or the external rectangle barcode feature information according to each barcode circumscribed rectangle features and / or the external rectangle barcode feature to get the bar code information to determine dimensions, due to multiple barcode recognition of an image contains, in advance of the bar code image into blocks preset number, and then get the center or scanning the block after the starting point of each piece of the image, you can ensure that the scanning starting point to obtain the fall of the plurality of bar code, which can make the next dimension barcode recognition, but also makes the method can adapt to a variety of bar code application scenarios, with strong adaptability.

[0062] 该条码识别方法还包括以下步骤,如图5所示: [0062] The barcode recognition method further comprises the steps, shown in Figure 5:

[0063] 在S501中,当判断该条码的维数为一维时,根据该外接矩形中条码的特征信息,或者对该图像进行预处理后获取的条空信息,判断预设的多种条码类型表中是否存在匹配的条空信息。 Article empty message after [0063] In S501, when the number of dimensions that determine when a one-dimensional bar codes, according to the characteristics of the bar code information of the external rectangle, or the image preprocessing acquired default judgment variety of bar code matches the empty bar type information exists in the table.

[0064] 具体地,在确定该条码为一维条码后,根据已经获取的该外接矩形中条码的特征信息,可以判断预设的多种条码类型表中是否存在匹配的条空信息,如无法判断则在确定该条码为一维条码后,也可以采用I维图像边缘处理方法处理该条码图像及自动去噪功能等预处理操作,以更精确的获取该一维条码的条空信息,该条空信息为通过对该一维条码按照条空线的方向进行垂直或者水平扫描等获取的多行条空的特征信息,也即进一步获取预处理后该条码的条空宽度信息及条空线的方向。 [0064] Specifically, in determining the one-dimensional bar code barcode post, according to the characteristics of the information that has been obtained in an external rectangular bar code, you can determine whether there is a matching strip empty preset multiple barcode types of information in the table, if you can not judgment in determining the one-dimensional bar code barcode, too, can use I-dimensional image edge of the bar code image processing method and automatic de-noising preprocessing functions, in order to obtain more precise information about the one-dimensional bar-space bar code, which is bar-space information by the one-dimensional bar code scanning, according to the vertical or horizontal direction of bar-space lines to obtain a plurality of rows of bar-space feature information, i.e. further to obtain the pretreated strip empty barcode bar width information and empty lines direction.

[0065] 其中,该预设的多种条码类型表为在识别条码之前预先配置,配置有多种类型的条码及对应的条码特征,以方便在进行条码的识别时使用,且用户可以根据需要随时添加其他类型的条码至该类型表中,具有较好的扩展性。 [0065] wherein, the preset multiple barcode types is pre-configured table before identifying the bar code, arranged corresponding to a plurality of types of bar codes and bar code characteristics, for ease of use when performing barcode recognition, and the user may be required Feel free to add other types of bar codes to the type of table, has good scalability. 该表中各条码类型放置根据使用的条码类型的频率排序,也即配置各条码的检测识别优先级别,使得在当前图像中检测到的条码,其配置的优先级最高时,则在获取该条码的类型后,则不必继续检测后面的类型的条码,从而提高了条码识别速度。 The table placed under each type of bar code symbologies sort of frequency use, namely the configuration of each bar code detection and identification of priority, so that detected in the current image of the bar code, the highest priority is its configuration, you get the bar code After the type is not necessary to continue to detect the type of bar code behind, thereby improving the barcode recognition speed.

[0066] 在S502中,当存在匹配的条空信息时,获取与该匹配的条空信息对应的条码类型。 [0066] In S502, when there is a matching strip empty information, access to information and the empty bar that matches the corresponding barcode types.

[0067] 在S503中,根据该条码类型对该条码进行识别,并输出识别结果。 [0067] In S503, according to the bar code to identify the type of bar code and outputs the recognition results.

[0068] 在具体实施过程中,假如当前图像的条码是eanl3,则进行eanl3类型的条码识另IJ,图3为eanl3类型条码图像。 [0068] In the specific implementation process, if the current barcode image is eanl3, then perform the type of bar code identification eanl3 another IJ, Figure 3 eanl3 type barcode images. 根据该条码多行的条空宽度信息确定最终的类型结果,并将该结果输出。 The type of information to determine the final result based on the multi-line barcode empty strip width, and the result is output.

[0069] 在本发明实施例中,该一维条码类型的判断方法通过先对条码进行预处理,如边缘检测、去噪等,再进行按照条空线方向的多行扫描,获取条空信息,结合该条空信息与预设的多种条码类型表,得到条码的类型结果,使得条码识别精度得到提高,误识率得到降低。 [0069] In the embodiment of the invention, the one-dimensional bar code method to determine the type of bar code by first preprocessing, such as edge detection, de-noising, etc., then in accordance with Article empty multi-line scan line direction, to obtain information bar empty combining information which empty preset variety of bar code type table, get the type of results barcode, barcode recognition accuracy is improved so that, the error rate is reduced.

[0070] 该条码识别方法还包括对二维条码的类型判断步骤,其具体实现过程如下实施例三所述,在此不再赘述。 [0070] The bar code recognition method also includes a two-dimensional bar code type determination step, the specific implementation process as described in Example III, are not discussed here.

[0071] 实施例二: [0071] EXAMPLE II:

[0072] 图6示出了本发明第二实施例提供的条码识别方法中最佳亮度值的获取流程,具体为对待识别的彩色图像进行灰度化处理,获取该灰度图像的直方图后,对该图像进行二值化处理(二值为0、1),获取作为二值化的最佳亮度值或者阈值的过程,但不限于该实施例的获取过程,详述如下: [0072] Figure 6 shows the process of obtaining bar code identification method provided by the best luminance value of a second embodiment of the present invention, particularly for treating recognizable color gray-scale image processing, obtaining the histogram of the image after gradation , the image binarization process (b is 0, 1), the process of obtaining the optimum luminance value or threshold value as binarization, but are not limited to the acquisition process of this embodiment, as detailed below:

[0073] 在步骤S601中,获取该直方图中的第一峰值以及该第一峰值对应的第一灰度值。 [0073] In step S601, to obtain a first peak and a first gray value corresponding to the first peak of the histogram.

[0074] 具体地,该第一峰值为该灰度图像中出现最多的某一灰度值的个数,也即该直方图中的最大值,以maxBucketCount表示,并获取该最大值对应的第一灰度值,也即该灰度图像中出现最多的该某一灰度值,以firstPeak表示。 [0074] Specifically, the first peak for the maximum number of gray values of a gray image appears, i.e. the maximum value in the histogram, to maxBucketCount expressed, and acquires the maximum value of the corresponding first a gray scale value, the maximum value is a gradation appears also in the gray scale image to firstPeak expressed. 另外,当该灰度图像中出现最多的灰度值不止一个时,则可以取灰度值较小的灰度所对应的峰值作为第一峰值。 Further, when the gray scale image in the most frequent gray value more than one, it can take a peak grayscale value corresponding to the smaller gray scale as the first peak.

[0075] 在步骤S602中,获取该直方图中的第二峰值以及该第二峰值对应的第二灰度值。 [0075] In step S602, acquires the second peak and a second gradation value corresponding to the second peak of the histogram.

[0076] 具体地,以i表示除灰度值firstPeak以外的其他灰度值,distanceToBiggest表示i到firstPeak的距离,也即灰度值差,histogram[i]表示该i对应的直方图值,也即该灰度图像中出现灰度值i的个数,则利用下述公式(1)获取i对应的峰值score[i]: [0076] Specifically, in order to i except showing another gradation value of the gradation values firstPeak, distanceToBiggest i represents the distance firstPeak to, i.e. the gray value differences, histogram [i] represents the value of i corresponding to a histogram, but also i.e., the number of gray value i occurs in the gray scale image, the use of the following equation (1) to obtain i peak corresponding score [i]:

[0077] score [i] = histogram[i] ^distanceToBiggest A 2 (1) [0077] score [i] = histogram [i] ^ distanceToBiggest A 2 (1)

[0078] 因而,利用公式(1)可以获取除firstPeak以外的所有其他灰度值对应的峰值,则其中最大的峰值即为该直方图中的第二峰值,且获取该第二峰值对应的第二灰度值,以secondPeak 表不。 [0078] Thus, using equation (1) can be obtained for all gray scale values corresponding to the other peaks in addition to firstPeak, the largest of which peak is the second peak in the histogram, and obtains the second peak corresponding first two gray values to secondPeak table does not.

[0079] 在步骤S603中,当该第一灰度值大于该第二灰度值时,交换该第一灰度值与该第 [0079] In step S603, when the first gray value greater than the second gray value, switching the first and the second gray value

二灰度值。 Two gray values.

[0080]具体地,比较 firstPeak 和secondPeak,如果firstPeak 大于secondPeak,则交换该两个数据,以确保firstPeak是小数据,也即使得该firstPeak对应的亮度值较小,靠近黑色,而secondPeak靠近白色区域。 [0080] In particular, comparing firstPeak and secondPeak, if firstPeak than secondPeak, then the switch of the two data, in order to ensure firstPeak small data, even with the luminance value corresponding to the firstPeak small, close to black, and white areas near secondPeak .

`[0081] 在步骤S604中,判断该第二灰度值与该第一灰度值的差值是否大于预设的距离值,是,则继续执行步骤S605,否则,执行步骤S606,退出。 `[0081] In step S604, it is determined that the difference between the gray value to the second gray value is greater than a first predetermined distance value, yes, proceed to Step S605, otherwise, to step S606, quit.

[0082] 在本发明实施例中,根据实际试验获取的数据可知,以numBuckets代表该灰度图像的最大灰度值,若secondPeak减firstPeak的值小于等于(numBuckets/16),则说明该灰度图像的对比度效果不好,图像进行二值化后所表示的内容会与真实图像的内容有较大误差,则说明该图像中不存在条码,也即若两个峰值的距离比较接近,小于预设的距离值numBuckets/16,则认为该图像的对比度不够,不存在条码的条件,此时则退出该条码识别过程,否则继续执行步骤S605。 [0082] In the embodiment of the present invention, according to the actual test data obtained found to numBuckets representing the maximum gradation value of the gradation image, if secondPeak impairment firstPeak or less (numBuckets / 16), it indicates that the gradation poor image contrast effect, after the contents of the image represented by the binarization with the contents of the real image has a large error, then the bar code does not exist in the image, i.e., if two peaks are close distance, less than the pre- set distance value numBuckets / 16, it is considered that the image contrast is not enough, there is no bar code conditions, then exit the bar code identification process, otherwise proceed to step S605.

[0083] 在步骤S605中,根据该第二灰度值与该第一灰度值,确定最佳二值化的阈值。 [0083] In step S605, according to the second gray value with the first gray value to determine the optimum binarization threshold.

[0084] 具体地,用j表示在该第二灰度值secondPeak与该第一灰度值firstPeak之间的灰度值,fromFirst代表j与firstPeak的距离,则利用下述公式(2)获取j的波谷值SCORE[j]: [0084] Specifically, with j represents the gray value to the second gray value secondPeak firstPeak between the first gradation value, fromFirst and firstPeak j represents the distance, the use of the following equation (2) to obtain j The trough values SCORE [j]:

Figure CN102521558BD00101

[0086] 因而,利用公式⑴可以获取在该第二灰度值secondPeak与该第一灰度值firstPeak之间的灰度值所对应的波谷值,从而确定其中最大的波谷值所对应的灰度值即为所需要的用于图像二值化的最佳亮度值或者阈值。 [0086] Thus, using the formula ⑴ can obtain the second gradation value secondPeak the first gradation value between the gradation value firstPeak corresponding trough values, to determine where the maximum value of gradation trough The best value is the desired brightness values or thresholds for image binarization.

[0087] 在本发明实施例中,该获取最佳亮度值的方法使得该波谷更靠近白色区域,而不是靠近黑色区域,也即作为二值化的阈值更大,从而使得图像二值化的效果更好,分割更为准确,二值化后的待识别图像更接近于真实的图像所表示的内容,进而使得获取图像中的条码以及条码维数判断的结果更准确。 [0087] In the embodiment of the invention, the method for obtaining optimum luminance value such that the trough closer to the white area, rather than near black areas, i.e. as the binarization threshold value larger, so that the image is binarized better, more accurate segmentation, to be recognized binary image after image is closer to the real content of the representation, and thus makes the acquisition results in an image dimension bar code and bar code to determine more accurate.

[0088] 实施例三: [0088] embodiment of the three:

[0089] 图7示出了本发明第三实施例提供的条码识别方法中对二维条码类型判断的流程,详述如下: [0089] Figure 7 shows a bar code identification method provided by the two-dimensional bar code type judgment process a third embodiment of the present invention, described in detail below:

[0090] 在步骤S701中,当判断该条码的维数为二维时,判断该外接矩形中是否存在与预设的多种条码类型表中的一种类型的条码特征相匹配的特征。 [0090] In step S701, when it is determined that the dimension of a two-dimensional bar code, determines whether there is a plurality of barcode types with a preset table of one type of bar code matches the characteristic features of the circumscribed rectangle in.

[0091] 其中,该预设的多种条码类型表为在识别条码之前预先配置,配置有多种类型的条码及对应的条码特征,以方便在进行条码的识别时使用,且用户可以根据需要随时添加或者其他类型的条码至该类型表中,具有较好的扩展性。 [0091] wherein, the preset multiple barcode types is pre-configured table before identifying the bar code, arranged corresponding to a plurality of types of bar codes and bar code characteristics, for ease of use when performing barcode recognition, and the user may be required Feel free to add other types of bar codes or to the type of table, has good scalability. 该表中各条码类型放置根据使用的条码类型的频率排序,也即配置各条码的检测识别优先级别,使得在当前图像中检测到的条码,其配置的优先级最高时,则在获取该条码的类型后,则不必继续检测后面的类型的条码,从而提高了条码识别速度。 The table placed under each type of bar code symbologies sort of frequency use, namely the configuration of each bar code detection and identification of priority, so that detected in the current image of the bar code, the highest priority is its configuration, you get the bar code After the type is not necessary to continue to detect the type of bar code behind, thereby improving the barcode recognition speed.

[0092] 在步骤S702中,当存在匹配的特征时,获取与该特征对应的条码类型。 [0092] In step S702, when there is a matched features, obtaining the corresponding feature code types.

[0093] 在步骤S703中,根据该条码类型对该条码进行识别,并输出识别结果。 [0093] In step S703, based on the bar code to identify the type of bar code, and outputs the recognition result.

[0094] 在具体实施过程中,当该条码为二维条码时,首先获取该预设的多种条码类型表中的第一种类型(优先级最高)的条码的特征,判断在该外接矩形中是否存在匹配的该特征,是,则该预设的多种条码类型表中的第一种类型(优先级最高)的条码即为该待识别条码的类型,退出识别过程;否,则继续获取该预设的多种条码类型表中的下一种类型条码的特征,继续重复上述步骤,直至存在匹配的特征时退出,或者该条码外接矩形中不存在与预设的多种条码类型表中的所有类型的二维条码特征相匹配的特征时退出。 [0094] In the specific implementation process, when the bar code is a two-dimensional bar code, first get the preset multiple barcode types in the table of the first type (highest priority) barcode features to determine the circumscribed rectangle whether there is a match in the feature, that the preset multiple barcode types in the table of the first type (highest priority) is the barcode type of the barcode to be recognized, exit identification process; otherwise, proceed to Get a variety of features that preset barcode types in the table under a type of bar code, continue to repeat the above steps until exit when there is a match of features, or the bar code does not exist in the external rectangle multiple barcode types with the preset table All types of two-dimensional bar code that matches the characteristic features of exit.

[0095] 具体的,比如,首先获取该预设的多种条码类型表中的第一种类型(优先级最高)的条码为QR码,则该QR码的条码特征为定位探测器符号,则在条码外接矩形4个点的周边小分为区域里或者所有区域里,分别进行定位探测器符号的搜索,若找不到,则搜索另一种二维条码的条码特征。 [0095] Specifically, for example, first get the preset multiple barcode types in the table of the first type (highest priority) for QR code barcode, the barcode feature the QR code to a position detector symbol, Barcode Add-in rectangle surrounding four points divided into small sections, or all sections, respectively, positioning the probe symbol search, if found, the search feature another two-dimensional bar code barcode.

[0096] 另外,也可以将预设的多种条码类型表按照线性条码和矩阵条码进行分类配置,则在区分条码类型的判断过程中,可以层次进行判断,首先判断该外接矩形中是否存在线性条码的特征,是,则进行具体的某一种线性条码特征的判断,否则,该条码为矩阵条码,同样进行具体的某一种矩阵条码特征的判断。 [0096] In addition, you can also preset table multiple barcode types are classified in accordance with the linear bar code and configuration matrix barcode, barcode types in distinguishing the judgment process, you can judge the level, first determine whether the add-linear rectangle barcode features, that is performed to determine the specific characteristics of a certain kind of linear bar codes, otherwise the barcode matrix code, in the same manner to determine the specific characteristics of a particular matrix of the bar code. 在获取条码的类型以后,对该条码按照现有技术进行译码,以识别并输出条码所包含的信息。 After obtaining the type of bar code, the bar code is decoded according to the prior art, in order to identify and output information contained in the bar code.

[0097] 在本发明实施例中,该对二维条码类型判断的方法结合了预设的多种条码类型表以及外接矩形中条码的特征,进行条码类型的判断获取,提高条码识别速度。 [0097] In embodiments of the invention, the two-dimensional bar code type judgment method combines multiple barcode types preset rectangle table and an external bar code feature, determine the type of bar code to obtain improved barcode recognition speed.

[0098] 本领域普通技术人员可以理解实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,所述的程序可以存储于一计算机可读取存储介质中,所述的存储介质,如R0M/RAM、磁盘、光盘等。 [0098] Those of ordinary skill will be appreciated that the above-described embodiments of the method to realize all or part of the steps by a program instructing relevant hardware, the program may be stored in a computer readable storage medium, the said storage medium, such as R0M / RAM, disk, CD-ROM.

[0099] 实施例四: [0099] EXAMPLE IV:

[0100] 图8示出了本发明第四实施例提供的条码识别装置的结构,为了便于说明,仅示出了与本发明实施例相关的部分。 [0100] FIG. 8 shows a structure of a fourth embodiment of the bar code recognition apparatus of the embodiment of the present invention is provided, for ease of illustration, only shows a portion of an embodiment of the present invention is related.

[0101] 该条码识别装置包括扫描起始点获取单元81、外接矩形获取单元82以及维数获取单元83,其中: [0101] The barcode recognition apparatus comprises a scanning starting point acquisition unit 81, and the external dimension of the rectangular acquisition unit 82 acquisition unit 83, wherein:

[0102] 扫描起始点获取单元81,用于获取二值化处理后的待识别条码图像及该图像的多个扫描起始点坐标。 [0102] scanning starting point acquisition unit 81 for acquiring a plurality of scanning starting point coordinates to be recognized barcode image after binarization processing and the image.

[0103] 在本发明实施例中,首先从摄像头获取待识别的彩色图像,并将该彩色图像进行灰度化处理,接着获取灰度化处理后的该图像,计算该图像的直方图,由于条码一般是黑色亮度和白色亮度组成,则在该直方图中将出现靠近黑色亮度区域的波峰和一个靠近白色亮度区域的波峰,因此可以确定两个波峰之间的一个最佳亮度值,对该图像进行分割,若两个峰值的距离比较接近,小于预设的距离值,则认为该图像的对比度不够,不存在条码的条件;两个峰值比较远,则认为存在条码,获取该两个峰值中间的某个最佳亮度值,以该值作为图像二值化的判断阈值,将图像中大于阈值的灰度值设为1,否则为0,从而利用扫描起始点获取单元81获取二值化处理后的待识别图像及该图像的多个扫描起始点坐标,该图像的多个扫描起始点坐标包括所述图像的中心点坐标等。 [0103] In the embodiment of the invention, the first to be recognized from the camera to obtain a color image, the color image and gray-scale processing, and then obtains the image after gradation processing, calculating the histogram of the image, due to Barcode is generally composed of black luminance and white luminance, black luminance region near the peak white brightness of the area and one near the peak of the histogram will appear, so you can determine an optimum brightness value between two peaks, the image segmentation, if the distance between two peaks relatively close distance less than a preset value, the contrast of the image is considered insufficient, the absence of bar code; distant two peaks is considered the existence of the bar code, to obtain the two peaks one of the best middle brightness value to the value as a binary image of the decision threshold, the image is larger than the threshold value is set to a gray, 0 otherwise, to take advantage of scanning starting point acquisition unit 81 to obtain binary a plurality of scanning starting point coordinate the processed image to be recognized and the image coordinates of a plurality of scanning starting point the center coordinate of the image comprises the image and the like. 具体地,首先需要对待识别条码图像进行预设个数的分块,获取分块后每一块图像的中心点,则分块后每一块图像的中心点即为该图像的扫描起始点,则获取了该图像的多个扫描起始点,在实际识别过程中,可以将该待识别条码图像分成四块,获取分块后该四块分块图像的中心点,加上该整幅待识别图像的中心点,可以获取5个扫描起始点。 Specifically, first need to be treated to identify the barcode image into blocks of a preset number, to obtain an image of the center point of each block after block, the block after the image of the center point of each block is the starting point of the scanned image, the acquisition multiple scanning starting point of the image in the actual identification process can identify the barcode image to be divided into four parts, get the center of the four sub-block after block of the image, with the whole image to be recognized the center, you can get five scanning starting point.

[0104] 外接矩形获取单元82,用于按照预设的该多个扫描起始点的顺序,依次从每一个扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取该图像中条码的外接矩形。 [0104] circumscribed rectangle obtaining unit 82, for according to a preset order of the plurality of scanning starting point, sequentially from the beginning of each scanning starting point, up, down, left, and right directions respectively on the image line by line and by-column scanning, bar code image to get the external rectangle.

[0105] 在本发明实施例中,该预设的该多个扫描起始点的顺序可以根据用户需要预先设定,比如可以将该多个扫描起始点所包括的该待识别图像的中心点作为第一扫描起始点,其他按照图像的左上、右上、左下、右下的顺序对剩余的扫描起始点排序。 [0105] In the embodiment of the invention, the order of the plurality of the preset scanning starting point may be set in advance according to user needs, for example, can be the center point of the image to be recognized by including a plurality of scanning as the starting point the starting point of the first scan, the other sort in the order of the image upper left, upper right, lower left, lower right starting point for the rest of the scan. 利用外接矩形获取单元82按照预设的该多个扫描起始点的顺序,依次从每一个扫描起始点开始,对该条码图像进行逐行扫描,确定最小纵坐标和最大纵坐标,再从该扫描起始点开始,对该图像进行逐列扫描,确定最小横坐标和最大横坐标,最后根据获取的最大横坐标、最小横坐标、最大纵坐标、最小纵坐标,可以获取该条码的外接矩形。 Use of external rectangle acquisition unit 82 in accordance with a preset order of the plurality of scanning starting point, turn from the starting point of each scan, the bar code image progressive scan, to determine the minimum and maximum ordinate ordinate, from the scanning starting point, the image is scanned row by row, to determine the minimum and maximum horizontal axis horizontal, and finally get the maximum horizontal axis, the minimum horizontal, vertical axis maximum and minimum vertical axis, you can get the barcode add-rectangle.

[0106] 维数获取单元83用于根据该外接矩形的特征和/或该外接矩形中条码的特征信息,判断获取该条码的维数。 [0106] dimension acquisition unit 83 according to the circumscribed rectangle features and / or the external rectangle barcode feature information to determine the acquisition dimension barcode.

[0107] 该维数获取单元83具体包括: [0107] The dimension of the acquisition unit 83 including:

[0108] 第一判断单元,用于当该外接矩形的长小于预设的长度值,或该外接矩形的高小于预设的高度值时,则确定该条码的维数是一; [0108] The first determination means for, when the length of a circumscribed rectangle of length less than a preset value, or the circumscribed rectangle of height less than a preset high value, it is determined that the dimension is a bar code;

[0109] 第二判断单元,用于当该外接矩形的长小于预设的长度值,且该外接矩形的高小于预设的高度值时,则认为该图像中不存在条码;以及 [0109] The second judgment unit for when the add-long rectangle of length less than the preset value, and the circumscribed rectangle of height less than the preset value high, it is considered that the image does not exist in the bar code; and

[0110] 第三判断单元,用于当该外接矩形的长大于预设的长度值,且该外接矩形的高大于预设的高度值时,则根据该外接矩形中条码的条空宽度信息,进一步确定该条码的维数 [0110] The third judgment unit, is used when the external rectangle longer than a preset length value, and the circumscribed rectangle tall in height preset value, according to the width of the strip empty rectangle external barcode information, further define the dimension of the bar code

是一或者二。 Is one or two.

[0111] 在本发明实施例中,该外接矩形的特征包外接矩形的长、高等,该外接矩形的长是指外接矩形在X方向上的长度或者是Xmax与Xmin之间的距离,外接矩形的高是指外接矩形在Y方向上的长度Ymax与Ymin之间的距离。 [0111] In the embodiment of the invention, the circumscribed rectangle circumscribing rectangle length feature package, higher, the add-long rectangle circumscribed rectangle length is the distance in the X direction or between Xmax and Xmin, circumscribed rectangle The height is the distance in the Y direction circumscribed rectangle of length between Ymax and Ymin. 在获取条码的外接矩形后,若该外接矩形的长(Xmax与Xmin之间的距离)小于预设的长度值,或该外接矩形的高(Ymax与Ymin之间的距离)小于预设的高度值时,则认为该条码不是二维条码,确定该条码的维数是一;当该外接矩形的长小于预设的长度值,且该外接矩形的高小于预设的高度值时,则认为不存在条码;当该外接矩形的长小于预设的长度值,而该外接矩形的高大于预设的高度值时,则认为该一维条码为竖直型条码,如图3所示;当该外接矩形的高小于预设的高度值,而该外接矩形的长大于预设的长度值时,则认为该一维条码为水平型条码,而不是二维条码;若该外接矩形的长大于预设的长度值,且该外接矩形的高大于预设的高度值时,则需要进一步结合该条码的特征信息来确定该条码的维数,该条码的特征信息是指该条码的条空宽度信息,包括条空宽度值,条空分布信息等,该条空分布信息是指任意2行或者多行的条空分布是否相同等。 After obtaining external barcode rectangle, if the external rectangle length (distance between Xmax and Xmin) is less than a preset length value, or the circumscribed rectangle height (distance between Ymax and Ymin) is less than a preset height When the value is not a two-dimensional bar code considers the barcode to determine the dimension of the bar code is one; when the external rectangle length less than the preset value of the length and height of the circumscribed rectangle of height less than the preset value, it is considered there is no bar code; when the external rectangle length of less than a preset length value, and the circumscribed rectangle tall in height preset value, is considered as a vertical one-dimensional bar code bar code, shown in Figure 3; when The external rectangle height is less than the preset height, while the length of the value of the external rectangle grew up in default, then consider the one-dimensional bar horizontal bar code, rather than the two-dimensional bar code; if grown in the circumscribed rectangle preset length value, and the circumscribed rectangle tall in height preset value, the need for further information on the binding characteristics of the bar code to determine the dimensions of the bar code, the bar code feature information refers to the width of the barcode strip empty information, including the strip width value empty, empty pieces of information, such as distribution, air distribution information which refers to any two line or multiple lines of air distribution strips are the same and so on.

[0112] 具体地,若该外接矩形的长大于预设的长度值,且该外接矩形的高大于预设的高度值时,可以随机多次垂直或者水平扫描该外接矩形中任意2列或者2行条码,若该2列条码中存在相同的条空宽度信息或者该2行条码中存在相同的条空宽度信息,则认为该条码为一维条码,如图4a所示,且若各行条空宽度基本上相等,则认为条码是水平的;若各列条空宽度基本上相等,则认为条码是垂直的,否则认为该条码为二维条码,如图4b所示,该扫描的次数可以根据用户需要设定,扫描次数越多,数据的可靠性越稳定,判断结果越准确。 [0112] Specifically, if the external rectangle grew at a preset length value, and the circumscribed rectangle tall in height preset value, you can randomly repeatedly scanning the external vertical or horizontal rectangle any 2 or 2 Barcode line, if there is the same strip width information that two empty barcode or the presence of two identical pieces empty line width information bar code, bar code is considered as one-dimensional bar code, shown in Figure 4a, and if each row strip empty width substantially equal, the bar code is considered level; if each column is substantially equal to the space width bar, the bar code is vertical is considered it is understood that the bar code is a two-dimensional bar code, shown in Figure 4b, the number of the scan can the user needs to set, the more the number of scans, the more stable the reliability of the data, the more accurate the determination result.

[0113] 另外,在确定该条码为一维条码后,根据该2列或者2行条码中相同的条空宽度的条空线的方向,若该条空线的方向为垂直或者偏向垂直方向,则在以后条码种类判定时,可以只进行垂直扫描,具体可以隔列进行从上到下与从下到上垂直交替扫描,就可以确定该条码的类型,同样,若该条空线的方向为水平或者偏向水平方向,则在以后条码种类判定时,可以只进行水平扫描,具体可以隔行进行从左到右与从右到左水平交替扫描,从而不管条码顺着放,倒着放,旋转着放,都可以对其类型进行识别,使得该确定该一维条码的类型的方法具有较强的适应性,且能够提高条码类型的识别速度。 [0113] Further, in determining the one-dimensional bar code for bar code, the bar-space line depending on the direction of the two rows or two identical bar code empty strip width, if the direction of the air line which is perpendicular or vertical deflection, then later when determining the type of bar code that can be scanned only vertical concrete columns can be separated from top to bottom with the type of the bar code from the bottom to the vertical scanning alternately, you can determine the same, if the direction of the section line is empty horizontally or biased horizontally, then later when determining the type of bar code that can be scanned horizontally only, specifically interlaced from left to right and right to left, alternating horizontal scan, so regardless of the barcode put down, put backwards, spinning put, you can identify its type, so that the one-dimensional bar codes that determine the type of method has strong adaptability, and can improve recognition speed barcode types.

[0114] 在本发明实施例中,该条码识别装置支持一幅图像中多个条码的识别,当该图像中存在多个条码时,按照检测到该多个条码的顺序,判断获取该多个条码的维数,具体地,首先需要对待识别条码图像进行预设个数的分块,比如分成五块,获取分块后每一块图像的中心点,则在对待识别条码图像进行二值化处理后,从每一块图像的中心点开始,也即从扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取该图像中每个条码的外接矩形,接着逐个获取该每个条码的外接矩形的特征和/或该外接矩形中条码的特征信息,根据每个条码的外接矩形的特征和/或该外接矩形中条码的特征信息判断获取该条码的维数,由于在识别一幅图像所包含的多个条码时,预先对条码图像进行预设个数的分块,再获取分块后每一块图像的中心点或者扫描起始点,可以保证所获取的扫描起始点落在该多个条码中,从而可以进行下一步的条码维数识别,也使得该方法能够适应多种条码的应用场景,具有较强的自适应性。 [0114] In the embodiment of the invention, the barcode recognition apparatus capable of recognizing an image of a plurality of bar code, the bar code when a plurality of images, in the order of the plurality of bar code is detected, it is determined to obtain the plurality of dimension bar code, specifically, first need to be treated to identify the barcode image into blocks of a preset number, for example divided into five, the center point of each piece of the image after acquisition block, then treat identification barcode image binarization processing After starting from the center point of each block of the image, i.e. starting from the scanning starting point, up, down, left, and right directions, respectively, and the image line by line-by-column scanning, each bar code to obtain the image of the external rectangle, then one by one to get the bar code of each rectangle external features and / or the external rectangle barcode feature information according to each barcode circumscribed rectangle features and / or the external rectangle barcode feature to get the bar code information to determine dimensions, due to multiple barcode recognition of an image contains, in advance of the bar code image into blocks preset number, and then get the center or scanning the block after the starting point of each piece of the image, you can ensure that the scanning starting point to obtain the fall of the plurality of bar code, which can make the next dimension barcode recognition, but also makes the method can adapt to a variety of bar code application scenarios, with strong adaptability.

[0115] 本发明实施例解决了在对一幅图像进行条码自动识别时,通过该扫描起始点获取单元81获取二值化处理后的待识别图像以及该图像的扫描起始点坐标;外接矩形获取单元82按照预设的该多个扫描起始点的顺序,依次从每一个扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取该图像中条码的外接矩形实现了在未知条码的维数情况下;维数获取单元83根据条码的特征获取到的外接矩形及其中的条码特征信息等,获取了条码的维数,从而可以进一步识别该维数的条码的种类和信息等,且该识别方法支持多种扫描方式,也提高了条码的识别性能。 [0115] The present invention solves the embodiment of an image when the automatic identification bar code, scanning start point by the acquisition unit 81 to obtain the image to be recognized after the binarization processing and the scanning starting point coordinates of the image; obtaining circumscribed rectangles unit 82 according to a preset order of the plurality of scanning starting point, sequentially from each of the scan starting point, up, down, left, and right directions, respectively, the image is scanned line by line and column by column, to obtain the image Barcode circumscribed rectangle achieved in the case of unknown dimension barcode; dimension acquisition unit 83 acquired according to the characteristics of the bar code and the bar code circumscribed rectangle feature information, etc., to obtain the dimensions of the bar code, which can further identify the dimension and several barcode types and information, and the identification method to support multiple scan mode, also improved barcode recognition performance.

[0116] 该条码识别装置还包括: [0116] The barcode recognition apparatus further comprises:

[0117] 匹配单元,用于当判断该条码的维数为一维时,根据该外接矩形中条码的特征信息,或者对该图像进行预处理后获取的条空信息,判断预设的多种条码类型表中是否存在匹配的条空信息;以及 [0117] The matching unit for, when the dimension is determined when a one-dimensional bar code, according to the characteristic information of the circumscribed rectangle of the bar code, or bar-space information of the image obtained after the pretreatment, a variety of pre-determination matches the empty bar code type information exists in the table; and

[0118] —维条码类型获取单元,用于当存在匹配的条空信息时,获取与该匹配的条空信息对应的条码类型。 [0118] - dimensional bar code type acquisition unit for when there is a matching strip empty information, access to information and the corresponding empty bar code types that match.

[0119] 其中,该预设的多种条码类型表为在识别条码之前预先配置,配置有多种类型的条码及对应的条码特征,以方便在进行条码的识别时使用,且用户可以根据需要随时添加或者其他类型的条码至该类型表中,具有较好的扩展性。 [0119] wherein, the preset multiple barcode types is pre-configured table before identifying the bar code, arranged corresponding to a plurality of types of bar codes and bar code characteristics, for ease of use when performing barcode recognition, and the user may be required Feel free to add other types of bar codes or to the type of table, has good scalability. 该表中各条码类型放置根据使用的条码类型的频率排序,也即配置各条码的检测识别优先级别,使得在当前图像中检测到的条码,其配置的优先级最高时,则在获取该条码的类型后,则不必继续检测后面的类型的条码,从而提高了条码识别速度。 The table placed under each type of bar code symbologies sort of frequency use, namely the configuration of each bar code detection and identification of priority, so that detected in the current image of the bar code, the highest priority is its configuration, you get the bar code After the type is not necessary to continue to detect the type of bar code behind, thereby improving the barcode recognition speed.

[0120] 在本发明实施例中,在确定该条码为一维条码后,采用1维图像边缘处理方法处理该条码图像及自动去噪功能等预处理操作,以更精确的获取该一维条码的条空信息,该条空信息为通过对该一维条码按照条空线的方向进行垂直或者水平扫描等获取的多行条空的宽度信息,结合该条空信息与预设的多种条码类型表,得到条码的类型结果,使得条码识别精度得到提高,误识率得到降低。 [0120] In the embodiment of the present invention, in determining the one-dimensional bar code for bar code, the use of one-dimensional image processing method for processing an edge of the bar code image and automatic denoising function preprocessing operations, to obtain the more accurate one-dimensional bar code multi-line strip bar width information empty space information, which information is through the empty one-dimensional bar code scanning and other vertical or horizontal line in the direction of acquiring empty bar, combined with information which empty preset multiple barcode type table, get the type of results barcode makes barcode recognition accuracy is improved, the error rate is reduced.

[0121] 该条码识别装置还包括: [0121] The barcode recognition apparatus further comprises:

[0122] 判断单元,用于当判断该条码的维数为二维时,判断该外接矩形中是否存在与预设的多种条码类型表中的一种类型的条码特征相匹配的特征;以及 [0122] judgment means for judging when the number of dimensions of the two-dimensional bar code, it is determined whether there is a preset bar code feature multiple barcode types in the table that matches the type of the external features of the rectangle; and

[0123] 二维条码类型获取单元,用于当存在匹配的特征时,获取与该特征对应的条码类型。 [0123] a two-dimensional bar code type acquisition unit, when there is a match for the features, access to the features of the corresponding bar code types.

[0124] 该条码识别装置还包括: [0124] The barcode recognition apparatus further comprises:

[0125] 输出单元,用于根据该条码类型对该条码进行识别,并输出识别结果。 [0125] output unit for identifying the bar code based on the bar code type, and outputs the recognition result.

[0126] 在本发明实施例中,当该条码为二维条码时,首先获取该预设的多种条码类型表中的第一种类型(优先级最高)的条码的特征,判断在该外接矩形中是否存在匹配的该特征,是,则该预设的多种条码类型表中的第一种类型(优先级最高)的条码即为该待识别条码的类型,退出识别过程;否,则继续获取该预设的多种条码类型表中的下一种类型条码的特征,继续重复上述步骤,直至存在匹配的特征时退出,或者该条码外接矩形中不存在与预设的多种条码类型表中的所有类型的二维条码特征相匹配的特征时退出。 [0126] In embodiments of the invention, when the bar code is a two-dimensional bar code, first get the preset multiple barcode types in the table of the first type (highest priority) barcode features to determine the external if a match exists in the rectangular feature that the preset multiple barcode types in the table of the first type (highest priority) barcode is the identification of the type of bar code to be exit identification process; NO, continued access to the preset multiple barcode types in the table under a type of bar code feature, continue to repeat the above steps until exit when there is a match of features, or the bar code does not exist in a variety of barcode types with the preset external rectangle table features all types of two-dimensional bar code that matches the characteristics of exit.

[0127] 本发明实施例提供的该对二维条码类型判断的方法,结合了预设的多种条码类型表以及外接矩形中条码的特征,进行条码类型的判断获取,提高条码识别速度。 The two-dimensional bar code type determination method according to an embodiment [0127] The present invention combines a preset barcode types, and external rectangle table features a variety of bar code, bar code type of judgment to obtain improved barcode recognition speed.

[0128] 本发明实施例通过获取二值化处理后的待识别条码图像以及该图像的扫描起始点坐标,按照预设的该多个扫描起始点的顺序,依次从每一个扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取该图像中条码的外接矩形,根据该外接矩形的特征和/或该外接矩形中条码的特征信息,判断获取该条码的维数,解决了由于现有技术没有实现对未知维数的条码进行识别判断,且识别性能不高的问题,达到了对未知维数的条码进行识别判断及对一幅图像所包含的多个条码的识别判断的目的,且提高了识别性能。 [0128] Embodiments of the present invention to be recognized by the bar code image acquisition and the scanning start point coordinates of the image after binarization processing according to a preset order of the plurality of scanning starting point, sequentially from the starting point of each scan, up, down, left, and right directions respectively by the image line by line and column scanning, bar code image to get the bounding box rectangle under the external features and / or the external rectangle barcode feature information to determine Get the dimensionality of the bar code, due to the prior art does not solve the unknown dimension to achieve bar code recognition judgment, and the recognition performance is not high, to the unknown dimension barcode recognition judgment and on an image of the The purpose of a plurality of barcode recognition judgment contained, and improves the recognition performance.

[0129] 以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。 [0129] The above description is only preferred embodiments of the present invention, it is not intended to limit the present invention, any modification within the spirit and principles of the present invention made, equivalent replacement and improvement, should be included in the present within the scope of the invention.

Citations de brevets
Brevet cité Date de dépôt Date de publication Déposant Titre
CN101059834A31 mai 200724 oct. 2007中国农业大学QR two-dimensional bar code recognition method based on pickup head for chatting
CN101882201A1 juin 201010 nov. 2010福建新大陆电脑股份有限公司Barcode decoding chip and method
CN101882206A1 juin 201010 nov. 2010福建新大陆电脑股份有限公司Decoding chip of RSS (Really Simple Syndication) bar code
CN102236788A20 avr. 20109 nov. 2011荣科科技股份有限公司Kilowatt-hour meter image automatic identification method
US541835716 juin 199323 mai 1995Matsushita Electric Industrial Co., Ltd.Bar-code reader permitting selective use of a whole or a part of an image sensor
US2010163632 Titre non disponible
Classifications
Classification internationaleG06K7/10
Événements juridiques
DateCodeÉvénementDescription
27 juin 2012C06Publication
5 sept. 2012C10Request of examination as to substance
2 avr. 2014C14Granted