Nothing Special   »   [go: up one dir, main page]

CN106056020A - Bar code detection and recognition method and system based on machine vision system - Google Patents

Bar code detection and recognition method and system based on machine vision system Download PDF

Info

Publication number
CN106056020A
CN106056020A CN201610389625.0A CN201610389625A CN106056020A CN 106056020 A CN106056020 A CN 106056020A CN 201610389625 A CN201610389625 A CN 201610389625A CN 106056020 A CN106056020 A CN 106056020A
Authority
CN
China
Prior art keywords
barcode
area
positioning
image data
barcodes
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN201610389625.0A
Other languages
Chinese (zh)
Other versions
CN106056020B (en
Inventor
林盛鑫
陈雪芳
赵晓芳
刘华珠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dongguan University of Technology
Original Assignee
Dongguan University of Technology
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
Application filed by Dongguan University of Technology filed Critical Dongguan University of Technology
Priority to CN201610389625.0A priority Critical patent/CN106056020B/en
Publication of CN106056020A publication Critical patent/CN106056020A/en
Application granted granted Critical
Publication of CN106056020B publication Critical patent/CN106056020B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/10544Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation by scanning of the records by radiation in the optical part of the electromagnetic spectrum
    • G06K7/10821Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation by scanning of the records by radiation in the optical part of the electromagnetic spectrum further details of bar or optical code scanning devices

Landscapes

  • Physics & Mathematics (AREA)
  • Electromagnetism (AREA)
  • Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Toxicology (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

本发明公开了一种基于机器视觉系统的条码检测识别方法及系统,所述方法应用于机器视觉系统主机中,所述机器视觉系统主机连接有光源模块和图像采集模块,所述方法包括以下步骤:S1、图像数据采集步骤,S2、图像数据预处理步骤,S3、条码区域定位步骤,S3A、条码区域调整步骤,S4、条码识别步骤。利用本发明,无需进行人工操作,即可对具有条码的产品进行自动扫描并对条码进行识别,其具有自动化程度高、识别速度快,工作效率高等优点。

The invention discloses a barcode detection and recognition method and system based on a machine vision system. The method is applied to a machine vision system host, and the machine vision system host is connected with a light source module and an image acquisition module. The method includes the following steps : S1, image data acquisition step, S2, image data preprocessing step, S3, barcode area positioning step, S3A, barcode area adjustment step, S4, barcode recognition step. The invention can automatically scan products with barcodes and identify the barcodes without manual operation, and has the advantages of high degree of automation, fast identification speed, and high work efficiency.

Description

一种基于机器视觉系统的条码检测识别方法及系统A barcode detection and recognition method and system based on machine vision system

技术领域technical field

本发明涉及机器视觉系统的条码检测技术领域,尤其涉及一种基于机器视觉系统的条码检测识别方法及系统。The invention relates to the technical field of barcode detection by machine vision systems, in particular to a method and system for barcode detection and recognition based on machine vision systems.

背景技术Background technique

随着“工业4.0”的概念的不断深化,机器视觉在工业自动化中的广泛应用,部分制造企业开始进入自动化生产阶段,在生产控制管理过程中,条码及其识别读取技术已经成为主要的产品标识与跟踪手段。传统的扫描枪需要手工近距离对准条码区域进行操作,其效率低、速度慢,自动化程度低,人工成本高等弊端已经无法满足大规模自动化工业生产的需求。目前,条码标签的区域定位,国内外学者进行了研究并提出了相应的解决方案,主要有基于DCT的方法、基于差分的方法和数学形态学的方法等。DCT算法的条码区域自动定位,该算法可以定位任意旋转角度的条码,但当图像中其他区域的纹理比重大于条码区域时,该算法会失效;基于差分的方法对条码进行定位,此方法实现比较简单,对垂直和水平的条码定位效果较好,但是对于复杂背景的鲁棒性较差;采用数学形态学的膨胀操作来定义条码区域,很容易使条码区域与其他区域连在一起,容易出现误检和漏检的情况。因此,有必要提供一种新的条码检测方法,以克服现有的条码的检测识别方法存在的不足。With the continuous deepening of the concept of "Industry 4.0" and the wide application of machine vision in industrial automation, some manufacturing enterprises have begun to enter the stage of automated production. In the process of production control management, barcodes and their identification and reading technologies have become the main products Means of identification and tracking. Traditional scanning guns need to be manually aligned with the barcode area at close range, and their disadvantages such as low efficiency, slow speed, low degree of automation, and high labor costs have been unable to meet the needs of large-scale automated industrial production. At present, domestic and foreign scholars have conducted research on the regional positioning of barcode labels and proposed corresponding solutions, mainly including methods based on DCT, methods based on differences, and methods based on mathematical morphology. The barcode area of the DCT algorithm is automatically positioned. This algorithm can locate the barcode at any rotation angle, but when the texture ratio of other areas in the image is greater than the barcode area, the algorithm will fail. The barcode is positioned based on the difference method. This method achieves comparison Simple, good for vertical and horizontal barcode positioning, but poor robustness for complex backgrounds; using mathematical morphology expansion operation to define the barcode area, it is easy to connect the barcode area with other areas, and it is easy to appear False detections and missed detections. Therefore, it is necessary to provide a new barcode detection method to overcome the shortcomings of existing barcode detection and recognition methods.

发明内容Contents of the invention

为了克服现有技术中的不足,本发明提供一种基于机器视觉系统的条码检测识别方法及系统,利用本发明,无需进行人工操作,即可对具有条码的产品进行自动扫描并对条码进行识别,其具有自动化程度高、识别速度快,工作效率高等优点。In order to overcome the deficiencies in the prior art, the present invention provides a barcode detection and recognition method and system based on a machine vision system. Using the present invention, products with barcodes can be automatically scanned and the barcodes can be recognized without manual operation. , which has the advantages of high degree of automation, fast recognition speed, and high work efficiency.

本发明是通过以下技术方案实现的:The present invention is achieved through the following technical solutions:

一种基于机器视觉系统的条码检测识别方法,所述方法应用于机器视觉系统主机中,所述机器视觉系统主机连接有光源模块和图像采集模块,所述方法包括以下步骤:A method for detecting and recognizing barcodes based on a machine vision system, the method is applied in a machine vision system host, the machine vision system host is connected with a light source module and an image acquisition module, and the method comprises the following steps:

S1、图像数据采集步骤,通过所述图像采集模块与光源模块的配合,对具有多条条码的标签进行图像数据采集,并将采集到的图像数据传输至所述器视觉系统主机;S1. The image data acquisition step, through the cooperation of the image acquisition module and the light source module, image data acquisition is performed on labels with multiple barcodes, and the acquired image data is transmitted to the host of the device vision system;

S2、图像数据预处理步骤,所述机器视觉系统主机对所述图像数据进行预处理,以将获取的图像数据进行标签与背景的分离,从而过滤背景的干扰;S2. Image data preprocessing step, the machine vision system host performs preprocessing on the image data, so as to separate the acquired image data from the label and the background, thereby filtering background interference;

S3、条码区域定位步骤,所述机器视觉系统主机对图像数据预处理步骤处理后的图像数据进行条码特征提取,并对条码进行区域定位,以确定所述标签上所有条码的所在区域,该所在区域即为具有所述标签上所有条码的条码区域;S3, the barcode area positioning step, the machine vision system host performs barcode feature extraction on the image data processed by the image data preprocessing step, and performs area positioning on the barcode to determine the location of all the barcodes on the label. The area is the barcode area with all the barcodes on the label;

其中,所述条码区域包括条码上下区域和条码左右区域,所述条码区域定位包括条码上下区域定位和条码左右区域定位,分别利用所述条码上下区域定位、条码左右区域定位来确定条码的行数、同一行条码中存在的条码数,以实现对所述标签上所有条码的区域定位;Wherein, the barcode area includes the upper and lower areas of the barcode and the left and right areas of the barcode, and the positioning of the barcode area includes the positioning of the upper and lower areas of the barcode and the positioning of the left and right areas of the barcode. , the number of barcodes existing in the same row of barcodes, so as to realize the regional positioning of all barcodes on the label;

S4、条码识别步骤,对所述条码区域内的每一条码进行条码识别。S4. A barcode recognition step, performing barcode recognition on each barcode in the barcode area.

进一步地,在所述条码区域定位步骤S3之后、所述条码识别步骤S4之前还包括以下步骤:Further, after the barcode area locating step S3, the following steps are also included before the barcode recognition step S4:

S3A、条码区域调整步骤,对所述条码区域的左右边界分别进行扩展K个像素的调整处理,并对所述条码区域的上下边界分别进行缩小P个像素的调整处理,最后对调整处理后的条码区域作为最终的条码区域,其中所述K、P为正整数,具体取值根据需要选取。S3A, the barcode area adjustment step, the left and right boundaries of the barcode area are respectively adjusted by expanding K pixels, and the upper and lower boundaries of the barcode area are respectively adjusted by reducing P pixels, and finally the adjusted The barcode area is used as the final barcode area, wherein the K and P are positive integers, and the specific values are selected according to requirements.

优选地,所述条码区域定位步骤S3中,在所述条码上下区域定位过程中,采用归一化互相关匹配算法与霍夫变换直线检测算法来确定所述条码上下区域;所述条码区域定位步骤S3中,在进行所述条码左右区域定位过程中,对预处理后的图像的灰度图上对各条码的中心线l进行直线灰度值扫描,以获得每个条码的中心线l的灰度值分布图,对灰度值分布图上的像素数据进行累加运算,设中心线l灰度值数组为LineA,累加运算后产生一个新的数组为LineB,根据所述数组LineA与数据LineB建立条码的中心线灰度值累加分布图,通过所述中心线灰度值累加分布图中的水平部分的直线来确定所述条码左右区域定位。Preferably, in the barcode region locating step S3, in the process of locating the upper and lower regions of the barcode, a normalized cross-correlation matching algorithm and a Hough transform line detection algorithm are used to determine the upper and lower regions of the barcode; the barcode region locating In step S3, in the process of locating the left and right regions of the barcode, a linear gray value scan is performed on the center line l of each barcode on the grayscale image of the preprocessed image to obtain the center line l of each barcode. Gray value distribution diagram, the pixel data on the gray value distribution diagram is cumulatively calculated, the central line 1 gray value array is LineA, a new array is generated after the cumulative operation is LineB, according to the array LineA and data LineB A center line gray value accumulation distribution diagram of the barcode is established, and the left and right area positioning of the barcode is determined through the straight lines in the horizontal part of the centerline gray value accumulation distribution diagram.

优选地,所述图像数据预处理步骤S2中,所述机器视觉系统主机对所述图像数据进行的预处理,包括滤波、去噪、增强和/或二值化处理;较佳地,所述图像采集模块为工业相机。Preferably, in the image data preprocessing step S2, the machine vision system host performs preprocessing on the image data, including filtering, denoising, enhancement and/or binarization processing; preferably, the The image acquisition module is an industrial camera.

基于上述方法的发明构思,本发明还提供了一种基于机器视觉系统的条码检测识别系统,所述系统包括机器视觉系统主机,所述机器视觉系统主机连接有光源模块和图像采集模块,所述图像采集模块用于与光源模块配合,对具有多条条码的标签进行图像数据采集,并将采集到的图像数据传输至所述器视觉系统主机中,所述机器视觉系统主机包括:Based on the inventive concept of the above method, the present invention also provides a barcode detection and recognition system based on a machine vision system. The system includes a machine vision system host, and the machine vision system host is connected with a light source module and an image acquisition module. The image acquisition module is used to cooperate with the light source module to collect image data on labels with multiple barcodes, and transmit the collected image data to the machine vision system host, and the machine vision system host includes:

图像数据预处理模块,用于对所述图像数据进行预处理,以将获取的图像数据进行标签与背景的分离,从而过滤背景的干扰;An image data preprocessing module, configured to preprocess the image data, so as to separate the acquired image data from the label and the background, thereby filtering background interference;

条码区域定位模块,用于将图像数据预处理模块进行所预处理后的图像数据进行条码特征提取,并对条码进行区域定位,以确定所述标签上所有条码的所在区域,该所在区域即为具有所述标签上所有条码的条码区域;The barcode area positioning module is used to perform barcode feature extraction on the image data preprocessed by the image data preprocessing module, and perform area positioning on the barcode to determine the area where all the barcodes on the label are located. The area is a barcode area with all barcodes on said label;

其中,所述条码区域包括条码上下区域和条码左右区域,所述条码区域定位包括条码上下区域定位和条码左右区域定位,分别利用所述条码上下区域定位、条码左右区域定位来确定条码的行数、同一行条码中存在的条码数,以实现对所述标签上所有条码的区域定位;Wherein, the barcode area includes the upper and lower areas of the barcode and the left and right areas of the barcode, and the positioning of the barcode area includes the positioning of the upper and lower areas of the barcode and the positioning of the left and right areas of the barcode. , the number of barcodes existing in the same row of barcodes, so as to realize the regional positioning of all barcodes on the label;

条码识别模块,用于对所述条码区域内的每一条码进行条码识别。The barcode recognition module is used to perform barcode recognition on each barcode in the barcode area.

进一步地,所述机器视觉系统主机还包括:Further, the machine vision system host also includes:

条码区域调整模块,用于对所述条码区域的左右边界分别进行扩展K个像素的调整处理,并对所述条码区域的上下边界分别进行缩小P个像素的调整处理,最后对调整处理后的条码区域作为最终的条码区域,其中所述K、P为正整数,具体取值根据需要选取。The barcode area adjustment module is used to adjust the left and right boundaries of the barcode area by expanding K pixels respectively, and adjust the upper and lower boundaries of the barcode area by shrinking P pixels, and finally adjust the adjusted The barcode area is used as the final barcode area, wherein the K and P are positive integers, and the specific values are selected according to requirements.

优选地,所述条码区域定位模块,在进行所述条码上下区域定位过程中,采用归一化互相关匹配算法与霍夫变换直线检测算法来确定所述条码上下区域;所述条码区域定位模块,在进行所述条码左右区域定位过程中,对预处理后的图像的灰度图上对各条码的中心线l进行直线灰度值扫描,以获得每个条码的中心线l的灰度值分布图,对灰度值分布图上的像素数据进行累加运算,设中心线l灰度值数组为LineA,累加运算后产生一个新的数组为LineB,根据所述数组LineA与数据LineB建立条码的中心线灰度值累加分布图,通过所述中心线灰度值累加分布图中的水平部分的直线来确定所述条码左右区域定位。Preferably, the barcode area locating module, in the process of locating the upper and lower areas of the barcode, uses a normalized cross-correlation matching algorithm and a Hough transform line detection algorithm to determine the upper and lower areas of the barcode; the barcode area locating module , in the process of positioning the left and right regions of the barcode, perform linear grayscale value scanning on the centerline l of each barcode on the grayscale image of the preprocessed image, so as to obtain the grayscale value of the centerline l of each barcode Distribution diagram, the pixel data on the gray value distribution diagram is accumulated, set the central line 1 gray value array as LineA, after the accumulation operation, a new array is generated as LineB, and the barcode is established according to the array LineA and data LineB The central line gray value accumulation distribution diagram, the positioning of the left and right regions of the barcode is determined by the straight lines in the horizontal part of the central line gray value accumulation distribution diagram.

较佳地,所述图像数据预处理模块对所述图像数据进行的预处理,包括滤波、去噪、增强和/或二值化处理;所述图像采集模块为工业相机。Preferably, the image data preprocessing module performs preprocessing on the image data, including filtering, denoising, enhancement and/or binarization; the image acquisition module is an industrial camera.

利用本发明提供的基于机器视觉系统的条码检测识别方法及系统,可有效代替传统的条码识读器,即使是对倾斜条码、单标签多条码、单行多条码、部分缺失的条码、具有污渍的等都可以得到较满意的识别效果,并可实现任意方向条码和多条码的自动化识别,而且识别速度快、识别效率高等优点,从而可有效满足企业大规模自动化工业生产的需求。The barcode detection and recognition method and system based on the machine vision system provided by the present invention can effectively replace the traditional barcode reader, even for oblique barcodes, single-label multiple barcodes, single-line multiple barcodes, partially missing barcodes, stained etc. can get a satisfactory recognition effect, and can realize automatic recognition of barcodes in any direction and multiple barcodes, and has the advantages of fast recognition speed and high recognition efficiency, so that it can effectively meet the needs of large-scale automated industrial production of enterprises.

附图说明Description of drawings

附图1为本发明实施例所述方法的流程示意图;Accompanying drawing 1 is the schematic flow chart of the method described in the embodiment of the present invention;

附图2为本发明实施例所述系统的结构模块框图;Accompanying drawing 2 is the structural module block diagram of the system described in the embodiment of the present invention;

附图3为利用霍夫变换算法对标签上的条码进行直线检测获得的直线,并将各直线的两端点进行坐标标记的示意图;Accompanying drawing 3 is the straight line that utilizes Hough transform algorithm to carry out straight line detection to the bar code on the label and obtains, and carries out the schematic diagram of coordinate marking of the two ends of each straight line;

附图4为具有一个条码的中心线的灰度值分布图;Accompanying drawing 4 is the distribution diagram of the gray value with the centerline of a barcode;

附图5为同一行中具有两个条码的中心线的灰度值分布图;Accompanying drawing 5 is the gray value distribution figure that has the center line of two barcodes in the same row;

附图6为附图4中的条码中心线对应的灰度值累加分布图;Accompanying drawing 6 is the accumulative distribution diagram of the gray value corresponding to the barcode center line in the accompanying drawing 4;

附图7为附图5中的条码中心线对应的灰度值累加分布图。Accompanying drawing 7 is the accumulative distribution diagram of the gray value corresponding to the center line of the barcode in the accompanying drawing 5.

具体实施方式detailed description

为了便于本领域技术人员的理解,下面结合附图对本发明作进一步的描述。In order to facilitate the understanding of those skilled in the art, the present invention will be further described below in conjunction with the accompanying drawings.

如附图1所示,一种基于机器视觉系统的条码检测识别方法,所述方法应用于机器视觉系统主机中,所述机器视觉系统主机连接有光源模块和图像采集模块,本实施例中,所述图像采集模块优选为工业相机,所述方法包括以下步骤:As shown in accompanying drawing 1, a kind of barcode detection and recognition method based on machine vision system, described method is applied in machine vision system host computer, described machine vision system host computer is connected with light source module and image acquisition module, in the present embodiment, The image acquisition module is preferably an industrial camera, and the method comprises the following steps:

S1、图像数据采集步骤,通过所述图像采集模块与光源模块的配合,对具有多条条码的标签进行图像数据采集,并将采集到的图像数据传输至所述器视觉系统主机;S1. The image data acquisition step, through the cooperation of the image acquisition module and the light source module, image data acquisition is performed on labels with multiple barcodes, and the acquired image data is transmitted to the host of the device vision system;

S2、图像数据预处理步骤,所述机器视觉系统主机对所述图像数据进行预处理,以将获取的图像数据进行标签与背景的分离,从而过滤背景的干扰;可采用一种基于类内方差的自适应阈值分割方法对图像数据进行预处理,所述的预处理,包括滤波、去噪、增强和/或二值化处理;S2, the image data preprocessing step, the machine vision system host performs preprocessing on the image data, so as to separate the acquired image data from the label and the background, thereby filtering the interference of the background; a method based on intra-class variance can be used The adaptive threshold segmentation method performs preprocessing on the image data, and the preprocessing includes filtering, denoising, enhancing and/or binarization processing;

S3、条码区域定位步骤,所述机器视觉系统主机对图像数据预处理步骤处理后的图像数据进行条码特征提取,并对条码进行区域定位,以确定所述标签上所有条码的所在区域,该所在区域即为具有所述标签上所有条码的条码区域;由于存在着倾斜的条码的情况,因此在条码特征提取后,若存在着条码倾斜的图像,则对倾斜的条码的图像进行旋转校正后再对条码进行区域定位;S3, the barcode area positioning step, the machine vision system host performs barcode feature extraction on the image data processed by the image data preprocessing step, and performs area positioning on the barcode to determine the location of all the barcodes on the label. The area is the barcode area with all the barcodes on the label; because there are inclined barcodes, after the barcode feature extraction, if there is an image of the barcode inclined, the image of the inclined barcode is rotated and corrected before Regional positioning of the barcode;

其中,所述条码区域包括条码上下区域和条码左右区域,所述条码区域定位包括条码上下区域定位和条码左右区域定位,分别利用所述条码上下区域定位、条码左右区域定位来确定条码的行数、同一行条码中存在的条码数,以实现对所述标签上所有条码的区域定位;Wherein, the barcode area includes the upper and lower areas of the barcode and the left and right areas of the barcode, and the positioning of the barcode area includes the positioning of the upper and lower areas of the barcode and the positioning of the left and right areas of the barcode. , the number of barcodes existing in the same row of barcodes, so as to realize the regional positioning of all barcodes on the label;

S4、条码识别步骤,对所述条码区域内的每一条码进行条码识别。S4. A barcode recognition step, performing barcode recognition on each barcode in the barcode area.

作为优选的实施例,在所述条码区域定位步骤S3之后、所述条码识别步骤S4之前还包括以下步骤:As a preferred embodiment, after the barcode area positioning step S3, the following steps are also included before the barcode recognition step S4:

S3A、条码区域调整步骤,对所述条码区域的左右边界分别进行扩展K个像素的调整处理,以防止左右漏码的情况出现,并对所述条码区域的上下边界分别进行缩小P个像素的调整处理,以确保条码识别的稳定性,最后对调整处理后的条码区域作为最终的条码区域,通过将调整处理后的条码作为最终的条码区域,并对该最终的条码区域进行条码识别,可有效防止漏码的情况出现和有效提高条码识别的稳定性。其中,所述K、P为正整数,具体取值根据需要选取,本实施例中,所述K=P=15,S3A, the barcode area adjustment step, the left and right boundaries of the barcode area are respectively adjusted by expanding K pixels to prevent left and right missing codes, and the upper and lower boundaries of the barcode area are respectively reduced by P pixels Adjust the processing to ensure the stability of barcode recognition. Finally, the adjusted barcode area is used as the final barcode area. By using the adjusted barcode as the final barcode area and performing barcode identification on the final barcode area, you can Effectively prevent the occurrence of missing codes and effectively improve the stability of barcode recognition. Wherein, the K and P are positive integers, and the specific values are selected according to the needs. In this embodiment, the K=P=15,

作为优选的实施例,在条码区域定位步骤S3,先通过条码特征提取,并对图像进行倾斜校正,然后再对条码进行区域定位,条码区域定位包括条码上下区域定位和条码左右区域定位;在所述条码上下区域定位过程中,采用归一化互相关匹配算法(NCC)与霍夫变换直线检测算法来确定所述条码上下区域;所述条码区域定位步骤S3中,在进行所述条码左右区域定位过程中,对预处理后的图像的灰度图上对各条码的中心线l进行直线灰度值扫描,以获得每个条码的中心线l的灰度值分布图,对灰度值分布图上的像素数据进行累加运算,设中心线l灰度值数组为LineA,累加运算后产生一个新的数组为LineB,根据所述数组LineA与数据LineB建立条码的中心线灰度值累加分布图,通过所述中心线灰度值累加分布图中的水平部分的直线来确定所述条码左右区域定位。As a preferred embodiment, in the barcode area positioning step S3, the barcode feature extraction is first performed, and the image is tilt-corrected, and then the barcode area positioning is carried out. The bar code area positioning includes bar code upper and lower area positioning and bar code left and right area positioning; In the barcode upper and lower region positioning process, the normalized cross-correlation matching algorithm (NCC) and the Hough transform line detection algorithm are used to determine the upper and lower regions of the barcode; in the barcode region positioning step S3, the left and right regions of the barcode are In the positioning process, the gray value of the center line l of each barcode is scanned in a straight line on the gray image of the preprocessed image to obtain the gray value distribution map of the center line l of each bar code. The pixel data on the figure is accumulated, and the central line 1 gray value array is set as LineA, and a new array is generated after the accumulated operation is LineB, and the center line gray value accumulation distribution diagram of the barcode is established according to the array LineA and the data LineB The location of the left and right regions of the barcode is determined by the straight line in the horizontal part in the gray value accumulation distribution diagram of the center line.

以下对本发明实施例中的条码区域定位步骤S3作进一步的详细说明:The barcode area positioning step S3 in the embodiment of the present invention will be further described in detail below:

条码是将宽度不等的多个黑条和空白,按照一定的编码规则排列,用以表达一组信息的图形标识符。如果把条码看作一组有规律排列的直线,那么只要检测出来标签上的所有直线即可。本发明实施例中优选采用直线检测法来对条码进行区域定位,采用直线检测的方法来对条码进行区域定位,可以有效处理条码质量外观显著退化情形,即使条码角度、尺寸和阴影出现变化,甚至在条码出现缺损的情况下仍然可以有效的定位出条码所在位置,从而可实现条码区域定位;而且,利用直线检测法,只需读取一个条形码的部分黑条即可以确定条码的位置,无需精确读取所有黑条即可粗略定位条码位置。A barcode is a graphic identifier that arranges multiple black bars and blanks with different widths according to certain coding rules to express a set of information. If the barcode is regarded as a set of regularly arranged straight lines, then it is only necessary to detect all the straight lines on the label. In the embodiment of the present invention, the linear detection method is preferably used to locate the area of the barcode. Using the method of linear detection to locate the area of the barcode can effectively deal with the situation where the quality and appearance of the barcode are significantly degraded, even if the angle, size and shadow of the barcode change. In the case of a barcode defect, the position of the barcode can still be effectively located, so that the location of the barcode area can be realized; moreover, by using the straight line detection method, the position of the barcode can be determined by reading only part of the black bar of a barcode, without the need for precision The barcode position can be roughly located by reading all the black bars.

本发明实施例中,根据条码的条形排列的特点,采用霍夫变换算法对标签上的条码进行直线检测,其主要原理是运用直线的极坐标公式:ρ=хcos(θ)+уsin(θ);ρ、θ是一对参数(请对ρ、θ的具体参数定义进行补充说明,谢谢),在平面内取一个定点O,叫极点,引一条射线Ox,叫做极轴,再选定一个长度单位和角度的正方向(通常取逆时针方向)。对于平面内任何一点M,用ρ表示线段OM的长度,θ表示从Ox到OM的角度,ρ叫做点M的极径,θ叫做点M的极角,有序数对(ρ,θ)就叫点M的极坐标,这样建立的坐标系叫做极坐标系。通过对图像中的像素点运用这个公式处理就可以得到二维的ρ,θ参数空间,在参数空间会形成峰值,从而利用峰值就可以检测出直线。任意一条检测出来的直线的两个端点记做:pi=(xi,yi),qi=(mi,ni)(i=1,2...k),如图3所示。通过对每条直线两个端点的位置坐标计算,得到所有能检测到的条码黑条的长度与斜率,任意直线的长度和倾斜角度分别为:In the embodiment of the present invention, according to the characteristics of the bar-shaped arrangement of the barcode, the Hough transform algorithm is used to detect the barcode on the label as a straight line. The main principle is to use the polar coordinate formula of the straight line: ρ=хcos(θ)+уsin(θ ); ρ, θ are a pair of parameters (please give a supplementary explanation of the specific parameter definitions of ρ, θ, thank you), take a fixed point O in the plane, called the pole, lead a ray Ox, called the polar axis, and then select a The positive direction of length units and angles (usually counterclockwise). For any point M in the plane, use ρ to represent the length of line segment OM, θ to represent the angle from Ox to OM, ρ is called the polar diameter of point M, θ is called the polar angle of point M, and the ordered pair (ρ, θ) is called The polar coordinates of point M, the coordinate system established in this way is called polar coordinate system. By applying this formula to the pixels in the image, the two-dimensional ρ, θ parameter space can be obtained, and a peak will be formed in the parameter space, so that the straight line can be detected by using the peak. The two endpoints of any detected straight line are recorded as: p i =( xi ,y i ),q i =(m i ,n i )(i=1,2...k), as shown in Figure 3 Show. By calculating the position coordinates of the two endpoints of each straight line, the length and slope of all detectable black bars of the barcode are obtained. The length and inclination angle of any straight line are:

dd ii == (( xx ii -- mm ii )) 22 ++ (( ythe y ii -- nno ii )) 22 -- -- -- (( 11 )) ,, θθ ii == arctanarctan ythe y ii -- nno ii xx ii -- mm ii -- -- -- (( 22 )) ..

若xi-mi=0,则该直线为垂直方向,无需做逆时针旋转;若xi-mi≠0,基于在同一个标签上的条码旋转的角度一致这个事实,如果检测到的直线属于条形码区域则直线的倾斜角度应该非常接近,受前述所述的预处理中的二值化处理等的影响,式(2)计算得到的直线的倾斜角度与真实角度会存在一定的误差,故选取所有检测到的直线的倾斜角度的中位值作为参考值,只要θi属于中位值正负1度范围之内,则保留该倾斜角度。计算所有保留下来的倾斜角度的平均值作为标签的倾斜矫正度数,据此对原始标签图像进行逆时针旋转矫正,并保留这些条码作为条码的粗定位区域。If x i -m i =0, then the straight line is in the vertical direction, no counterclockwise rotation is required; if x i -m i ≠0, based on the fact that the rotation angles of the barcodes on the same label are consistent, if the If the straight line belongs to the barcode area, the inclination angle of the straight line should be very close. Due to the influence of the binarization processing in the aforementioned preprocessing, there will be a certain error between the inclination angle of the straight line calculated by formula (2) and the real angle. Therefore, the median value of the inclination angles of all detected straight lines is selected as a reference value, and as long as θ i is within the range of plus or minus 1 degree of the median value, the inclination angle is retained. Calculate the average value of all retained tilt angles as the tilt correction degree of the label, based on which the original label image is corrected counterclockwise, and these barcodes are reserved as the rough positioning area of the barcode.

在对多条码标签中的所有条码进行区域定位时,由于实际噪声的影响,如果仅用线检测的方法来确定直线的条码的上下区域,则误差比较大。通过分析可以,非条码区域的空白比较明显,可以根据上述检测得出的大部分条码线条端点位置坐标,保留长度相当的直线,所有保留的直线的平均值记做同时得到每条直线的中点位置获取每个条码的中心线l,并进行倾斜角度旋转,以中心线l的上下作为条码的粗定位区域。When performing area positioning on all barcodes in a multi-barcode label, due to the influence of actual noise, if only the line detection method is used to determine the upper and lower areas of the barcode of the straight line, the error will be relatively large. Through the analysis, the blanks in the non-barcode area are relatively obvious. According to the position coordinates of most of the barcode line endpoints obtained from the above detection, straight lines with equivalent lengths can be reserved, and the average value of all reserved straight lines can be recorded as At the same time get the midpoint position of each straight line Obtain the centerline l of each barcode, and rotate it at an oblique angle to the up and down of the centerline l As a coarse positioning area for barcodes.

为了精确地定位出条码上下区域,在所述粗定位区域采用归一化互相关匹配(NCC)算法来进行精确定位。NCC算法是通过比较两列数据的相关性,来衡量其匹配的程度,其中相关系数最大的位置就是最佳匹配位置。假设f(xi),g(xi)为条码的任意两行,它们对应的均值和方差分别记做在条码区域任意选择两行分别向上向下平移,则归一化互相关系数定义为:In order to accurately locate the upper and lower areas of the barcode, a normalized cross-correlation (NCC) algorithm is used in the rough positioning area to perform precise positioning. The NCC algorithm measures the degree of matching by comparing the correlation of two columns of data, and the position with the largest correlation coefficient is the best matching position. Assuming that f( xi ), g( xi ) are any two lines of the barcode, their corresponding mean and variance are recorded as and Randomly select two lines in the barcode area to translate up and down respectively, then the normalized cross-correlation coefficient is defined as:

RR == 11 nno -- 11 ΣΣ ii == 11 nno (( ff (( xx ii )) -- μμ ff )) (( gg (( xx ii )) -- μμ gg )) δδ ff ×× δδ gg -- -- -- (( 33 ))

设定阈值T,则当R>T时,否则为条码上下区域。由于NCC算法具有很高的准确性、适应性,但运算量比较大,因此采用霍夫变换直线检测算法对原始图像进行感兴趣区域的提取,对每个条码区域的上下边界进行粗定位,非条码区域得到了有效的剔除,减少了运算量。通过上述NCC算法和霍夫变换直线检测算法,可以精确的确定条码所在区域的边缘线。Set the threshold T, then when R>T, otherwise it is the upper and lower areas of the barcode. Because the NCC algorithm has high accuracy and adaptability, but the amount of calculation is relatively large, the Hough transform line detection algorithm is used to extract the region of interest from the original image, and the upper and lower boundaries of each barcode area are roughly positioned. The barcode area is effectively eliminated, reducing the amount of calculation. Through the above-mentioned NCC algorithm and the Hough transform line detection algorithm, the edge line of the area where the barcode is located can be accurately determined.

条码左右区域定位,包括同一行中存在的条码数的检测和每个条码的条码左右区域定位,从而可实现多条码标签中所有条码的区域定位。在灰度图上对中心线l进行直线灰度值扫描,可得到每个条码的中心线l的灰度值分布图。由于在图像二值化过程中,条码的左右边界很容易因为质量、噪声等原因而缺损,如果直接在二值图像上进行扫描,这种缺损将直接导致条码左右区域定位的不准确,所以采用灰度图进行条码区域的左右区域进行定位。Barcode left and right area positioning, including the detection of the number of barcodes in the same line and the barcode left and right area positioning of each barcode, so as to realize the area positioning of all barcodes in multi-barcode labels. Carry out linear gray value scanning on the center line l on the gray scale image, and the gray value distribution map of the center line l of each barcode can be obtained. Because in the process of image binarization, the left and right borders of the barcode are easily damaged due to quality, noise and other reasons. If you scan directly on the binary image, this defect will directly lead to inaccurate positioning of the left and right areas of the barcode, so use The grayscale image is used to locate the left and right areas of the barcode area.

根据条码的特征可知,条码的左右边界处会有一段空白区域,如图4(图4中为具有一个条码的中心线的灰度值分布图)中灰度值为0的地方;如在同一行出现多个条码,条码间的空白区域会更大,如图5(图5中为同一行中具有两个条码的中心线的灰度值分布图)所示。为进一步确定条码区域的左右边缘,对分布图上的像素数据进行累加运算,设中心线灰度值数组为LineA,累加运算后产生一个新的数组为LineB,即:According to the characteristics of the barcode, there will be a blank area at the left and right borders of the barcode, as shown in Figure 4 (the gray value distribution diagram with a barcode center line in Figure 4) where the gray value is 0; If multiple barcodes appear in a row, the blank area between the barcodes will be larger, as shown in Figure 5 (the gray value distribution diagram of the center line with two barcodes in the same row in Figure 5). In order to further determine the left and right edges of the barcode area, the pixel data on the distribution map is accumulated, and the gray value array of the center line is LineA. After the accumulation operation, a new array is generated as LineB, namely:

LineA={x1,x2,x3...xn}, LineA={x 1 ,x 2 ,x 3 ... x n },

其中,LineB[0]=LineA[0]。Among them, LineB[0]=LineA[0].

图6为图4中的条码中心线灰度值累加分布图,图7为图6中的条码中心线灰度值累加分布图;其中,图6与图7中水平部分(即斜率为0)即为条码区域间的分界处,据此即可实现对条码的左右区域的定位。Fig. 6 is the accumulative distribution diagram of the barcode centerline gray value in Fig. 4, and Fig. 7 is the accumulative distribution diagram of the barcode centerline gray value in Fig. 6; wherein, the horizontal part (that is, the slope is 0) in Fig. 6 and Fig. 7 That is, the boundary between the barcode areas, according to which the positioning of the left and right areas of the barcode can be realized.

其余的步骤S1、S2、S3A、S4等步骤可采用现有技术来实现,在此不再详述。The remaining steps S1, S2, S3A, S4 and other steps can be realized by using existing technologies, and will not be described in detail here.

利用本实施例提供的基于机器视觉系统的条码检测识别方法,在对具有的标签进行条码的识别过程中,即使是倾斜条码、单标签多条码、单行多条码,部分缺失的条码、具有污渍的条码等都可以获得较满意的识别效果,同时还可实现任意方向条码和多条码的自动化识别,而且识别速度快、识别效率高等优点,从而可有效满足企业大规模自动化工业生产的需求。Using the barcode detection and recognition method based on the machine vision system provided in this embodiment, in the process of barcode recognition for labels, even if it is an oblique barcode, multiple barcodes on a single label, or multiple barcodes on a single line, partially missing barcodes, stained Barcodes can achieve satisfactory recognition results, and at the same time, automatic recognition of barcodes in any direction and multiple barcodes can be realized, and the recognition speed is fast and the recognition efficiency is high, so that it can effectively meet the needs of large-scale automated industrial production of enterprises.

基于上述实施例中所述方法的发明构思,本发明的实施例还提供了一种基于机器视觉系统的条码检测识别系统,如附图2所示,所述系统包括机器视觉系统主机,所述机器视觉系统主机连接有光源模块和图像采集模块,所述图像采集模块用于与光源模块配合,对具有多条条码的标签进行图像数据采集,并将采集到的图像数据传输至所述器视觉系统主机中,所述机器视觉系统主机包括:Based on the inventive concept of the method described in the above embodiments, the embodiment of the present invention also provides a barcode detection and recognition system based on a machine vision system, as shown in Figure 2, the system includes a machine vision system host, the The machine vision system host is connected with a light source module and an image acquisition module. The image acquisition module is used to cooperate with the light source module to collect image data on labels with multiple barcodes, and transmit the collected image data to the machine vision In the system host, the machine vision system host includes:

图像数据预处理模块,用于对所述图像数据进行预处理,以将获取的图像数据进行标签与背景的分离,从而过滤背景的干扰;所述的预处理,优选包括滤波、去噪、增强和/或二值化处理;The image data preprocessing module is used to preprocess the image data, so as to separate the acquired image data from the label and the background, so as to filter the interference of the background; the preprocessing preferably includes filtering, denoising, enhancing and/or binarization;

条码区域定位模块,用于将图像数据预处理模块进行所预处理后的图像数据进行条码特征提取,并对条码进行区域定位,以确定所述标签上所有条码的所在区域,该所在区域即为具有所述标签上所有条码的条码区域;The barcode area positioning module is used to perform barcode feature extraction on the image data preprocessed by the image data preprocessing module, and perform area positioning on the barcode to determine the area where all the barcodes on the label are located. The area is a barcode area with all barcodes on said label;

其中,所述条码区域包括条码上下区域和条码左右区域,所述条码区域定位包括条码上下区域定位和条码左右区域定位,分别利用所述条码上下区域定位、条码左右区域定位来确定条码的行数、同一行条码中存在的条码数,以实现对所述标签上所有条码的区域定位;Wherein, the barcode area includes the upper and lower areas of the barcode and the left and right areas of the barcode, and the positioning of the barcode area includes the positioning of the upper and lower areas of the barcode and the positioning of the left and right areas of the barcode. , the number of barcodes existing in the same row of barcodes, so as to realize the regional positioning of all barcodes on the label;

条码识别模块,用于对所述条码区域内的每一条码进行条码识别。The barcode recognition module is used to perform barcode recognition on each barcode in the barcode area.

作为优选的实施例,所述机器视觉系统主机还包括:As a preferred embodiment, the machine vision system host also includes:

条码区域调整模块,用于对所述条码区域的左右边界分别进行扩展K个像素的调整处理,并对所述条码区域的上下边界分别进行缩小P个像素的调整处理,最后对调整处理后的条码区域作为最终的条码区域。通过增加所述条码区域调整模块,可有效防止漏码的情况出现和有效提高条码识别的稳定性。其中,所述K、P为正整数,具体取值根据需要选取,本实施例中,所述K=P=15。The barcode area adjustment module is used to adjust the left and right boundaries of the barcode area by expanding K pixels respectively, and adjust the upper and lower boundaries of the barcode area by shrinking P pixels, and finally adjust the adjusted The barcode field acts as the final barcode field. By adding the barcode area adjustment module, the occurrence of missing codes can be effectively prevented and the stability of barcode recognition can be effectively improved. Wherein, the K and P are positive integers, and the specific values are selected according to the needs. In this embodiment, the K=P=15.

在本实施例中,所述条码区域定位模块包括条码特征提取模块、倾斜校正模块,条码左右区域定位模块以及条码上下区域定位模块,各功能模块的连接关系如图2所示,在此不再详述。In this embodiment, the barcode area positioning module includes a barcode feature extraction module, a tilt correction module, a barcode left and right area positioning module, and a barcode upper and lower area positioning module. The connection relationship of each functional module is shown in Figure 2, and will not be repeated here detail.

在本实施例中,所述图像采集模块优选为具有GIGE接口的工业相机,相应地,所述机器视觉系统主机具有GIGE接口,机器视觉系统主机通过GIGE接口与工业相机连接。另外,所述机器视觉系统主机还设置有光源控制模块,所述机器视觉系统主机通过该光源控制模块与光源模块连接。In this embodiment, the image acquisition module is preferably an industrial camera with a GIGE interface. Correspondingly, the machine vision system host has a GIGE interface, and the machine vision system host is connected to the industrial camera through the GIGE interface. In addition, the machine vision system host is also provided with a light source control module, and the machine vision system host is connected to the light source module through the light source control module.

本实施例中的基于机器视觉系统的条码检测识别系统,其各功能模块的工作原理/工作过程如上述实施例中所述的基于机器视觉系统的条码检测识别方法相对应的步骤所述,在此不再赘述。In the barcode detection and recognition system based on the machine vision system in this embodiment, the working principle/working process of each functional module is as described in the corresponding steps of the barcode detection and recognition method based on the machine vision system described in the above embodiment. This will not be repeated here.

需要说明的是,上述各功能模块,可以将将它们中的多个功能模块集成一个电路功能模块来实现,也可以将其中的一个功能模块分别制作成多个功能模块来实现。It should be noted that, the above functional modules can be implemented by integrating multiple functional modules among them into one circuit functional module, or can be realized by making one functional module into multiple functional modules respectively.

利用本发明实施例提供的基于机器视觉系统的条码检测识别方法及系统,无需进行人工操作,即可对具有条码的产品进行自动扫描并对条码进行识别,其具有自动化程度高、识别速度快,工作效率高等优点;在条码的识别过程中,即使是倾斜条码、单标签多条码、单行多条码,部分缺失的条码、具有污渍的条码等都可以获得较满意的识别效果,同时还可实现任意方向条码和多条码的自动化识别,而且识别速度快、识别效率高等优点,从而可有效满足企业大规模自动化工业生产的需求。Using the barcode detection and recognition method and system based on the machine vision system provided by the embodiment of the present invention, products with barcodes can be automatically scanned and barcodes can be recognized without manual operation, which has a high degree of automation and fast recognition speed. High work efficiency and other advantages; in the process of barcode recognition, even oblique barcodes, multiple barcodes on a single label, multiple barcodes on a single line, partly missing barcodes, and stained barcodes can obtain satisfactory recognition results, and at the same time can achieve arbitrary Automatic recognition of direction barcodes and multi-barcodes, and the advantages of fast recognition speed and high recognition efficiency, which can effectively meet the needs of large-scale automated industrial production of enterprises.

上述实施例中提到的内容为本发明较佳的实施方式,并非是对本发明的限定,在不脱离本发明构思的前提下,任何显而易见的替换均在本发明的保护范围之内。The content mentioned in the above examples is the preferred implementation mode of the present invention, and is not a limitation of the present invention. Without departing from the concept of the present invention, any obvious replacements are within the protection scope of the present invention.

Claims (10)

1.一种基于机器视觉系统的条码检测识别方法,所述方法应用于机器视觉系统主机中,所述机器视觉系统主机连接有光源模块和图像采集模块,其特征在于,所述方法包括以下步骤:1. A barcode detection and recognition method based on a machine vision system, said method is applied in a machine vision system host, said machine vision system host is connected with a light source module and an image acquisition module, it is characterized in that said method comprises the following steps : S1、图像数据采集步骤,通过所述图像采集模块与光源模块的配合,对具有多条条码的标签进行图像数据采集,并将采集到的图像数据传输至所述器视觉系统主机;S1. The image data acquisition step, through the cooperation of the image acquisition module and the light source module, image data acquisition is performed on labels with multiple barcodes, and the acquired image data is transmitted to the host of the device vision system; S2、图像数据预处理步骤,所述机器视觉系统主机对所述图像数据进行预处理,以将获取的图像数据进行标签与背景的分离,从而过滤背景的干扰;S2. Image data preprocessing step, the machine vision system host performs preprocessing on the image data, so as to separate the acquired image data from the label and the background, thereby filtering background interference; S3、条码区域定位步骤,所述机器视觉系统主机对图像数据预处理步骤处理后的图像数据进行条码特征提取,并对条码进行区域定位,以确定所述标签上所有条码的所在区域,该所在区域即为具有所述标签上所有条码的条码区域;S3, the barcode area positioning step, the machine vision system host performs barcode feature extraction on the image data processed by the image data preprocessing step, and performs area positioning on the barcode to determine the location of all the barcodes on the label. The area is the barcode area with all the barcodes on the label; 其中,所述条码区域包括条码上下区域和条码左右区域,所述条码区域定位包括条码上下区域定位和条码左右区域定位,分别利用所述条码上下区域定位、条码左右区域定位来确定条码的行数、同一行条码中存在的条码数,以实现对所述标签上所有条码的区域定位;Wherein, the barcode area includes the upper and lower areas of the barcode and the left and right areas of the barcode, and the positioning of the barcode area includes the positioning of the upper and lower areas of the barcode and the positioning of the left and right areas of the barcode. , the number of barcodes existing in the same row of barcodes, so as to realize the regional positioning of all barcodes on the label; S4、条码识别步骤,对所述条码区域内的每一条码进行条码识别。S4. A barcode recognition step, performing barcode recognition on each barcode in the barcode area. 2.根据权利要求1所述的方法,其特征在于:在所述条码区域定位步骤S3之后、所述条码识别步骤S4之前还包括以下步骤:2. The method according to claim 1, characterized in that: after the barcode area positioning step S3, before the barcode recognition step S4, the following steps are also included: S3A、条码区域调整步骤,对所述条码区域的左右边界分别进行扩展K个像素的调整处理,并对所述条码区域的上下边界分别进行缩小P个像素的调整处理,最后对调整处理后的条码区域作为最终的条码区域,其中所述K、P为正整数,具体取值根据需要选取。S3A, the barcode area adjustment step, the left and right boundaries of the barcode area are respectively adjusted by expanding K pixels, and the upper and lower boundaries of the barcode area are respectively adjusted by reducing P pixels, and finally the adjusted The barcode area is used as the final barcode area, wherein the K and P are positive integers, and the specific values are selected according to requirements. 3.根据权利要求2所述的方法,其特征在于:所述条码区域定位步骤S3中,在所述条码上下区域定位过程中,采用归一化互相关匹配算法与霍夫变换直线检测算法来确定所述条码上下区域。3. The method according to claim 2, characterized in that: in the barcode area positioning step S3, in the barcode upper and lower area positioning process, the normalized cross-correlation matching algorithm and the Hough transform line detection algorithm are used to Determine the upper and lower regions of the barcode. 4.根据权利要求3所述的方法,其特征在于:所述条码区域定位步骤S3中,在进行所述条码左右区域定位过程中,对预处理后的图像的灰度图上对各条码的中心线进行直线灰度值扫描,以获得每个条码的中心线的灰度值分布图,对灰度值分布图上的像素数据进行累加运算,设中心线灰度值数组为LineA,累加运算后产生一个新的数组为LineB,根据所述数组LineA与数据LineB建立条码的中心线灰度值累加分布图,通过所述中心线灰度值累加分布图中的水平部分的直线来确定所述条码左右区域定位。4. The method according to claim 3, characterized in that: in the barcode area locating step S3, in the process of locating the left and right areas of the barcode, each barcode on the grayscale image of the preprocessed image Scan the gray value of the center line in a straight line to obtain the distribution map of the gray value of the center line of each barcode, and perform an accumulation operation on the pixel data on the distribution map of the gray value. Set the gray value array of the center line as LineA, and perform the accumulation operation Generate a new array after the LineB, according to the array LineA and data LineB, set up the center line gray value cumulative distribution map of the barcode, determine the straight line of the horizontal part in the horizontal part of the center line gray value cumulative distribution map. Barcode left and right area positioning. 5.根据权利要求1~4中任一项所述的方法,其特征在于:所述图像数据预处理步骤S2中,所述机器视觉系统主机对所述图像数据进行的预处理,包括滤波、去噪、增强和/或二值化处理。5. The method according to any one of claims 1 to 4, characterized in that: in the image data preprocessing step S2, the preprocessing performed by the machine vision system host on the image data includes filtering, Denoising, enhancement and/or binarization. 6.一种基于机器视觉系统的条码检测识别系统,所述系统包括机器视觉系统主机,所述机器视觉系统主机连接有光源模块和图像采集模块,所述图像采集模块用于与光源模块配合,对具有多条条码的标签进行图像数据采集,并将采集到的图像数据传输至所述器视觉系统主机中,其特征在于,所述机器视觉系统主机包括:6. A barcode detection and recognition system based on a machine vision system, the system includes a machine vision system host, the machine vision system host is connected with a light source module and an image acquisition module, and the image acquisition module is used to cooperate with the light source module, Carry out image data collection to labels with multiple barcodes, and transmit the collected image data to the machine vision system host, it is characterized in that the machine vision system host includes: 图像数据预处理模块,用于对所述图像数据进行预处理,以将获取的图像数据进行标签与背景的分离,从而过滤背景的干扰;An image data preprocessing module, configured to preprocess the image data, so as to separate the acquired image data from the label and the background, thereby filtering background interference; 条码区域定位模块,用于将图像数据预处理模块进行所预处理后的图像数据进行条码特征提取,并对条码进行区域定位,以确定所述标签上所有条码的所在区域,该所在区域即为具有所述标签上所有条码的条码区域;The barcode area positioning module is used to perform barcode feature extraction on the image data preprocessed by the image data preprocessing module, and perform area positioning on the barcode to determine the area where all the barcodes on the label are located. The area is a barcode area with all barcodes on said label; 其中,所述条码区域包括条码上下区域和条码左右区域,所述条码区域定位包括条码上下区域定位和条码左右区域定位,分别利用所述条码上下区域定位、条码左右区域定位来确定条码的行数、同一行条码中存在的条码数,以实现对所述标签上所有条码的区域定位;Wherein, the barcode area includes the upper and lower areas of the barcode and the left and right areas of the barcode, and the positioning of the barcode area includes the positioning of the upper and lower areas of the barcode and the positioning of the left and right areas of the barcode. , the number of barcodes existing in the same row of barcodes, so as to realize the regional positioning of all barcodes on the label; 条码识别模块,用于对所述条码区域内的每一条码进行条码识别。The barcode recognition module is used to perform barcode recognition on each barcode in the barcode area. 7.根据权利要求6所述的系统,其特征在于:所述机器视觉系统主机还包括:7. The system according to claim 6, characterized in that: the machine vision system host also includes: 条码区域调整模块,用于对所述条码区域的左右边界分别进行扩展K个像素的调整处理,并对所述条码区域的上下边界分别进行缩小P个像素的调整处理,最后对调整处理后的条码区域作为最终的条码区域,其中所述K、P为正整数,具体取值根据需要选取。The barcode area adjustment module is used to adjust the left and right boundaries of the barcode area by expanding K pixels respectively, and adjust the upper and lower boundaries of the barcode area by shrinking P pixels, and finally adjust the adjusted The barcode area is used as the final barcode area, wherein the K and P are positive integers, and the specific values are selected according to requirements. 8.根据权利要求7所述的系统,其特征在于:所述条码区域定位模块,在进行所述条码上下区域定位过程中,采用归一化互相关匹配算法与霍夫变换直线检测算法来确定所述条码上下区域。8. The system according to claim 7, characterized in that: the barcode area positioning module, in the process of positioning the upper and lower areas of the barcode, adopts a normalized cross-correlation matching algorithm and a Hough transform line detection algorithm to determine The upper and lower regions of the barcode. 9.根据权利要求8所述的系统,其特征在于:所述条码区域定位模块,在进行所述条码左右区域定位过程中,对预处理后的图像的灰度图上对各条码的中心线进行直线灰度值扫描,以获得每个条码的中心线的灰度值分布图,对灰度值分布图上的像素数据进行累加运算,设中心线灰度值数组为LineA,累加运算后产生一个新的数组为LineB,根据所述数组LineA与数据LineB建立条码的中心线灰度值累加分布图,通过所述中心线灰度值累加分布图中的水平部分的直线来确定所述条码左右区域定位。9. The system according to claim 8, characterized in that: the barcode area positioning module, in the process of positioning the left and right areas of the barcode, the center line of each barcode on the grayscale image of the preprocessed image Carry out straight-line gray value scanning to obtain the gray value distribution map of the center line of each barcode, and perform cumulative operations on the pixel data on the gray value distribution map, set the center line gray value array as LineA, and generate after the cumulative operation A new array is LineB, and according to the array LineA and the data LineB, the center line gray value accumulation distribution map of the barcode is established, and the left and right sides of the bar code are determined by the straight lines in the horizontal part of the center line gray value accumulation distribution map. Regional targeting. 10.根据权利要求6~9中任一项所述的系统,其特征在于:所述图像数据预处理模块对所述图像数据进行的预处理,包括滤波、去噪、增强和/或二值化处理。10. The system according to any one of claims 6-9, characterized in that: the image data preprocessing module performs preprocessing on the image data, including filtering, denoising, enhancement and/or binary processing.
CN201610389625.0A 2016-06-01 2016-06-01 A kind of bar code detection recognition method and system based on NI Vision Builder for Automated Inspection Active CN106056020B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610389625.0A CN106056020B (en) 2016-06-01 2016-06-01 A kind of bar code detection recognition method and system based on NI Vision Builder for Automated Inspection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610389625.0A CN106056020B (en) 2016-06-01 2016-06-01 A kind of bar code detection recognition method and system based on NI Vision Builder for Automated Inspection

Publications (2)

Publication Number Publication Date
CN106056020A true CN106056020A (en) 2016-10-26
CN106056020B CN106056020B (en) 2018-09-25

Family

ID=57170110

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610389625.0A Active CN106056020B (en) 2016-06-01 2016-06-01 A kind of bar code detection recognition method and system based on NI Vision Builder for Automated Inspection

Country Status (1)

Country Link
CN (1) CN106056020B (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106778719A (en) * 2016-11-11 2017-05-31 广州弥特智能科技有限公司 It is a kind of to improve the method that on-line continuous gather bar code successfully decoded rate
CN107609450A (en) * 2017-09-08 2018-01-19 苏州佳世达光电有限公司 Bar code discrimination method
CN109165538A (en) * 2018-07-18 2019-01-08 北京飞搜科技有限公司 Bar code detection method and device based on deep neural network
CN109670363A (en) * 2018-10-31 2019-04-23 江西索立德环保服务有限公司 A kind of sampling system having automatic identification sample number into spectrum
CN109829346A (en) * 2019-01-11 2019-05-31 安徽工程大学 A kind of bar code and two-dimensional code identification method and system based on machine vision
CN110119799A (en) * 2019-05-11 2019-08-13 安图实验仪器(郑州)有限公司 Sample rack heparin tube bar code visual identity method
CN110532826A (en) * 2019-08-21 2019-12-03 厦门壹普智慧科技有限公司 A kind of bar code identifying device and method based on artificial intelligence semantic segmentation
CN110532832A (en) * 2018-05-24 2019-12-03 广东技术师范学院 A kind of bar code high-precision recognition methods based on computer vision
CN110532825A (en) * 2019-08-21 2019-12-03 厦门壹普智慧科技有限公司 A kind of bar code identifying device and method based on artificial intelligence target detection
CN110795955A (en) * 2019-07-30 2020-02-14 广东工业大学 System and method for rapidly identifying multiple bar codes
CN111639507A (en) * 2020-05-29 2020-09-08 天津维创微智能科技有限公司 Method and device for positioning bar code in image, code scanning device and storage medium
CN112347866A (en) * 2020-10-22 2021-02-09 上海铂端科技有限公司 System and method for realizing attachment assembly fool-proof detection processing based on machine vision
CN116681675A (en) * 2023-06-07 2023-09-01 深圳鑫振华光电科技有限公司 An automated control system and method based on big data analysis

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102663337A (en) * 2012-03-16 2012-09-12 江南大学 Method for quick Data Matrix two-dimensional barcode identifying under simple condition background
CN104657728A (en) * 2015-03-19 2015-05-27 江苏物联网研究发展中心 Barcode recognition system based on computer vision
CN104680109A (en) * 2013-12-03 2015-06-03 航天信息股份有限公司 Image recognition-based location method for bar code area
CN104992449A (en) * 2015-08-06 2015-10-21 西安冉科信息技术有限公司 Information identification and surface defect on-line detection method based on machine visual sense

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102663337A (en) * 2012-03-16 2012-09-12 江南大学 Method for quick Data Matrix two-dimensional barcode identifying under simple condition background
CN104680109A (en) * 2013-12-03 2015-06-03 航天信息股份有限公司 Image recognition-based location method for bar code area
CN104657728A (en) * 2015-03-19 2015-05-27 江苏物联网研究发展中心 Barcode recognition system based on computer vision
CN104992449A (en) * 2015-08-06 2015-10-21 西安冉科信息技术有限公司 Information identification and surface defect on-line detection method based on machine visual sense

Cited By (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106778719A (en) * 2016-11-11 2017-05-31 广州弥特智能科技有限公司 It is a kind of to improve the method that on-line continuous gather bar code successfully decoded rate
CN107609450B (en) * 2017-09-08 2020-06-26 苏州佳世达光电有限公司 Bar code identification method
CN107609450A (en) * 2017-09-08 2018-01-19 苏州佳世达光电有限公司 Bar code discrimination method
CN110532832A (en) * 2018-05-24 2019-12-03 广东技术师范学院 A kind of bar code high-precision recognition methods based on computer vision
CN109165538A (en) * 2018-07-18 2019-01-08 北京飞搜科技有限公司 Bar code detection method and device based on deep neural network
CN109165538B (en) * 2018-07-18 2021-10-22 苏州飞搜科技有限公司 Bar code detection method and device based on deep neural network
CN109670363A (en) * 2018-10-31 2019-04-23 江西索立德环保服务有限公司 A kind of sampling system having automatic identification sample number into spectrum
CN109829346A (en) * 2019-01-11 2019-05-31 安徽工程大学 A kind of bar code and two-dimensional code identification method and system based on machine vision
CN110119799A (en) * 2019-05-11 2019-08-13 安图实验仪器(郑州)有限公司 Sample rack heparin tube bar code visual identity method
CN110795955A (en) * 2019-07-30 2020-02-14 广东工业大学 System and method for rapidly identifying multiple bar codes
CN110532825A (en) * 2019-08-21 2019-12-03 厦门壹普智慧科技有限公司 A kind of bar code identifying device and method based on artificial intelligence target detection
CN110532826A (en) * 2019-08-21 2019-12-03 厦门壹普智慧科技有限公司 A kind of bar code identifying device and method based on artificial intelligence semantic segmentation
CN110532825B (en) * 2019-08-21 2022-09-30 厦门壹普智慧科技有限公司 Bar code identification device and method based on artificial intelligence target detection
CN110532826B (en) * 2019-08-21 2022-09-30 厦门壹普智慧科技有限公司 Bar code recognition device and method based on artificial intelligence semantic segmentation
CN111639507A (en) * 2020-05-29 2020-09-08 天津维创微智能科技有限公司 Method and device for positioning bar code in image, code scanning device and storage medium
CN111639507B (en) * 2020-05-29 2023-06-09 天津维创微智能科技有限公司 Positioning method and device for bar codes in image, code scanning equipment and storage medium
CN112347866A (en) * 2020-10-22 2021-02-09 上海铂端科技有限公司 System and method for realizing attachment assembly fool-proof detection processing based on machine vision
CN116681675A (en) * 2023-06-07 2023-09-01 深圳鑫振华光电科技有限公司 An automated control system and method based on big data analysis

Also Published As

Publication number Publication date
CN106056020B (en) 2018-09-25

Similar Documents

Publication Publication Date Title
CN106056020B (en) A kind of bar code detection recognition method and system based on NI Vision Builder for Automated Inspection
CN107609557B (en) Pointer instrument reading identification method
CN103729655B (en) A kind of detection method for slice component vision localization
CN109839385B (en) Self-adaptive PCB defect visual positioning detection and classification system
CN106960208B (en) Method and system for automatically segmenting and identifying instrument liquid crystal number
CN103258201B (en) A kind of form lines extracting method of amalgamation of global and local message
CN104616275A (en) Defect detecting method and defect detecting device
CN106156684B (en) A kind of two-dimensional code identification method and device
CN104809433B (en) A kind of zebra line detecting method based on maximum stable region and stochastical sampling
CN103258198A (en) Extraction method for characters in form document image
CN109540925B (en) Complex ceramic tile surface defect detection method based on difference method and local variance measurement operator
CN103294980A (en) Micro-QR (Quick Response) code recognition method based on picture processing
CN104657728B (en) Processing in Barcode Recognizing System based on computer vision
CN112233116B (en) Concave-convex mark visual detection method based on neighborhood decision and gray level co-occurrence matrix description
CN105825169A (en) Road-image-based pavement crack identification method
CN104463066A (en) Method for rapidly positioning and recognizing one-dimensional barcode of outer commodity package
CN103745221A (en) Two-dimensional code image correction method
CN106778754A (en) A kind of industrial ammeter digit recognition method of robust
CN118015004B (en) Laser cutting scanning system and method
CN114004799B (en) A tire barcode recognition method, system and device based on machine vision
CN112419225B (en) SOP type chip detection method and system based on pin segmentation
CN110969612B (en) Two-dimensional code printing defect detection method
CN105488448A (en) Barcode and two-dimensional code distinguishing method
CN104009144B (en) Substrate and the matching process of chip in the welding of great power LED eutectic
CN114266719B (en) Hough transform-based product detection method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
EE01 Entry into force of recordation of patent licensing contract

Application publication date: 20161026

Assignee: GUANGDONG RONGZHENG INFORMATION TECHNOLOGY Co.,Ltd.

Assignor: DONGGUAN University OF TECHNOLOGY

Contract record no.: X2022440000288

Denomination of invention: A Bar Code Detection and Recognition Method and System Based on Machine Vision System

Granted publication date: 20180925

License type: Common License

Record date: 20221130

EE01 Entry into force of recordation of patent licensing contract
EE01 Entry into force of recordation of patent licensing contract

Application publication date: 20161026

Assignee: Xiamen Wenyi Network Technology Co.,Ltd.

Assignor: DONGGUAN University OF TECHNOLOGY

Contract record no.: X2022980027702

Denomination of invention: A bar code detection and recognition method and system based on machine vision system

Granted publication date: 20180925

License type: Common License

Record date: 20230103

EE01 Entry into force of recordation of patent licensing contract
EE01 Entry into force of recordation of patent licensing contract

Application publication date: 20161026

Assignee: Guangzhou Dongtong Technology Co.,Ltd.

Assignor: DONGGUAN University OF TECHNOLOGY

Contract record no.: X2023990000097

Denomination of invention: A bar code detection and recognition method and system based on machine vision system

Granted publication date: 20180925

License type: Common License

Record date: 20230112

EE01 Entry into force of recordation of patent licensing contract
EE01 Entry into force of recordation of patent licensing contract

Application publication date: 20161026

Assignee: Yantai Yuanzhen Label Printing Co.,Ltd.

Assignor: DONGGUAN University OF TECHNOLOGY

Contract record no.: X2023980033506

Denomination of invention: A Method and System for Bar Code Detection and Recognition Based on Machine Vision System

Granted publication date: 20180925

License type: Common License

Record date: 20230313

EE01 Entry into force of recordation of patent licensing contract
EE01 Entry into force of recordation of patent licensing contract

Application publication date: 20161026

Assignee: Guangdong Sanwei Kinetic Sports Technology Co.,Ltd.

Assignor: DONGGUAN University OF TECHNOLOGY

Contract record no.: X2023980034197

Denomination of invention: A barcode detection and recognition method and system based on machine vision system

Granted publication date: 20180925

License type: Common License

Record date: 20230329

EE01 Entry into force of recordation of patent licensing contract