Connect public, paid and private patent data with Google Patents Public Datasets

Bar code identifying method and device

Download PDF

Info

Publication number
CN102521558B
CN102521558B CN 201110367610 CN201110367610A CN102521558B CN 102521558 B CN102521558 B CN 102521558B CN 201110367610 CN201110367610 CN 201110367610 CN 201110367610 A CN201110367610 A CN 201110367610A CN 102521558 B CN102521558 B CN 102521558B
Authority
CN
Grant status
Grant
Patent type
Prior art keywords
bar
code
identifying
method
device
Prior art date
Application number
CN 201110367610
Other languages
Chinese (zh)
Other versions
CN102521558A (en )
Inventor
李佐广
李运秀
梁日雄
李耀华
彭青峰
于兆和
张俊
Original Assignee
深圳市宝捷信科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Grant date

Links

Abstract

本发明适用于条码识别技术领域,提供了一种条码识别方法及装置,所述方法包括下述步骤:获取二值化处理后的待识别条码图像及该图像的多个扫描起始点坐标;按照预设的该多个扫描起始点的顺序,依次从每一个扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取所述图像中条码的外接矩形;根据所述外接矩形的特征和/或所述外接矩形中条码的特征信息,判断获取所述条码的维数。 The present invention is applicable to bar code identification technology, 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 to be recognized in the image and bar code images; according the predetermined sequence of a plurality of scanning starting point, sequentially from the beginning of each scanning starting point, up, down, left, and right directions of the image row-by-column scan, the acquired barcode image circumscribed rectangle; according to a feature of the circumscribed rectangle and / or feature information of the bar code in the circumscribed rectangle, the bar code is determined to obtain the dimension. 本发明实现了对未知维数的条码进行识别判断的目的,且提高了识别性能。 The present invention achieves the object of unknown dimensions of the bar code identification number determination, and to improve the recognition performance.

Description

—种条码识别方法及装置 - kind of bar code identification 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 technique

[0002] 条码技术是在信息技术和计算机技术基础上发展起来的一门集编码、印刷、识别、数据采集和处理于一身的新兴技术。 [0002] Bar code technology is a new technology developed in the computer art and technology based on a set of encoded information, print, identification, data acquisition and processing in one. 由于其识别快速、准确、可靠以及成本低等优点,被广泛应用于商业、图书管理、仓库、邮电、交通和工业控制等领域,并且势必在逐渐兴起的“物联网”应用中发挥重大的作用。 Because of its recognition fast, accurate, reliable and low cost, it is widely used in commercial, library management, storage, post and 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] Common electronic bar code is one-dimensional bar coding standards internationally be widely employed are EAN-8, EAN-13, UPC-A and UPC-E, and other coding standards, which have been rather broadly applied However, it contains a relatively small amount of information, its use is limited to digital, it 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 electronic bar code, resulting in a two-dimensional bar Standards and Technology, a common international standard two-dimensional bar code has roFAU'Data Matrix, MaxiCode and QR Code and other kinds of standards, in addition to the numbers and symbols, some countries may be added coding language set. 目前,世界上约有225种以上的一维条形码,每种一维条码都有自己的一套编码规格,以规定每个字母(可能是文字或数字)是由几个线条(Bar)及几个空白(Space)组成,以及字母的排列。 Currently, around the world more than 225 kinds of one-dimensional bar codes, each one-dimensional bar code has its own set of 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 letters. 一般较流行的一维条码有39码,EAN码,UPC码,128码,以及专门用于书刊管理的ISBN, ISSN等。 Generally more popular one-dimensional bar code 39, EAN code, UPC code, 128 yards, and books dedicated to management ISBN, ISSN like.

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

发明内容 SUMMARY

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

[0006] 本发明实施例是这样实现的,一种条码识别方法,所述方法包括下述步骤: [0006] Example embodiments of the present invention is implemented as a bar code identification, the method comprising the steps of:

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

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

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

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

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

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

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

[0014] 本发明实施例通过获取二值化处理后的待识别条码图像及该图像的多个扫描起始点坐标,按照预设的该多个扫描起始点的顺序,依次从每一个扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取该图像中条码的外接矩形;根据该外接矩形的特征和/或该外接矩形中条码的特征信息,判断获取该条码的维数,解决了由于现有技术没有实现对未知维数的条码进行识别判断,且识别性能不高的问题,从而能够自动识别条码维数,识别性能也得到提高。 Example [0014] The present invention, by acquiring a plurality of scanning starting point coordinates after the binarization processing and the image to be recognized bar code image, in the order of the scanning starting point of a predetermined plurality of sequentially scanning from a start point of each start up, down, left, and right directions of the image line by line and column by column scanning, obtaining the circumscribed rectangle of the bar code image; information based on characteristics of the circumscribed rectangle and / or the external rectangle barcodes determining the dimension of obtaining bar code, since the prior art does not solve achieved barcode identification number of unknown dimension is determined, 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 chart for implementing the barcode recognition method according to a first embodiment of the present invention;

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

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

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

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

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

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

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

具体实施方式 detailed description

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

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

[0025] 本发明实施例提供了一种条码识别方法,所述方法包括下述步骤: [0025] Example provides a barcode recognition method of the present invention, the method comprising the steps of:

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

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

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

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

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

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

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

[0034] 以下结合具体实施例对本发明的具体实现进行详细描述: [0034] The following specific embodiments with reference to specific embodiments of the present invention is implemented will be described in detail:

[0035] 一维条码又称线形条码,是由平行排列的多个“条”和“空”单元组成,条码信息依靠条和空的不同宽度和位置来表达。 [0035] The one-dimensional bar known as a linear bar code, are arranged in parallel 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 a particular geometric black and white according to certain rules in the direction of the two-dimensional distribution, whose information can be expressed in two dimensions. 二维条码可以分为行列式二维条码和矩阵式二维条码。 Two-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 a multi-line stub by stacking dimensional bar code, two-dimensional bar comprises representative determinant PDF417, Code49, Code 16k and the like. 行列式二维条码信息表示方法与一维条码类似,也是依靠条和空的不同宽度和位置来表达。 Determinant dimensional bar code information with a representation similar dimensional bar code, the bars and spaces is relying different widths and positions expressed. 矩阵式二维条码是由按预定规则分布于矩阵中的黑、白模块组成,代表性的矩阵式二维条码包括QR码、Data Matrix码、Maxi码、Aztec码、汉信码等。 Matrix-dimensional bar code is distributed in the matrix according to a predetermined rule black and white modules, the representative matrix-dimensional bar code including a QR code, Data Matrix code, Maxi Code, Aztec codes, Hamming codes letters.

[0036] 实施例一: [0036] Example a:

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

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

[0039] 在具体实施过程中,首先从摄像头获取待识别的彩色条码图像,并将该彩色条码图像进行灰度化处理,接着获取灰度化处理后的该图像,计算该图像的直方图,由于条码一般是黑色亮度和白色亮度组成,则在该直方图中将出现靠近黑色亮度区域的波峰和一个靠近白色亮度区域的波峰,因此可以确定两个波峰之间的一个最佳亮度值,对该图像进行分害I],若两个峰值的距离比较接近,小于预设的距离值,则认为该图像的对比度不够,不存在条码的条件;两个峰值比较远,则认为存在条码,获取该两个峰值中间的某个最佳亮度值,以该值作为图像二值化的判断阈值,将图像中大于阈值的灰度值设为1,否则为0,从而获取二值化处理后的待识别图像,进而可以获取该图像的多个扫描起始点坐标,该图像的多个扫描起始点坐标包括所述图像的中心点坐 [0039] In a specific implementation, the first obtains the color barcode image from the camera to be recognized, and the gray-scale color bar image processing, and then obtains the image after gradation processing, calculates a histogram of the image, Since the bar code is generally composed of white luminance and black luminance, the peak area near the black luminance and the white luminance near a peak appears in the region in the histogram, it is possible to determine an optimum luminance value between two peaks of the image is divided into the I harm], if two peaks close distance, the distance is less than the predetermined value, the contrast of the image is considered insufficient, the absence of bar code; relatively far two peaks, the presence of the bar code that acquires the two intermediate value of the peak of a luminance optimum to this value as the determination image binarization threshold value, the gray scale image is larger than the threshold value is set to 1, otherwise to 0, so as to obtain the binarization processing image 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 of the image coordinates of the image center point seat comprising 等,例如以(Xe, Yc)表示该中心点的坐标。 And the like, for example, (Xe, Yc) represents the coordinates of the center point. 具体地,首先需要对待识别条码图像进行预设个数的分块,获取分块后每一块图像的中心点,则分块后每一块图像的中心点即为该图像的扫描起始点,则获取了该图像的多个扫描起始点,在实际识别过程中,可以将该待识别条码图像分成四块,获取分块后该四块分块图像的中心点,加上该整幅待识别图像的中心点,可以获取5个扫描起始点。 Specifically, first need to be recognized barcode image into blocks of a predetermined number, obtaining a center point of each image into blocks, the center point of each block after an image is scanned is the start point of the image, the acquisition a plurality of scan start point of the image, in the actual recognition process, the barcode may identify the image to be divided into four, the four center point acquired image block after block, together with the entire image to be recognized central point, you can get five scanning starting point.

[0040] 具体地,获取该作为图像二值化的最佳亮度值或者阈值的具体过程如下实施例二所述,但不限于该实施例的获取过程,在此不再赘述。 [0040] Specifically, to obtain the binarized image as a specific process best luminance value or a threshold value of the two following examples, but is not limited to the acquisition process of the embodiment, which is not repeated herein.

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

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

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

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

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

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

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

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

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

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

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

[0052] 步骤S224中,根据获取的最大横坐标、最小横坐标、最大纵坐标、最小纵坐标,获取并保存该条码的外接矩形。 [0052] In step S224, the maximum abscissa acquired minimum abscissa, ordinate maximum, minimum ordinate, obtains and stores 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) of the four vertices of a quadrilateral, determining the circumscribed rectangle.

[0054] 步骤S225中,判断该扫描起始点是否为该多个扫描起始点的最后一个扫描起始点,是,则执行步骤S227,退出,否,则执行步骤S226。 [0054] In step S225, it is determined whether the scanning starting point is the last scanning starting point a plurality of scanning starting point, that is executed step S227, the exits, otherwise, perform step S226.

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

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

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

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

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

[0060] 另外,在确定该条码为一维条码后,根据该2列或者2行条码中相同的条空宽度的条空线的方向,若该条空线的方向为垂直或者偏向垂直方向,则在以后条码种类判定时,可以只进行垂直扫描,具体可以隔列进行从上到下与从下到上垂直交替扫描,就可以确定该条码的类型,同样,若该条空线的方向为水平或者偏向水平方向,则在以后条码种类判定时,可以只进行水平扫描,具体可以隔行进行从左到右与从右到左水平交替扫描,从而不管条码顺着放,倒着放,旋转着放,都可以对其类型进行识别,使得该确定该一维条码的类型的方法具有较强的适应性,且能够提高条码类型的识别速度。 [0060] Further, after determining that the one-dimensional bar code is the bar code, in accordance with the direction of the bar-space lines or two identical bar-space width bar code 2 rows, if the null direction of the article is a vertical line or a vertical deflection direction, after the bar code at the time of determining the type, only the vertical scanning may be performed, specifically the type of separator column from top to bottom of the bar code from the vertical to the alternate scanning can be determined, similarly, if the direction of the strip line is empty horizontal direction or a horizontal deflection, at the time of determination after the symbology, the horizontal scanning may be performed only, from left to right and specifically interlaced alternating horizontal scanning from right to left, so that regardless of the barcode put down, put backwards, rotating release, their type can be identified, so that the type of the one-dimensional bar code determining process has strong adaptability, and can improve recognition rate of the bar code type.

[0061 ] 在本发明实施例中,该条码识别方法支持一幅图像中多个条码的识别,当该图像中存在多个条码时,按照检测到该多个条码的顺序,判断获取该多个条码的维数,具体地,首先需要对待识别条码图像进行预设个数的分块,比如分成五块,获取分块后每一块图像的中心点,则在对待识别条码图像进行二值化处理后,从每一块图像的中心点开始,也即从扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取该图像中每个条码的外接矩形,接着逐个获取该每个条码的外接矩形的特征和/或该外接矩形中条码的特征信息,根据每个条码的外接矩形的特征和/或该外接矩形中条码的特征信息判断获取该条码的维数,由于在识别一幅图像所包含的多个条码时,预先对条码图像进行预设个数的分块,再获取分块后每一块图像的中 [0061] In an embodiment of the present invention, the barcode recognition method capable of recognizing an image of a plurality of bar codes, the bar codes when a plurality of images, the order of the plurality of detected bar code, determining the plurality of acquired dimension bar code, in particular, need to be recognized barcode image is first divided into blocks of a predetermined number, for example divided into five, a center point of each block of the image after acquisition, the barcode to be recognized in the binarized image processing after a start from the center point of each image, i.e., starting from the scanning starting point, up, down, left, and right directions of the image row-by-column scanning, each of the image acquiring external barcode rectangle, then one by obtaining a characteristic of the circumscribed rectangle of each barcode and / or feature information of the external rectangle barcode, the information is determined based on characteristics of the circumscribed rectangle for each barcode and / or add the rectangle to obtain the barcode bar code dimension, since a plurality of bar code identification included in the image, in advance of the barcode image into blocks of a predetermined number, and then acquiring an image of each block of 心点或者扫描起始点,可以保证所获取的扫描起始点落在该多个条码中,从而可以进行下一步的条码维数识别,也使得该方法能够适应多种条码的应用场景,具有较强的自适应性。 Heart point or scanning starting point, the starting point can guarantee the acquired scan falling within the plurality of bar code, the bar code can be performed to identify the next dimension, so that the method can be adapted to a variety of application scenarios barcode, a strong adaptability.

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

[0063] 在S501中,当判断该条码的维数为一维时,根据该外接矩形中条码的特征信息,或者对该图像进行预处理后获取的条空信息,判断预设的多种条码类型表中是否存在匹配的条空信息。 Bar-space information [0063] In S501, when determining that the dimension of one-dimensional bar code based on the characteristic information of the bar code in the circumscribed rectangle, or the pre-acquired image, determining a plurality of predetermined bar code whether there is a match type bar-space information table.

[0064] 具体地,在确定该条码为一维条码后,根据已经获取的该外接矩形中条码的特征信息,可以判断预设的多种条码类型表中是否存在匹配的条空信息,如无法判断则在确定该条码为一维条码后,也可以采用I维图像边缘处理方法处理该条码图像及自动去噪功能等预处理操作,以更精确的获取该一维条码的条空信息,该条空信息为通过对该一维条码按照条空线的方向进行垂直或者水平扫描等获取的多行条空的特征信息,也即进一步获取预处理后该条码的条空宽度信息及条空线的方向。 [0064] Specifically, after determining that the one-dimensional bar code is the bar code, the feature information of the circumscribed rectangle of the bar code has been acquired, it can be determined whether the presence of the bar-space information matches a predetermined plurality of bar code type table, not as after determination in determining the one-dimensional bar barcode may be adopted edge-dimensional image processing method to process the I and automatic bar code image denoising function pretreatment operation, to obtain more accurate information of the one-dimensional bar-space bar code, the a bar-space-dimensional bar code information to the vertical or horizontal scan lines in the direction of the empty bar by acquiring a plurality of rows of empty feature information pieces, i.e. after pretreatment further acquire the barcode bar width information and section empty empty lines direction.

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

[0066] 在S502中,当存在匹配的条空信息时,获取与该匹配的条空信息对应的条码类型。 [0066] In S502, when there is an empty pieces of information match, and obtaining the type of bar code information corresponding to the bar-space matching.

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

[0068] 在具体实施过程中,假如当前图像的条码是eanl3,则进行eanl3类型的条码识另IJ,图3为eanl3类型条码图像。 [0068] In a specific implementation, if the current is eanl3 barcode image, the bar code for identifying other types of eanl3 IJ, FIG. 3 is a eanl3 type barcode image. 根据该条码多行的条空宽度信息确定最终的类型结果,并将该结果输出。 Determining a final result of the type of article in accordance with the width of the empty multi-line bar code information, and outputs the result.

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

[0070] 该条码识别方法还包括对二维条码的类型判断步骤,其具体实现过程如下实施例三所述,在此不再赘述。 [0070] The barcode recognition method further comprises the step of determining the type of a two-dimensional bar code, a specific implementation process according to a third embodiment described below, are not repeated here.

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

[0072] 图6示出了本发明第二实施例提供的条码识别方法中最佳亮度值的获取流程,具体为对待识别的彩色图像进行灰度化处理,获取该灰度图像的直方图后,对该图像进行二值化处理(二值为0、1),获取作为二值化的最佳亮度值或者阈值的过程,但不限于该实施例的获取过程,详述如下: After [0072] FIG 6 shows a procedure of acquiring the barcode recognition method provided the best luminance value of a second embodiment of the present invention, particularly for gradation processing a color image to be identified and acquires a histogram of the gray-scale image , the image binarization process (two values ​​are 0), a process of obtaining the optimum binarized luminance value or a threshold value, but are not limited to the acquisition process of the embodiment, described in detail as follows:

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

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

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

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

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

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

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

二灰度值。 Two gray value.

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

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

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

[0083] 在步骤S605中,根据该第二灰度值与该第一灰度值,确定最佳二值化的阈值。 [0083] In step S605, according to the second gradation value and 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 denotes the gray value between the second gradation value secondPeak firstPeak first gradation value and, fromFirst firstPeak and j represents the distance, the use of the following equation (2) Get j the valley value SCORE [j]:

Figure CN102521558BD00101

[0086] 因而,利用公式⑴可以获取在该第二灰度值secondPeak与该第一灰度值firstPeak之间的灰度值所对应的波谷值,从而确定其中最大的波谷值所对应的灰度值即为所需要的用于图像二值化的最佳亮度值或者阈值。 [0086] Thus, using Equation ⑴ valley can be acquired value of the second gradation value between the gradation value secondPeak firstPeak the first gradation corresponding to the value, wherein the maximum gradation is determined so that the value corresponding to the valley the optimum value is the luminance value or the threshold required for image binarization.

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

[0088] 实施例三: [0088] Example III:

[0089] 图7示出了本发明第三实施例提供的条码识别方法中对二维条码类型判断的流程,详述如下: [0089] FIG. 7 illustrates a bar code identification method provided in the two-dimensional bar code type determination process of the 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 predetermined characteristics and features of one type of bar code symbologies in the table matches the external rectangle.

[0091] 其中,该预设的多种条码类型表为在识别条码之前预先配置,配置有多种类型的条码及对应的条码特征,以方便在进行条码的识别时使用,且用户可以根据需要随时添加或者其他类型的条码至该类型表中,具有较好的扩展性。 [0091] wherein the plurality of predetermined types of bar code is pre-configured table before identifying the bar code, are arranged a plurality of types of bar code and bar code corresponding to features to facilitate the use of bar codes identifying is performed, and the user may be required added at any time or other type of bar code type to the table, with good scalability. 该表中各条码类型放置根据使用的条码类型的频率排序,也即配置各条码的检测识别优先级别,使得在当前图像中检测到的条码,其配置的优先级最高时,则在获取该条码的类型后,则不必继续检测后面的类型的条码,从而提高了条码识别速度。 The table for each type of bar code is placed according to the frequency sorting bar code type used, i.e. configuration detection identify the priority level of each of the bar code, so that the bar code detected in the current image, the highest configured priority, then acquires the barcode after the type is not necessary to continue to detect the type of the back bar code, thereby improving the barcode recognition speed.

[0092] 在步骤S702中,当存在匹配的特征时,获取与该特征对应的条码类型。 [0092] In step S702, when there is a feature match, acquires the barcode type corresponding to the feature.

[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 a specific implementation, a two-dimensional bar code when the bar code, the bar code acquired first feature of a first type (highest priority) of the predetermined plurality of barcode types in the table, it is determined that the external rectangle in the presence of the feature matching is, the plurality of predetermined types of bar code type of the first table (highest priority) is the barcode type of the barcode to be recognized, recognition process exits; No, continue Get the type of bar code wherein the predetermined plurality of barcode types in the table, continue repeating the above steps until the exit feature when there is a match, the bar code does not exist or a predetermined plurality of barcode types in table circumscribed rectangle quit the feature two-dimensional bar features all types of matches.

[0095] 具体的,比如,首先获取该预设的多种条码类型表中的第一种类型(优先级最高)的条码为QR码,则该QR码的条码特征为定位探测器符号,则在条码外接矩形4个点的周边小分为区域里或者所有区域里,分别进行定位探测器符号的搜索,若找不到,则搜索另一种二维条码的条码特征。 [0095] Specifically, for example, to obtain the first predetermined plurality of barcode types of the table type first (highest priority) bar code is a QR code, the QR code in the bar code wherein the detector positioning symbol, bar code circumscribed rectangle into four smaller Zhou Bian region or point where all sections, respectively, of the search alignment mark detectors, if not found, the search of another bar code wherein two-dimensional bar.

[0096] 另外,也可以将预设的多种条码类型表按照线性条码和矩阵条码进行分类配置,则在区分条码类型的判断过程中,可以层次进行判断,首先判断该外接矩形中是否存在线性条码的特征,是,则进行具体的某一种线性条码特征的判断,否则,该条码为矩阵条码,同样进行具体的某一种矩阵条码特征的判断。 [0096] Further, a plurality may be preset table barcode types are classified and arranged in a linear bar code matrix bar codes, the bar code type determination distinguishing process, the level can be determined, first determines whether there is the circumscribed rectangle linear wherein the bar code is determined to a specific one of the features of linear bar codes, otherwise, the barcode is a matrix code, for the same bar code is determined to a specific one feature matrix. 在获取条码的类型以后,对该条码按照现有技术进行译码,以识别并输出条码所包含的信息。 After acquiring the type of bar code, the bar code is decoded according to the prior art, to identify and output information contained in the bar code.

[0097] 在本发明实施例中,该对二维条码类型判断的方法结合了预设的多种条码类型表以及外接矩形中条码的特征,进行条码类型的判断获取,提高条码识别速度。 [0097] In an embodiment of the present invention, the method for determining the type of dimensional bar code combined with features of the predetermined plurality of barcode types of tables and the circumscribed rectangle of the bar code, bar code determines whether the acquired type, bar code recognition speed increase.

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

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

[0100] 图8示出了本发明第四实施例提供的条码识别装置的结构,为了便于说明,仅示出了与本发明实施例相关的部分。 [0100] FIG. 8 shows the structure of the barcode identification apparatus according to a fourth embodiment of the present invention, for convenience of description, only the parts related to the embodiment of the present invention.

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

[0102] 扫描起始点获取单元81,用于获取二值化处理后的待识别条码图像及该图像的多个扫描起始点坐标。 [0102] scanning starting point obtaining unit 81, configured to obtain a plurality of barcode scanning starting point coordinate recognition after the image to be processed and the binarized image.

[0103] 在本发明实施例中,首先从摄像头获取待识别的彩色图像,并将该彩色图像进行灰度化处理,接着获取灰度化处理后的该图像,计算该图像的直方图,由于条码一般是黑色亮度和白色亮度组成,则在该直方图中将出现靠近黑色亮度区域的波峰和一个靠近白色亮度区域的波峰,因此可以确定两个波峰之间的一个最佳亮度值,对该图像进行分割,若两个峰值的距离比较接近,小于预设的距离值,则认为该图像的对比度不够,不存在条码的条件;两个峰值比较远,则认为存在条码,获取该两个峰值中间的某个最佳亮度值,以该值作为图像二值化的判断阈值,将图像中大于阈值的灰度值设为1,否则为0,从而利用扫描起始点获取单元81获取二值化处理后的待识别图像及该图像的多个扫描起始点坐标,该图像的多个扫描起始点坐标包括所述图像的中心点 [0103] In an embodiment of the present invention, first obtains the color image from the camera to be recognized, and the gradation processing of the color image, and then obtains the image after gradation processing, calculates a histogram of the image, since barcode usually black luminance and the white luminance composition, near the peak and a peak white luminance area near the black luminance will occur in the region of the histogram, it is possible to determine an optimum luminance value between two peaks, the image segmentation, if two peaks close distance, the distance is less than the predetermined value, the contrast of the image is considered insufficient, the condition of absence of the bar code; relatively far two peaks, that there is the barcode, acquiring the two peaks an optimum value of the intermediate brightness of the image to the binary value of the determination threshold value, the image is greater than the threshold gradation value is set to 1, otherwise to 0, so that the scanning start point acquisition unit 81 acquires the binarized a plurality of scanning starting point coordinates of the processed image to be recognized and the image, a plurality of scanning starting point of the image coordinates of the image center point comprising 标等。 And other standard. 具体地,首先需要对待识别条码图像进行预设个数的分块,获取分块后每一块图像的中心点,则分块后每一块图像的中心点即为该图像的扫描起始点,则获取了该图像的多个扫描起始点,在实际识别过程中,可以将该待识别条码图像分成四块,获取分块后该四块分块图像的中心点,加上该整幅待识别图像的中心点,可以获取5个扫描起始点。 Specifically, first need to be recognized barcode image into blocks of a predetermined number, obtaining a center point of each image into blocks, the center point of each block after an image is scanned is the start point of the image, the acquisition a plurality of scan start point of the image, in the actual recognition process, the barcode may identify the image to be divided into four, the four center point acquired image block after block, together with the entire image to be recognized central point, you can get five scanning starting point.

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

[0105] 在本发明实施例中,该预设的该多个扫描起始点的顺序可以根据用户需要预先设定,比如可以将该多个扫描起始点所包括的该待识别图像的中心点作为第一扫描起始点,其他按照图像的左上、右上、左下、右下的顺序对剩余的扫描起始点排序。 [0105] In an embodiment of the present invention, the predetermined order of the plurality of scanning starting point may be set in advance according to user needs, such as the center point of the image to be recognized is included in the plurality of scanning starting point may be used as the a first scanning starting point, other sort of scanning starting point of the remaining images in the order of upper left, upper right, lower left, lower right. 利用外接矩形获取单元82按照预设的该多个扫描起始点的顺序,依次从每一个扫描起始点开始,对该条码图像进行逐行扫描,确定最小纵坐标和最大纵坐标,再从该扫描起始点开始,对该图像进行逐列扫描,确定最小横坐标和最大横坐标,最后根据获取的最大横坐标、最小横坐标、最大纵坐标、最小纵坐标,可以获取该条码的外接矩形。 Using a circumscribed rectangle acquiring unit 82 in the order of the scanning starting point of a predetermined plurality of sequentially starting from the start point of each scanning, line by line scanning of the barcode image, determining the minimum and maximum ordinate ordinate, and from this scanning the starting point, the image is scanned column by column, to determine the minimum and maximum abscissa abscissa, and finally obtaining the maximum abscissa, the minimum abscissa, ordinate maximum, minimum vertical axis, a circumscribed rectangle may be obtained of the bar code.

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

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

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

[0109] 第二判断单元,用于当该外接矩形的长小于预设的长度值,且该外接矩形的高小于预设的高度值时,则认为该图像中不存在条码;以及 [0109] The second determination means for, when the length of a circumscribed rectangle smaller than the preset length value, and the circumscribed rectangle height is less than a predetermined height value, then the bar code that is not present in the image; and

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

是一或者二。 Or a two.

[0111] 在本发明实施例中,该外接矩形的特征包外接矩形的长、高等,该外接矩形的长是指外接矩形在X方向上的长度或者是Xmax与Xmin之间的距离,外接矩形的高是指外接矩形在Y方向上的长度Ymax与Ymin之间的距离。 [0111] In an embodiment of the present invention, the feature of the circumscribed rectangle circumscribed rectangle packet length, higher, of the circumscribed rectangle is the distance between the long length of the circumscribed rectangle in the X direction or Xmax and Xmin, circumscribed rectangle refers to the distance between the high length of the rectangle circumscribed Ymax and Ymin in the Y direction. 在获取条码的外接矩形后,若该外接矩形的长(Xmax与Xmin之间的距离)小于预设的长度值,或该外接矩形的高(Ymax与Ymin之间的距离)小于预设的高度值时,则认为该条码不是二维条码,确定该条码的维数是一;当该外接矩形的长小于预设的长度值,且该外接矩形的高小于预设的高度值时,则认为不存在条码;当该外接矩形的长小于预设的长度值,而该外接矩形的高大于预设的高度值时,则认为该一维条码为竖直型条码,如图3所示;当该外接矩形的高小于预设的高度值,而该外接矩形的长大于预设的长度值时,则认为该一维条码为水平型条码,而不是二维条码;若该外接矩形的长大于预设的长度值,且该外接矩形的高大于预设的高度值时,则需要进一步结合该条码的特征信息来确定该条码的维数,该条码的特征信息是指该条码的条空宽度信息,包括条空宽 After obtaining the circumscribed rectangle of the bar code, if the circumscribed rectangle length (the distance between Xmax and Xmin) is less than the predetermined length value, or the higher the circumscribed rectangle (the distance between Ymax and Ymin) less than the preset height value, it is considered that two-dimensional bar barcode is not, it is determined that the dimension is a barcode; circumscribed rectangle when the length is less than a predetermined length value, and the circumscribed rectangle height is less than a predetermined height value, it is considered barcode absent; when the length of a circumscribed rectangle of length less than a preset value, and the circumscribed rectangle tall height to a preset value, it is considered that one-dimensional bar code is a vertical bar code, shown in Figure 3; when the circumscribed rectangle height is less than a predetermined height value, and the value of the length of the circumscribed rectangle is longer than a preset, it is considered that one-dimensional bar horizontal bar code, rather than two-dimensional bar code; if the circumscribed rectangle is longer than preset length value, and the circumscribed rectangle of a predetermined height greater than the height value, wherein the binding information is further required to determine the dimensions of the barcode of the barcode, the barcode feature information refers to the width of barcode bars empty information, comprising bar-space width 度值,条空分布信息等,该条空分布信息是指任意2行或者多行的条空分布是否相同等。 Values, bar-space distribution information, distribution information piece blank 2 refers to any line or multi-line bar are the same spatial distribution and the like.

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

[0113] 另外,在确定该条码为一维条码后,根据该2列或者2行条码中相同的条空宽度的条空线的方向,若该条空线的方向为垂直或者偏向垂直方向,则在以后条码种类判定时,可以只进行垂直扫描,具体可以隔列进行从上到下与从下到上垂直交替扫描,就可以确定该条码的类型,同样,若该条空线的方向为水平或者偏向水平方向,则在以后条码种类判定时,可以只进行水平扫描,具体可以隔行进行从左到右与从右到左水平交替扫描,从而不管条码顺着放,倒着放,旋转着放,都可以对其类型进行识别,使得该确定该一维条码的类型的方法具有较强的适应性,且能够提高条码类型的识别速度。 [0113] Further, after determining that the one-dimensional bar code is the bar code, in accordance with the direction of the bar-space lines or two identical bar-space width bar code 2 rows, if the null direction of the article is a vertical line or a vertical deflection direction, after the bar code at the time of determining the type, only the vertical scanning may be performed, specifically the type of separator column from top to bottom of the bar code from the vertical to the alternate scanning can be determined, similarly, if the direction of the strip line is empty horizontal direction or a horizontal deflection, at the time of determination after the symbology, the horizontal scanning may be performed only, from left to right and specifically interlaced alternating horizontal scanning from right to left, so that regardless of the barcode put down, put backwards, rotating release, their type can be identified, so that the type of the one-dimensional bar code determining process has strong adaptability, and can improve recognition rate of the bar code type.

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

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

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

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

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

[0119] 其中,该预设的多种条码类型表为在识别条码之前预先配置,配置有多种类型的条码及对应的条码特征,以方便在进行条码的识别时使用,且用户可以根据需要随时添加或者其他类型的条码至该类型表中,具有较好的扩展性。 [0119] wherein the plurality of predetermined types of bar code is pre-configured table before identifying the bar code, are arranged a plurality of types of bar code and bar code corresponding to features to facilitate the use of bar codes identifying is performed, and the user may be required added at any time or other type of bar code type to the table, with good scalability. 该表中各条码类型放置根据使用的条码类型的频率排序,也即配置各条码的检测识别优先级别,使得在当前图像中检测到的条码,其配置的优先级最高时,则在获取该条码的类型后,则不必继续检测后面的类型的条码,从而提高了条码识别速度。 The table for each type of bar code is placed according to the frequency sorting bar code type used, i.e. configuration detection identify the priority level of each of the bar code, so that the bar code detected in the current image, the highest configured priority, then acquires the barcode after the type is not necessary to continue to detect the type of the back bar code, thereby improving the barcode recognition speed.

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

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

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

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

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

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

[0126] 在本发明实施例中,当该条码为二维条码时,首先获取该预设的多种条码类型表中的第一种类型(优先级最高)的条码的特征,判断在该外接矩形中是否存在匹配的该特征,是,则该预设的多种条码类型表中的第一种类型(优先级最高)的条码即为该待识别条码的类型,退出识别过程;否,则继续获取该预设的多种条码类型表中的下一种类型条码的特征,继续重复上述步骤,直至存在匹配的特征时退出,或者该条码外接矩形中不存在与预设的多种条码类型表中的所有类型的二维条码特征相匹配的特征时退出。 [0126] In an embodiment of the present invention, a two-dimensional bar code when the bar code, the bar code acquired first feature of the predetermined plurality of barcode types of the table type first (highest priority), it is determined in the add the matched features are present in the rectangle, is that the plurality of predetermined types of bar code type of the first table (highest priority) to be the type of bar code is the bar code identification, the identification process exits; NO, characteristics continue to obtain a type of the predetermined plurality of barcode types of the barcode table, continue repeating the above steps until the exit feature when there is a match, or if the bar code with a preset plurality of barcode types in the absence of the circumscribed rectangle quit the feature characteristic of all types of two-dimensional bar table matches.

[0127] 本发明实施例提供的该对二维条码类型判断的方法,结合了预设的多种条码类型表以及外接矩形中条码的特征,进行条码类型的判断获取,提高条码识别速度。 The method for determining the type of dimensional bar code according to an embodiment [0127] of the present invention, in conjunction with a plurality of barcode types and features of the circumscribed rectangle table in a predetermined bar code, bar code determines whether the acquired type, bar code recognition speed increase.

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

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

Claims (10)

1.一种条码识别方法,其特征在于,所述方法包括下述步骤: 获取二值化处理后的待识别条码图像及所述图像的多个扫描起始点坐标; 按照预设的所述多个扫描起始点的顺序,依次从每一个扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取所述图像中条码的外接矩形; 根据所述外接矩形的特征和/或所述外接矩形中条码的特征信息,判断获取所述条码的维数。 A barcode recognition method, characterized in that the method comprises the steps of: obtaining a plurality of scanning starting point coordinate to be recognized barcode image and the image after the binarization process; said plurality according to a preset sequentially scanning starting point, sequentially from the beginning of each scanning starting point, up, down, left, and right directions of the image line by line and column by column scanning, obtaining the circumscribed rectangle of the bar code image; in accordance with the wherein said circumscribed rectangle and / circumscribed rectangle in the feature information or the bar code, the bar code is determined to obtain the dimension.
2.如权利要求1所述的方法,其特征在于,所述方法还包括以下步骤: 当所述图像中存在多个条码时,获取所述图像中每个条码的外接矩形; 按照检测到所述多个条码的顺序,根据每个条码的外接矩形的特征和/或所述外接矩形中条码的特征信息,判断获取所述每个条码的维数。 2. The method according to claim 1, wherein said method further comprises the step of: when a plurality of images of the barcode, acquiring the circumscribed rectangle of each image of the bar code; according to the detected the order of said plurality of bar code, according to the characteristics of the circumscribed rectangle of each barcode and / or the bar code in the circumscribed rectangular characteristic information, determines whether the acquired dimension of each of the bar codes.
3.如权利要求1所述的方法,其特征在于,所述图像的多个扫描起始点坐标包括所述图像的中心点坐标,所述条码的特征信息指所述条码的条空宽度信息。 3. The method according to claim 1, wherein the plurality of scanning starting point coordinates of the center point coordinates of the image comprises an image of the barcode feature information refers to the width of the bar code bar-space information.
4.如权利要求1所述的方法,其特征在于,所述方法还包括以下步骤: 当判断该条码的维数为一维时,根据该外接矩形中条码的特征信息,或者对该图像进行预处理后获取的条空信息,判断预设的多种条码类型表中是否存在匹配的条空信息;当存在匹配的条空信息时,获取与所述匹配的条空信息对应的条码类型。 4. The method according to claim 1, wherein said method further comprises the steps of: determining when the dimension of the one-dimensional barcode, the feature information of the bar code in the circumscribed rectangle, or performed on the image Article pretreatment acquired space information, space information section matches a predetermined plurality of determining whether there is a bar code type table; space information pieces when there is a match, the matching pieces acquiring space information corresponding to the barcode type.
5.如权利要求1所述的方法,其特征在于,所述方法还包括以下步骤: 当判断所述条码的维数为二维时,判断所述外接矩形中是否存在与预设的多种条码类型表中的一种类型的条码特征相匹配的特征; 当存在匹配的特征时,获取与所述特征对应的条码类型。 5. The method according to claim 1, wherein said method further comprises the steps of: determining when the number of dimensions of the two-dimensional bar code, the determination whether there is more circumscribed rectangle with a preset wherein one type of bar code barcode feature type table matches; when present feature matching, the feature acquiring corresponding barcode types.
6.如权利要求3所述的方法,其特征在于,所述方法还包括以下步骤: 当所述外接矩形的长小于预设的长度值,或所述外接矩形的高小于预设的高度值时,则所述条码的维数是一; 当所述外接矩形的长小于预设的长度值,且所述外接矩形的高小于预设的高度值时,则所述图像中不存在条码; 当所述外接矩形的长大于预设的长度值,且所述外接矩形的高大于预设的高度值时,则根据所述外接矩形中条码的条空宽度信息,进一步确定所述条码的维数是一或者二。 6. The method according to claim 3, wherein said method further comprises the step of: when the length of a circumscribed rectangle is smaller than the preset length value, or the circumscribed rectangle height is less than the predetermined height value when, then the number of dimensions is a bar code; when the length of a circumscribed rectangle smaller than the preset length value, and the circumscribed rectangle height is less than a predetermined height value, then the bar code is not present in the image; when the circumscribed rectangle is longer than a predetermined length value, and the circumscribed rectangle tall in height preset value, in accordance with the information in the bar-space width of the circumscribed rectangle of the bar code, the bar code is further determined dimension is a number or two.
7.—种条码识别装置,其特征在于,所述装置包括: 扫描起始点获取单元,用于获取二值化处理后的待识别条码图像及所述图像的多个扫描起始点坐标; 外接矩形获取单元,用于按照预设的所述多个扫描起始点的顺序,依次从每一个扫描起始点开始,向上、下、左、右四个方向分别对该图像进行逐行与逐列扫描,获取所述图像中条码的外接矩形;以及维数获取单元,用于根据所述外接矩形的特征和/或所述外接矩形中条码的特征信息,判断获取所述条码的维数。 7.- kinds of barcode recognition apparatus, characterized in that said apparatus comprises: scanning starting point acquiring unit for acquiring an image and the identification bar code image after the binarization processing a plurality of scanning starting point coordinate; circumscribed rectangle an acquisition unit configured to order the plurality of scan preset starting sequentially from the start of each scanning starting point, up, down, left, and right directions of the image row-by-column scanning, acquiring images of the circumscribed rectangle barcode; and dimension acquisition unit configured according to the characteristic dimension of the circumscribed rectangle and / circumscribed rectangle in the feature information or the barcode, acquiring the barcode is determined.
8.如权利要求7所述的装置,其特征在于,所述装置还包括: 匹配单元,用于当判断该条码的维数为一维时,根据该外接矩形中条码的特征信息,或者对该图像进行预处理后获取的条空信息,判断预设的多种条码类型表中是否存在匹配的条空信息;以及一维条码类型获取单元,用于当存在匹配的条空信息时,获取与所述匹配的条空信息对应的条码类型。 8. The apparatus according to claim 7, characterized in that said apparatus further comprising: a matching unit configured to, when determining the dimensions of a one-dimensional bar code based on the characteristic information of the circumscribed rectangle of the bar code, or of after the pre-acquired image space pieces of information, whether there is a bar-space information matches a predetermined plurality of determining the barcode type table; and a one-dimensional bar type acquisition unit for air when there is matching information pieces acquired type of bar code information corresponding to the bar-space matching.
9.如权利要求7所述的装置,其特征在于,所述装置还包括:判断单元,用于当判断所述条码的维数为二维时,判断所述外接矩形中是否存在与预设的多种条码类型表中的一种类型的条码特征相匹配的特征;以及二维条码类型获取单元,用于当存在匹配的特征时,获取与所述特征对应的条码类型。 9. The apparatus according to claim 7, wherein said apparatus further comprises: time determining means for determining when the number of dimensions of the two-dimensional bar code, it is determined whether there is the circumscribed rectangle with a preset wherein a plurality of one type of bar code symbologies in the table matches the feature; and when there is a barcode type matches the feature, the feature acquiring a two-dimensional bar code corresponding to the type of acquisition unit configured.
10.如权利要求7所述的装置,其特征在于,所述维数获取单元具体包括:第一判断单元,用于当所述外接矩形的长小于预设的长度值,或所述外接矩形的高小于预设的高度值时,则确定所述条码的维数是一;第二判断单元,用于当所述外接矩形的长小于预设的长度值,且所述外接矩形的高小于预设的高度值时,则认为所述图像中不存在条码;以及第三判断单元,用于当所述外接矩形的长大于预设的长度值,且所述外接矩形的高大于预设的高度值时,则根据所述外接矩形中条码的条空宽度信息,进一步确定所述条码的维数是一或者二。 10. The apparatus according to claim 7, wherein the dimension obtaining unit comprises: a first judging unit, for less than the predetermined length when the length value of the circumscribed rectangle, or the circumscribed rectangle at high height less than a preset value, it is determined that the dimension is a bar code; second determination means for, when the length of a circumscribed rectangle smaller than the preset length value, and the circumscribed rectangle is smaller than the high a preset height values, then the bar code that is not present in the image; and a third determining unit, when a value for the length of the circumscribed rectangle is longer than a predetermined, and the circumscribed rectangle of height greater than a predetermined height value, according to the bar-space circumscribed rectangle width information in the bar code, the bar code is further determined dimension is mono- or di. ` `
CN 201110367610 2011-11-18 2011-11-18 Bar code identifying method and device CN102521558B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201110367610 CN102521558B (en) 2011-11-18 2011-11-18 Bar code identifying method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201110367610 CN102521558B (en) 2011-11-18 2011-11-18 Bar code identifying method and device

Publications (2)

Publication Number Publication Date
CN102521558A true CN102521558A (en) 2012-06-27
CN102521558B true CN102521558B (en) 2014-04-02

Family

ID=46292469

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110367610 CN102521558B (en) 2011-11-18 2011-11-18 Bar code identifying method and device

Country Status (1)

Country Link
CN (1) CN102521558B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104361309B (en) * 2014-12-05 2017-08-29 网易宝有限公司 Barcode recognition method and apparatus
CN105654019A (en) * 2016-02-23 2016-06-08 海信集团有限公司 Fast decoding method and device for two-dimension code
CN105844200A (en) * 2016-03-17 2016-08-10 杭州晟元数据安全技术股份有限公司 Method of determining bar code type

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5418357A (en) 1992-06-22 1995-05-23 Matsushita Electric Industrial Co., Ltd. Bar-code reader permitting selective use of a whole or a part of an image sensor
CN101059834A (en) 2007-05-31 2007-10-24 中国农业大学 QR two-dimensional bar code recognition method based on pickup head for chatting
CN101882201A (en) 2010-06-01 2010-11-10 福建新大陆电脑股份有限公司 Barcode decoding chip and method
CN101882206A (en) 2010-06-01 2010-11-10 福建新大陆电脑股份有限公司 Decoding chip of RSS (Really Simple Syndication) bar code
CN102236788A (en) 2010-04-20 2011-11-09 荣科科技股份有限公司 Kilowatt-hour meter image automatic identification method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8469274B2 (en) * 2008-12-31 2013-06-25 Armorlink Sh Corp. Method for fast locating decipherable pattern

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5418357A (en) 1992-06-22 1995-05-23 Matsushita Electric Industrial Co., Ltd. Bar-code reader permitting selective use of a whole or a part of an image sensor
CN101059834A (en) 2007-05-31 2007-10-24 中国农业大学 QR two-dimensional bar code recognition method based on pickup head for chatting
CN102236788A (en) 2010-04-20 2011-11-09 荣科科技股份有限公司 Kilowatt-hour meter image automatic identification method
CN101882201A (en) 2010-06-01 2010-11-10 福建新大陆电脑股份有限公司 Barcode decoding chip and method
CN101882206A (en) 2010-06-01 2010-11-10 福建新大陆电脑股份有限公司 Decoding chip of RSS (Really Simple Syndication) bar code

Also Published As

Publication number Publication date Type
CN102521558A (en) 2012-06-27 application

Similar Documents

Publication Publication Date Title
US6778703B1 (en) Form recognition using reference areas
Huang et al. Text localization in natural images using stroke feature transform and text covariance descriptors
US6758399B1 (en) Distortion correction method in optical code reading
Chen et al. Robust text detection in natural images with edge-enhanced maximally stable extremal regions
Shafait et al. Performance evaluation and benchmarking of six-page segmentation algorithms
US8326037B1 (en) Methods and apparatus for locating an object in an image
US20010006191A1 (en) Detecting bar code candidates
US5539841A (en) Method for comparing image sections to determine similarity therebetween
US6366696B1 (en) Visual bar code recognition method
US7970213B1 (en) Method and system for improving the recognition of text in an image
US6970601B1 (en) Form search apparatus and method
Chai et al. Locating and decoding EAN-13 barcodes from images captured by digital cameras
Shafait et al. Performance comparison of six algorithms for page segmentation
LeBourgeois Robust multifont OCR system from gray level images
US20110290882A1 (en) Qr code detection
US20120134576A1 (en) Automatic recognition of images
Pan et al. A robust system to detect and localize texts in natural scene images
Shi et al. Text extraction from gray scale historical document images using adaptive local connectivity map
US6917708B2 (en) Handwriting recognition by word separation into silhouette bar codes and other feature extraction
US20130194448A1 (en) Rules for merging blocks of connected components in natural images
US20060043189A1 (en) Method and apparatus for determining the vertices of a character in a two-dimensional barcode symbol
US20020196979A1 (en) Automatically extracting graphical bar codes
US20050185841A1 (en) Automatic document reading system for technical drawings
JP2000285190A (en) Method and device for identifying slip and storage medium
CN101615252A (en) Method for extracting text information from adaptive images

Legal Events

Date Code Title Description
C06 Publication
C10 Request of examination as to substance
C14 Granted