CN111311497B - A barcode image angle correction method and device - Google Patents
A barcode image angle correction method and device Download PDFInfo
- Publication number
- CN111311497B CN111311497B CN202010088727.5A CN202010088727A CN111311497B CN 111311497 B CN111311497 B CN 111311497B CN 202010088727 A CN202010088727 A CN 202010088727A CN 111311497 B CN111311497 B CN 111311497B
- Authority
- CN
- China
- Prior art keywords
- contour
- foreground area
- white foreground
- corrected
- image
- 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.)
- Active
Links
- 238000012937 correction Methods 0.000 title claims abstract description 64
- 238000000034 method Methods 0.000 title claims abstract description 31
- 238000012545 processing Methods 0.000 claims abstract description 34
- 238000004364 calculation method Methods 0.000 claims description 10
- 230000000694 effects Effects 0.000 abstract description 9
- 230000009466 transformation Effects 0.000 abstract 1
- 238000001514 detection method Methods 0.000 description 16
- 238000001914 filtration Methods 0.000 description 6
- 230000008569 process Effects 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 101001121408 Homo sapiens L-amino-acid oxidase Proteins 0.000 description 1
- 102100026388 L-amino-acid oxidase Human genes 0.000 description 1
- 101100012902 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) FIG2 gene Proteins 0.000 description 1
- 101100233916 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) KAR5 gene Proteins 0.000 description 1
- 230000002411 adverse Effects 0.000 description 1
- 230000001174 ascending effect Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/60—Rotation of whole images or parts thereof
- G06T3/608—Rotation of whole images or parts thereof by skew deformation, e.g. two-pass or three-pass rotation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/13—Edge detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/136—Segmentation; Edge detection involving thresholding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/187—Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/60—Analysis of geometric attributes
- G06T7/62—Analysis of geometric attributes of area, perimeter, diameter or volume
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02A—TECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
- Y02A10/00—TECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE at coastal zones; at river basins
- Y02A10/40—Controlling or monitoring, e.g. of flood or hurricane; Forecasting, e.g. risk assessment or mapping
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Geometry (AREA)
- Image Analysis (AREA)
Abstract
Description
技术领域Technical Field
本申请涉及图像处理技术领域,尤其涉及一种条形码图像角度校正方法和装置。The present application relates to the field of image processing technology, and in particular to a barcode image angle correction method and device.
背景技术Background Art
条形码是根据一定的编码规则,利用不同粗细度的黑线和空白排列形成的一种符号。条形码广泛应用于日常生活中,例如商品和快递单。目前的一维条形码通常可以用来存储数字、字母等信息,由于一维条形码只在单个方向上表达信息,使得现有的机器视觉技术在识别一维条形码时对条形码的放置角度有要求,通常需要调整条形码的角度以便于进行条形码识别,现有的条形码校正方法只能对一维条形码进行小角度校正,在条形码角度倾斜较严重的情况下校正的效果较差,使得条形码识别结果较差。A barcode is a symbol formed by arranging black lines and spaces of different thicknesses according to certain coding rules. Barcodes are widely used in daily life, such as commodities and express delivery orders. Current one-dimensional barcodes can usually be used to store information such as numbers and letters. Since one-dimensional barcodes only express information in a single direction, existing machine vision technology has requirements for the placement angle of the barcode when recognizing one-dimensional barcodes. Usually, the angle of the barcode needs to be adjusted to facilitate barcode recognition. Existing barcode correction methods can only perform small angle correction on one-dimensional barcodes. When the barcode angle is severely tilted, the correction effect is poor, resulting in poor barcode recognition results.
发明内容Summary of the invention
本申请提供了一种条形码图像角度校正方法和装置,用于解决现有的条形码校正方法只能对一维条形码进行小角度校正,在条形码角度倾斜较严重的情况下校正的效果较差,使得条形码识别结果较差的技术问题。The present application provides a barcode image angle correction method and device, which are used to solve the technical problem that the existing barcode correction method can only perform small angle correction on one-dimensional barcodes, and the correction effect is poor when the barcode angle is severely tilted, resulting in poor barcode recognition results.
有鉴于此,本申请第一方面提供了一种条形码图像角度校正方法,包括:In view of this, the first aspect of the present application provides a barcode image angle correction method, comprising:
对获取的待校正条形码图像进行灰度化处理;grayscale the acquired barcode image to be corrected;
对灰度化处理后的所述待校正条形码图像进行二值化处理,得到第一二值图像;Binarizing the grayscaled barcode image to be corrected to obtain a first binary image;
基于轮廓检索算法对所述第一二值图像中的白色前景区域进行轮廓检索,得到所述白色前景区域的第一轮廓;Performing contour retrieval on the white foreground area in the first binary image based on a contour retrieval algorithm to obtain a first contour of the white foreground area;
将面积小于预置阈值的所述白色前景区域进行黑色填充,得到第二二值图像,所述白色前景区域的面积基于所述白色前景区域的第一轮廓内的像素点的数量计算得到;Filling the white foreground area whose area is smaller than a preset threshold with black to obtain a second binary image, wherein the area of the white foreground area is calculated based on the number of pixel points within the first contour of the white foreground area;
基于轮廓检索算法对所述第二二值图像中的白色前景区域进行轮廓检索,得到所述白色前景区域的第二轮廓;Performing contour retrieval on the white foreground area in the second binary image based on a contour retrieval algorithm to obtain a second contour of the white foreground area;
基于所述白色前景区域的第二轮廓计算所述白色前景区域的第二轮廓的中心,得到若干个中心点;Calculating the center of the second contour of the white foreground area based on the second contour of the white foreground area to obtain a plurality of center points;
基于霍夫变换对所述中心点进行直线拟合,输出夹角;Perform straight line fitting on the center point based on Hough transform and output the angle;
基于所述夹角计算得到校正角度,基于所述校正角度对所述待校正条形码图像进行旋转,得到校正后的条形码图像。A correction angle is calculated based on the included angle, and the barcode image to be corrected is rotated based on the correction angle to obtain a corrected barcode image.
优选地,所述对灰度化处理后的所述待校正条形码图像进行二值化处理,得到第一二值图像,之前还包括:Preferably, the step of binarizing the grayscaled barcode image to be corrected to obtain a first binary image further comprises:
对所述灰度化处理后的所述待校正条形码图像进行去噪处理。The barcode image to be corrected is subjected to denoising after the grayscale processing.
优选地,所述将面积小于预置阈值的所述白色前景区域进行黑色填充,得到第二二值图像,包括:Preferably, the step of filling the white foreground area whose area is smaller than a preset threshold with black to obtain a second binary image comprises:
根据漫水填充算法将面积小于预置阈值的所述白色前景区域进行黑色填充,得到第二二值图像。The white foreground area whose area is smaller than the preset threshold is filled with black according to the flood filling algorithm to obtain a second binary image.
优选地,所述基于所述白色前景区域的第二轮廓计算所述白色前景区域的第二轮廓的中心,得到若干个中心点,包括:Preferably, the calculating the center of the second contour of the white foreground area based on the second contour of the white foreground area to obtain a plurality of center points includes:
基于所述白色前景区域的第二轮廓得到所述第二轮廓的四个边界点,所述四个边界点为最上、最下、最左和最右的四个点;Obtaining four boundary points of the second contour based on the second contour of the white foreground area, wherein the four boundary points are the top, bottom, leftmost and rightmost points;
基于所述四个边界点得到所述第二轮廓的外接矩形,基于所述外接矩形计算得到所述外接矩形的中心,将所述外接矩形的中心作为所述第二轮廓的中心,得到若干个所述中心点。A circumscribed rectangle of the second contour is obtained based on the four boundary points, a center of the circumscribed rectangle is calculated based on the circumscribed rectangle, and the center of the circumscribed rectangle is used as the center of the second contour to obtain a plurality of center points.
优选地,所述对获取的待校正条形码图像进行灰度化处理,之前还包括:Preferably, the grayscale processing of the acquired barcode image to be corrected further comprises:
获取所述待校正条形码图像。The barcode image to be corrected is obtained.
本申请第二方面提供了一种条形码图像角度校正装置,包括:The second aspect of the present application provides a barcode image angle correction device, comprising:
灰度化处理模块,用于对获取的待校正条形码图像进行灰度化处理;A grayscale processing module, used for grayscale processing of the acquired barcode image to be corrected;
二值化处理模块,用于对灰度化处理后的所述待校正条形码图像进行二值化处理,得到第一二值图像;A binarization processing module, used for binarizing the barcode image to be corrected after the grayscale processing to obtain a first binary image;
第一轮廓检索模块,用于基于轮廓检索算法对所述第一二值图像中的白色前景区域进行轮廓检索,得到所述白色前景区域的第一轮廓;A first contour retrieval module, configured to perform contour retrieval on the white foreground area in the first binary image based on a contour retrieval algorithm to obtain a first contour of the white foreground area;
填充模块,用于将面积小于预置阈值的所述白色前景区域进行黑色填充,得到第二二值图像,所述白色前景区域的面积基于所述白色前景区域的第一轮廓内的像素点的数量计算得到;A filling module, used for filling the white foreground area whose area is smaller than a preset threshold with black to obtain a second binary image, wherein the area of the white foreground area is calculated based on the number of pixel points within the first contour of the white foreground area;
第二轮廓检索模块,用于基于轮廓检索算法对所述第二二值图像中的白色前景区域进行轮廓检索,得到所述白色前景区域的第二轮廓;A second contour retrieval module, configured to perform contour retrieval on the white foreground area in the second binary image based on a contour retrieval algorithm to obtain a second contour of the white foreground area;
计算模块,用于基于所述白色前景区域的第二轮廓计算所述白色前景区域的第二轮廓的中心,得到若干个中心点;A calculation module, used for calculating the center of the second outline of the white foreground area based on the second outline of the white foreground area to obtain a plurality of center points;
直线拟合模块,用于基于霍夫变换对所述中心点进行直线拟合,输出夹角;A straight line fitting module, used for performing straight line fitting on the center point based on Hough transform and outputting an angle;
校正模块,用于基于所述夹角计算得到校正角度,基于所述校正角度对所述待校正条形码图像进行旋转,得到校正后的条形码图像。The correction module is used to calculate a correction angle based on the included angle, and rotate the barcode image to be corrected based on the correction angle to obtain a corrected barcode image.
优选地,还包括:Preferably, it also includes:
去噪模块,用于对所述灰度化处理后的所述待校正条形码图像进行去噪处理。The denoising module is used to perform denoising on the barcode image to be corrected after the grayscale processing.
优选地,所述填充模块具体用于:Preferably, the filling module is specifically used for:
根据漫水填充算法将面积小于预置阈值的所述白色前景区域进行黑色填充,得到第二二值图像。The white foreground area whose area is smaller than the preset threshold is filled with black according to the flood filling algorithm to obtain a second binary image.
优选地,所述计算模块具体用于:Preferably, the calculation module is specifically used for:
基于所述白色前景区域的第二轮廓得到所述第二轮廓的四个边界点,所述四个边界点为最上、最下、最左和最右的四个点;Obtaining four boundary points of the second contour based on the second contour of the white foreground area, wherein the four boundary points are the top, bottom, leftmost and rightmost points;
基于所述四个边界点得到所述第二轮廓的外接矩形,基于所述外接矩形计算得到所述外接矩形的中心,将所述外接矩形的中心作为所述第二轮廓的中心,得到若干个所述中心点。A circumscribed rectangle of the second contour is obtained based on the four boundary points, a center of the circumscribed rectangle is calculated based on the circumscribed rectangle, and the center of the circumscribed rectangle is used as the center of the second contour to obtain a plurality of center points.
优选地,还包括:Preferably, it also includes:
图像获取模块,用于获取所述待校正条形码图像。The image acquisition module is used to acquire the barcode image to be corrected.
从以上技术方案可以看出,本申请具有以下优点:It can be seen from the above technical solutions that this application has the following advantages:
本申请提供了一种条形码图像角度校正方法,包括:对获取的待校正条形码图像进行灰度化处理;对灰度化处理后的待校正条形码图像进行二值化处理,得到第一二值图像;基于轮廓检索算法对第一二值图像中的白色前景区域进行轮廓检索,得到白色前景区域的第一轮廓;将面积小于预置阈值的白色前景区域进行黑色填充,得到第二二值图像,白色前景区域的面积基于白色前景区域的第一轮廓内的像素点的数量计算得到;基于轮廓检索算法对第二二值图像中的白色前景区域进行轮廓检索,得到白色前景区域的第二轮廓;基于白色前景区域的第二轮廓计算白色前景区域的第二轮廓的中心,得到若干个中心点;基于霍夫变换对中心点进行直线拟合,输出夹角;基于夹角计算得到校正角度,基于校正角度对待校正条形码图像进行旋转,得到校正后的条形码图像。The present application provides a barcode image angle correction method, comprising: graying an acquired barcode image to be corrected; binarizing the grayed barcode image to be corrected to obtain a first binary image; performing contour retrieval on a white foreground area in the first binary image based on a contour retrieval algorithm to obtain a first contour of the white foreground area; black filling a white foreground area whose area is smaller than a preset threshold to obtain a second binary image, wherein the area of the white foreground area is calculated based on the number of pixel points in the first contour of the white foreground area; performing contour retrieval on the white foreground area in the second binary image based on a contour retrieval algorithm to obtain a second contour of the white foreground area; calculating the center of the second contour of the white foreground area based on the second contour of the white foreground area to obtain a plurality of center points; performing straight line fitting on the center points based on Hough transform to output an angle; obtaining a correction angle based on the angle calculation, and rotating the barcode image to be corrected based on the correction angle to obtain a corrected barcode image.
本申请中的条形码图像角度校正方法,通过对获取的待矫正条形码图像进行灰度化、二值化处理,得到第一二值图像;考虑到条形码之外的其他白色前景区域会影响条形码的方向直线的检测,特别是密集的小面积白色前景区域,对第一二值图像中的白色前景进行轮廓检索,进而将面积小于预置阈值的白色前景区域进行黑色填充,得到第二二值图像,从而达到删除小面积白色前景区域的效果,提高条形码的方向直线的检测准确性;基于轮廓检索算法对第二二值图像中的白色前景区域进行轮廓检索,并基于白色前景区域的第二轮廓计算白色前景区域的第二轮廓的中心,得到若干个中心点,进而采用霍夫变换对中心点进行直线拟合,得到条形码的方向直线以及夹角,通过该夹角可以计算得到校正角度,进而进行条形码图像的校正,从而解决了现有的条形码校正方法只能对一维条形码进行小角度校正,在条形码角度倾斜较严重的情况下校正的效果较差,使得条形码识别结果较差的技术问题。The barcode image angle correction method in the present application performs grayscale and binarization processing on the acquired barcode image to be corrected to obtain a first binary image; considering that other white foreground areas outside the barcode will affect the detection of the direction straight line of the barcode, especially the dense small-area white foreground area, the white foreground in the first binary image is subjected to contour retrieval, and then the white foreground area with an area smaller than a preset threshold is filled with black to obtain a second binary image, thereby achieving the effect of deleting the small-area white foreground area and improving the detection accuracy of the direction straight line of the barcode; based on the contour retrieval algorithm, the white foreground area in the second binary image is subjected to contour retrieval, and the center of the second contour of the white foreground area is calculated based on the second contour of the white foreground area to obtain a plurality of center points, and then the center points are subjected to straight line fitting by using Hough transform to obtain the direction straight line and the angle of the barcode, and the correction angle can be calculated by the angle, and then the barcode image is corrected, thereby solving the technical problem that the existing barcode correction method can only perform small-angle correction on one-dimensional barcodes, and the correction effect is poor when the barcode angle is severely tilted, resulting in poor barcode recognition results.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1为本申请实施例提供的一种条形码图像角度校正方法的一个流程示意图;FIG1 is a schematic flow chart of a barcode image angle correction method provided in an embodiment of the present application;
图2为本申请实施例提供的一种条形码图像角度校正方法的另一个流程示意图;FIG2 is another schematic flow chart of a barcode image angle correction method provided in an embodiment of the present application;
图3为本申请实施例提供的一种条形码图像角度校正装置的一个结构示意图;FIG3 is a schematic structural diagram of a barcode image angle correction device provided in an embodiment of the present application;
图4为本申请实施例提供的极坐标系中参数的示意图。FIG. 4 is a schematic diagram of parameters in a polar coordinate system provided in an embodiment of the present application.
具体实施方式DETAILED DESCRIPTION
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
为了便于理解,请参阅图1,本申请提供的一种条形码图像角度校正方法的一个实施例,包括:For ease of understanding, please refer to FIG. 1 , which shows an embodiment of a barcode image angle correction method provided by the present application, including:
步骤101、对获取的待校正条形码图像进行灰度化处理。Step 101: grayscale the acquired barcode image to be corrected.
需要说明的是,对获取的待校正条形码图像进行灰度化处理以便于后续进行二值化处理。It should be noted that the acquired barcode image to be corrected is grayed to facilitate subsequent binarization processing.
步骤102、对灰度化处理后的待校正条形码图像进行二值化处理,得到第一二值图像。Step 102: Binarize the grayscaled barcode image to be corrected to obtain a first binary image.
步骤103、基于轮廓检索算法对第一二值图像中的白色前景区域进行轮廓检索,得到白色前景区域的第一轮廓。Step 103: Perform contour retrieval on the white foreground area in the first binary image based on a contour retrieval algorithm to obtain a first contour of the white foreground area.
步骤104、将面积小于预置阈值的白色前景区域进行黑色填充,得到第二二值图像,白色前景区域的面积基于白色前景区域的第一轮廓内的像素点的数量计算得到。
需要说明的是,得到的第一二值图像中存在着大量的白色前景,除了条形码之外的其他白色前景区域会影响条形码的方向直线的检测,特别是密集的小面积白色前景区域,这些小面积白色前景区域不仅影响程序运行的效率,而且很容易导致直线检测错误,因此,需要减少小面积白色前景区域。本申请实施例中通过轮廓检索算法对第一二值图像中的白色前景区域进行轮廓检索,从而得到白色前景区域的第一轮廓,得到第一轮廓后,可以通过计算每个第一轮廓内的像素点的数量得到每个第一轮廓对应的白色前景区域的面积,将面积小于预置阈值的白色前景区域进行黑色填充,得到第二二值图像,从而达到删除小面积白色前景区域的目的,以此提高条形码的方向直线的检测准确率,其中,基于轮廓检索算法对第一二值图像中的白色前景区域进行轮廓检索属于现有技术,在此不再对基于轮廓检索算法进行轮廓检索的具体过程进行赘述。It should be noted that there are a large number of white foregrounds in the first binary image obtained. In addition to the barcode, other white foreground areas will affect the detection of the directional straight line of the barcode, especially the dense small-area white foreground areas. These small-area white foreground areas not only affect the efficiency of program operation, but also easily lead to straight line detection errors. Therefore, it is necessary to reduce the small-area white foreground areas. In the embodiment of the present application, the white foreground area in the first binary image is subjected to contour retrieval by a contour retrieval algorithm to obtain a first contour of the white foreground area. After obtaining the first contour, the area of the white foreground area corresponding to each first contour can be obtained by calculating the number of pixels in each first contour, and the white foreground area with an area less than a preset threshold is filled with black to obtain a second binary image, thereby achieving the purpose of deleting the small-area white foreground area, thereby improving the detection accuracy of the directional straight line of the barcode. Among them, the contour retrieval of the white foreground area in the first binary image based on the contour retrieval algorithm belongs to the prior art, and the specific process of contour retrieval based on the contour retrieval algorithm will not be repeated here.
步骤105、基于轮廓检索算法对第二二值图像中的白色前景区域进行轮廓检索,得到白色前景区域的第二轮廓。Step 105 : Perform contour retrieval on the white foreground area in the second binary image based on a contour retrieval algorithm to obtain a second contour of the white foreground area.
步骤106、基于白色前景区域的第二轮廓计算白色前景区域的第二轮廓的中心,得到若干个中心点。Step 106: Calculate the center of the second contour of the white foreground area based on the second contour of the white foreground area to obtain a plurality of center points.
需要说明的是,因为条形码的条块均为等高条块,在同一方向对齐排列,这些条块的中心点连成的直线即为条形码的方向直线,因此需要计算白色前景区域的第二轮廓的中心,得到条形码各个条块的中心点。It should be noted that, because the bars of the barcode are all equal-height bars and are aligned in the same direction, the straight line connecting the center points of these bars is the direction straight line of the barcode. Therefore, it is necessary to calculate the center of the second contour of the white foreground area to obtain the center point of each barcode bar.
步骤107、基于霍夫变换对中心点进行直线拟合,输出夹角。Step 107: Perform straight line fitting on the center point based on Hough transform and output the angle.
需要说明的是,在获得若干个中心点后,可以采用直线检测算法检测直线,并返回拟合度最好的直线,本申请实施例中优选采用霍夫变换对中心点进行直线拟合,霍夫变换是图像处理中的一种形状检测算法,无论是间断点还是连续点,其都能处理。霍夫变换的原理是将图像函数表达式从欧式距离变换到参数空间,从而实现形状的拟合检测,在直角坐标系中,直线可以表示为y=ax+b,在极坐标中,直线可以表示为ρ=x cosθ+y sinθ,ρ为原点到该直线的垂直距离,θ是该直线的垂线与横轴顺时针方向的夹角,如图4所示。当ρ大于0时,直线处于原点的下方;当ρ大于0时,直线处于原点的上方,无论直线处于原点的上方还是下方,夹角θ都是小于180°,因此,(ρ;θ)可以用来表示任意一条直线。采用霍夫变换对中心点进行直线拟合,具体为:首先,创建一个2维的数组作为累加器,该数组的行和列分别表示ρ和θ,对数组中的值采用置0来进行初始化,将中心点的x值和y值代入到直线的极坐标方程中;然后,按精度遍历θ值,间隔为精度值,代入方程后求出对应的ρ值,这样就能求出多个数值对(ρ;θ),将这些数值对与累加器对比,若累加器中能找到相应的位置,那么相应位置的值执行加1操作;接着取第二个中心点,重复前述步骤并更新累加器中的值,直到把所有的中心点取完,当所有操作执行完毕后,累加器中存在一个最大值,输出最大值对应的数值对(ρ;θ),从而得到夹角θ。It should be noted that after obtaining several center points, a straight line detection algorithm can be used to detect the straight line and return the straight line with the best fit. In the embodiment of the present application, Hough transform is preferably used to fit the center point to the straight line. Hough transform is a shape detection algorithm in image processing, which can handle both discontinuous points and continuous points. The principle of Hough transform is to transform the image function expression from Euclidean distance to parameter space, so as to realize the fitting detection of the shape. In the rectangular coordinate system, the straight line can be expressed as y=ax+b, and in the polar coordinate system, the straight line can be expressed as ρ=x cosθ+y sinθ, where ρ is the vertical distance from the origin to the straight line, and θ is the angle between the vertical line of the straight line and the horizontal axis in the clockwise direction, as shown in Figure 4. When ρ is greater than 0, the straight line is below the origin; when ρ is greater than 0, the straight line is above the origin. Regardless of whether the straight line is above or below the origin, the angle θ is less than 180°. Therefore, (ρ; θ) can be used to represent any straight line. Hough transform is used to fit the center point to a straight line. Specifically, first, a two-dimensional array is created as an accumulator. The rows and columns of the array represent ρ and θ respectively. The values in the array are initialized by setting them to 0, and the x and y values of the center point are substituted into the polar coordinate equation of the line. Then, the θ values are traversed according to the precision, with the interval being the precision value. The corresponding ρ value is substituted into the equation to obtain a plurality of value pairs (ρ; θ). These value pairs are compared with the accumulator. If the corresponding position can be found in the accumulator, the value at the corresponding position is incremented by 1. Then, the second center point is taken, and the aforementioned steps are repeated and the value in the accumulator is updated until all the center points are taken. When all operations are completed, there is a maximum value in the accumulator, and the value pair (ρ; θ) corresponding to the maximum value is output to obtain the angle θ.
步骤108、基于夹角计算得到校正角度,基于校正角度对待校正条形码图像进行旋转,得到校正后的条形码图像。Step 108: obtain a correction angle based on the included angle calculation, and rotate the barcode image to be corrected based on the correction angle to obtain a corrected barcode image.
需要说明的是,可以通过90°减去夹角θ得到校正角度,基于校正角度对待校正条形码图像进行旋转,得到校正后的条形码图像。It should be noted that the correction angle can be obtained by subtracting the included angle θ from 90°, and the barcode image to be corrected is rotated based on the correction angle to obtain the corrected barcode image.
本申请实施例中的条形码图像角度校正方法,通过对获取的待矫正条形码图像进行灰度化、二值化处理,得到第一二值图像;考虑到条形码之外的其他白色前景区域会影响条形码的方向直线的检测,特别是密集的小面积白色前景区域,对第一二值图像中的白色前景进行轮廓检索,进而将面积小于预置阈值的白色前景区域进行黑色填充,得到第二二值图像,从而达到删除小面积白色前景区域的效果,提高条形码的方向直线的检测准确性;基于轮廓检索算法对第二二值图像中的白色前景区域进行轮廓检索,并基于白色前景区域的第二轮廓计算白色前景区域的第二轮廓的中心,得到若干个中心点,进而采用霍夫变换对中心点进行直线拟合,得到条形码的方向直线以及夹角,通过该夹角可以计算得到校正角度,进而进行条形码图像的校正,从而解决了现有的条形码校正方法只能对一维条形码进行小角度校正,在条形码角度倾斜较严重的情况下校正的效果较差,使得条形码识别结果较差的技术问题。The barcode image angle correction method in the embodiment of the present application performs grayscale and binarization processing on the acquired barcode image to be corrected to obtain a first binary image; considering that other white foreground areas outside the barcode will affect the detection of the direction straight line of the barcode, especially the dense small-area white foreground area, the white foreground in the first binary image is subjected to contour retrieval, and then the white foreground area with an area smaller than a preset threshold is filled with black to obtain a second binary image, thereby achieving the effect of deleting the small-area white foreground area and improving the detection accuracy of the direction straight line of the barcode; the white foreground area in the second binary image is subjected to contour retrieval based on the contour retrieval algorithm, and the center of the second contour of the white foreground area is calculated based on the second contour of the white foreground area to obtain a plurality of center points, and then the center points are subjected to straight line fitting using Hough transform to obtain the direction straight line and the angle of the barcode, and the correction angle can be calculated through the angle, and then the barcode image is corrected, thereby solving the technical problem that the existing barcode correction method can only perform small-angle correction on one-dimensional barcodes, and the correction effect is poor when the barcode angle is severely tilted, resulting in poor barcode recognition results.
为了便于理解,请参阅图2,本申请提供的一种条形码图像角度校正方法的另一个实施例,包括:For ease of understanding, please refer to FIG. 2 , another embodiment of a barcode image angle correction method provided by the present application includes:
步骤201、获取待校正条形码图像。Step 201: Obtain a barcode image to be corrected.
需要说明的是,可以通过摄像头获取待校正条形码图像,待校正条形码图像为彩色图像。It should be noted that the barcode image to be corrected can be obtained through a camera, and the barcode image to be corrected is a color image.
步骤202、对获取的待校正条形码图像进行灰度化处理。Step 202: grayscale the acquired barcode image to be corrected.
需要说明的是,对获取的待校正条形码图像进行灰度化处理以便于后续进行二值化处理,本申请实施例中优选采用加权平均法进行灰度化处理,即:It should be noted that the obtained barcode image to be corrected is grayed to facilitate the subsequent binarization process. In the embodiment of the present application, the weighted average method is preferably used for graying, that is:
f(x,y)=0.30R(x,y)+0.59G(x,y)+0.11B(x,y);f(x,y)=0.30R(x,y)+0.59G(x,y)+0.11B(x,y);
其中,R、G、B为彩色图像的三个通道,f为灰度化处理后的灰度图像。Among them, R, G, and B are the three channels of the color image, and f is the grayscale image after grayscale processing.
步骤203、对灰度化处理后的待校正条形码图像进行去噪处理。Step 203: De-noise the grayscaled barcode image.
需要说明的是,由于噪声对后续二值化处理存在不利影响,因此本申请实施例中对灰度化处理后的待校正条形码图像进行去噪处理,可以通过滤波算法对图像进行平滑以达到去噪的效果,常用的滤波算法有均值滤波、中值滤波和高斯滤波等,本申请实施例中优先采用中值滤波,通过滑动窗口遍历图像,将滑动窗口的中间点及其周围的邻域像素点的像素值按升序或降序排列,然后取排序后的中间值设为窗口中心点的像素值。It should be noted that since noise has an adverse effect on subsequent binarization processing, in the embodiment of the present application, the barcode image to be corrected after grayscale processing is denoised, and the image can be smoothed by a filtering algorithm to achieve the denoising effect. Commonly used filtering algorithms include mean filtering, median filtering, and Gaussian filtering. In the embodiment of the present application, median filtering is preferably used. The image is traversed by a sliding window, and the pixel values of the middle point of the sliding window and its surrounding neighboring pixel points are arranged in ascending or descending order, and then the sorted middle value is taken as the pixel value of the center point of the window.
步骤204、对去噪处理后的待校正条形码图像进行二值化处理,得到第一二值图像。Step 204: Binarize the barcode image to be corrected after the denoising process to obtain a first binary image.
需要说明的是,本申请实施例中采用全局二值化方法对去噪后的待校正条形码图像进行二值化处理,定义待校正条形码图像中前景目标和背景的分割阈值为T,图像的大小为M×N,属于前景的像素点个数占整幅图像的所有像素点的比例为ω0,其对应的平均灰度为μ0,背景像素点数占整幅图像的所有像素点的比例为ω1,其对应的平均灰度为μ1,图像的总平均灰度为μ,类间方差为g,定义图像中像素的灰度值小于阈值T的像素的个数记为N0,对应的像素的灰度值大于阈值T的像素的个数记为N1,此时,定义如下:It should be noted that, in the embodiment of the present application, a global binarization method is used to perform binarization processing on the denoised barcode image to be corrected, and the segmentation threshold of the foreground target and the background in the barcode image to be corrected is defined as T, the size of the image is M×N, the number of pixels belonging to the foreground accounts for the proportion of all pixels in the whole image is ω 0 , and the corresponding average grayscale is μ 0 , the number of background pixels accounts for all pixels in the whole image is ω 1 , and the corresponding average grayscale is μ 1 , the total average grayscale of the image is μ, and the inter-class variance is g. It is defined that the number of pixels in the image whose grayscale value is less than the threshold T is recorded as N 0 , and the number of pixels whose corresponding grayscale value is greater than the threshold T is recorded as N 1 . At this time, the definition is as follows:
μ=ω0×μ0+ω1×μ1;μ=ω 0 ×μ 0 +ω 1 ×μ 1 ;
g=ω0(μ0-μ)2+ω1(μ1-μ)2;g=ω 0 (μ 0 -μ) 2 +ω 1 (μ 1 -μ) 2 ;
T=argmax(g);T = argmax(g);
g取得最大值时对应的T即为所求阈值,根据求得的阈值T对去噪后的待校正条形码图像进行二值化处理,得到第一二值图像。The T corresponding to the maximum value of g is the required threshold value. The denoised barcode image to be corrected is binarized according to the obtained threshold value T to obtain a first binary image.
步骤205、基于轮廓检索算法对第一二值图像中的白色前景区域进行轮廓检索,得到白色前景区域的第一轮廓。Step 205 : Perform contour retrieval on the white foreground area in the first binary image based on a contour retrieval algorithm to obtain a first contour of the white foreground area.
步骤206、根据漫水填充算法将面积小于预置阈值的白色前景区域进行黑色填充,得到第二二值图像,白色前景区域的面积基于白色前景区域的第一轮廓内的像素点的数量计算得到。
需要说明的是,得到的第一二值图像中存在着大量的白色前景,除了条形码之外的其他白色前景区域会影响条形码的方向直线的检测,特别是密集的小面积白色前景区域,这些小面积白色前景区域不仅影响程序运行的效率,而且很容易导致直线检测错误,因此,需要减少小面积白色前景区域。本申请实施例中通过轮廓检索算法对第一二值图像中的白色前景区域进行轮廓检索,从而得到白色前景区域的第一轮廓,得到第一轮廓后,可以通过计算每个第一轮廓内的像素点的数量得到每个第一轮廓对应的白色前景区域的面积,根据漫水填充算法将面积小于预置阈值的白色前景区域进行黑色填充,从而达到删除小面积白色前景区域的目的,以此提高条形码的方向直线的检测准确率,其中,本申请实施例中的预置阈值设为30,基于漫水填充算法进行黑色填充属于现有技术,在此不再对漫水填充算法进行黑色填充的具体过程进行赘述。It should be noted that there are a large number of white foregrounds in the first binary image obtained. Other white foreground areas except the barcode will affect the detection of the directional straight line of the barcode, especially the dense small-area white foreground areas. These small-area white foreground areas not only affect the efficiency of program operation, but also easily lead to straight line detection errors. Therefore, it is necessary to reduce the small-area white foreground areas. In the embodiment of the present application, the white foreground area in the first binary image is subjected to contour retrieval by a contour retrieval algorithm, so as to obtain the first contour of the white foreground area. After obtaining the first contour, the area of the white foreground area corresponding to each first contour can be obtained by calculating the number of pixels in each first contour. According to the flood filling algorithm, the white foreground area with an area less than a preset threshold is filled with black, so as to achieve the purpose of deleting the small-area white foreground area, thereby improving the detection accuracy of the directional straight line of the barcode. Among them, the preset threshold in the embodiment of the present application is set to 30, and the black filling based on the flood filling algorithm belongs to the prior art, and the specific process of the black filling by the flood filling algorithm is not repeated here.
步骤207、基于轮廓检索算法对第二二值图像中的白色前景区域进行轮廓检索,得到白色前景区域的第二轮廓。Step 207: Perform contour retrieval on the white foreground area in the second binary image based on a contour retrieval algorithm to obtain a second contour of the white foreground area.
步骤208、基于白色前景区域的第二轮廓计算白色前景区域的第二轮廓的中心,得到若干个中心点。Step 208: Calculate the center of the second contour of the white foreground area based on the second contour of the white foreground area to obtain a plurality of center points.
需要说明的是,因为条形码的条块均为等高条块,在同一方向对齐排列,这些条块的中心点连成的直线即为条形码的方向直线,因此需要计算白色前景区域的第二轮廓的中心,得到条形码各个条块的中心点,具体步骤为:It should be noted that, because the bars of the barcode are all equal-height bars, aligned in the same direction, the straight line formed by the center points of these bars is the direction straight line of the barcode. Therefore, it is necessary to calculate the center of the second contour of the white foreground area to obtain the center point of each barcode bar. The specific steps are:
基于白色前景区域的第二轮廓得到第二轮廓的四个边界点,四个边界点为最上、最下、最左和最右的四个点;Based on the second contour of the white foreground area, four boundary points of the second contour are obtained, where the four boundary points are the top, bottom, leftmost and rightmost points;
基于四个边界点得到第二轮廓的外接矩形,基于外接矩形计算得到外接矩形的中心,将外接矩形的中心作为第二轮廓的中心,得到若干个中心点,可以将非中心点的位置进行黑色填充,得到中心点图像,其中,可以通过将外接矩形的长宽各取一半的坐标得到外接矩形的中心点坐标。The circumscribed rectangle of the second contour is obtained based on the four boundary points, and the center of the circumscribed rectangle is calculated based on the circumscribed rectangle. The center of the circumscribed rectangle is used as the center of the second contour to obtain several center points. The positions of non-center points can be filled with black to obtain a center point image, wherein the coordinates of the center point of the circumscribed rectangle can be obtained by taking half of the length and width of the circumscribed rectangle.
步骤209、基于霍夫变换对中心点进行直线拟合,输出夹角。Step 209: Perform straight line fitting on the center point based on Hough transform and output the angle.
需要说明的是,在获得若干个中心点后,可以采用直线检测算法检测直线,并返回拟合度最好的直线,本申请实施例中优选采用霍夫变换对中心点进行直线拟合,霍夫变换是图像处理中的一种形状检测算法,无论是间断点还是连续点,其都能处理。霍夫变换的原理是将图像函数表达式从欧式距离变换到参数空间,从而实现形状的拟合检测,在直角坐标系中,直线可以表示为y=ax+b,在极坐标中,直线可以表示为ρ=x cosθ+y sinθ,ρ为原点到该直线的垂直距离,θ是该直线的垂线与横轴顺时针方向的夹角,如图4所示。当ρ大于0时,直线处于原点的下方;当ρ大于0时,直线处于原点的上方,无论直线处于原点的上方还是下方,夹角θ都是小于180°,因此,(ρ;θ)可以用来表示任意一条直线。采用霍夫变换对中心点进行直线拟合,具体为:首先,创建一个2维的数组作为累加器,该数组的行和列分别表示ρ和θ,对数组中的值采用置0来进行初始化,将中心点的x值和y值代入到直线的极坐标方程中;然后,按精度遍历θ值,间隔为精度值,代入方程后求出对应的ρ值,这样就能求出多个数值对(ρ;θ),将这些数值对与累加器对比,若累加器中能找到相应的位置,那么相应位置的值执行加1操作;接着取第二个中心点,重复前述步骤并更新累加器中的值,直到把所有的中心点取完,当所有操作执行完毕后,累加器中存在一个最大值,输出最大值对应的数值对(ρ;θ),从而得到夹角θ。It should be noted that after obtaining several center points, a straight line detection algorithm can be used to detect the straight line and return the straight line with the best fit. In the embodiment of the present application, Hough transform is preferably used to fit the center point to the straight line. Hough transform is a shape detection algorithm in image processing, which can handle both discontinuous points and continuous points. The principle of Hough transform is to transform the image function expression from Euclidean distance to parameter space, so as to realize the fitting detection of the shape. In the rectangular coordinate system, the straight line can be expressed as y=ax+b, and in the polar coordinate system, the straight line can be expressed as ρ=x cosθ+y sinθ, where ρ is the vertical distance from the origin to the straight line, and θ is the angle between the vertical line of the straight line and the horizontal axis in the clockwise direction, as shown in Figure 4. When ρ is greater than 0, the straight line is below the origin; when ρ is greater than 0, the straight line is above the origin. Regardless of whether the straight line is above or below the origin, the angle θ is less than 180°. Therefore, (ρ; θ) can be used to represent any straight line. Hough transform is used to fit the center point to a straight line. Specifically, first, a two-dimensional array is created as an accumulator. The rows and columns of the array represent ρ and θ respectively. The values in the array are initialized by setting them to 0, and the x and y values of the center point are substituted into the polar coordinate equation of the line. Then, the θ values are traversed according to the precision, with the interval being the precision value. The corresponding ρ value is substituted into the equation to obtain a plurality of value pairs (ρ; θ). These value pairs are compared with the accumulator. If the corresponding position can be found in the accumulator, the value at the corresponding position is incremented by 1. Then, the second center point is taken, and the aforementioned steps are repeated and the value in the accumulator is updated until all the center points are taken. When all operations are completed, there is a maximum value in the accumulator, and the value pair (ρ; θ) corresponding to the maximum value is output to obtain the angle θ.
步骤210、基于夹角计算得到校正角度,基于校正角度对待校正条形码图像进行旋转,得到校正后的条形码图像。Step 210: obtain a correction angle based on the included angle calculation, and rotate the barcode image to be corrected based on the correction angle to obtain a corrected barcode image.
需要说明的是,可以通过90°减去夹角θ得到校正角度,基于校正角度对待校正条形码图像进行旋转,得到校正后的条形码图像。It should be noted that the correction angle can be obtained by subtracting the included angle θ from 90°, and the barcode image to be corrected is rotated based on the correction angle to obtain the corrected barcode image.
为了便于理解,请参阅图3,本申请提供的一种条形码图像角度校正装置的一个实施例,包括:For ease of understanding, please refer to FIG. 3 , which shows an embodiment of a barcode image angle correction device provided by the present application, including:
灰度化处理模块301,用于对获取的待校正条形码图像进行灰度化处理。The grayscale processing module 301 is used to perform grayscale processing on the acquired barcode image to be corrected.
二值化处理模块302,用于对灰度化处理后的待校正条形码图像进行二值化处理,得到第一二值图像。The binarization processing module 302 is used to perform binarization processing on the barcode image to be corrected after the grayscale processing to obtain a first binary image.
第一轮廓检索模块303,用于基于轮廓检索算法对第一二值图像中的白色前景区域进行轮廓检索,得到白色前景区域的第一轮廓。The first contour retrieval module 303 is used to perform contour retrieval on the white foreground area in the first binary image based on a contour retrieval algorithm to obtain a first contour of the white foreground area.
填充模块304,用于将面积小于预置阈值的白色前景区域进行黑色填充,得到第二二值图像,白色前景区域的面积基于白色前景区域的第一轮廓内的像素点的数量计算得到。The filling module 304 is used to fill the white foreground area whose area is smaller than a preset threshold with black to obtain a second binary image, wherein the area of the white foreground area is calculated based on the number of pixels in the first contour of the white foreground area.
第二轮廓检索模块305,用于基于轮廓检索算法对第二二值图像中的白色前景区域进行轮廓检索,得到白色前景区域的第二轮廓。The second contour retrieval module 305 is used to perform contour retrieval on the white foreground area in the second binary image based on a contour retrieval algorithm to obtain a second contour of the white foreground area.
计算模块306,用于基于白色前景区域的第二轮廓计算白色前景区域的第二轮廓的中心,得到若干个中心点。The calculation module 306 is used to calculate the center of the second contour of the white foreground area based on the second contour of the white foreground area to obtain a plurality of center points.
直线拟合模块307,用于基于霍夫变换对中心点进行直线拟合,输出夹角。The straight line fitting module 307 is used to perform straight line fitting on the central point based on Hough transform and output the angle.
校正模块308,用于基于夹角计算得到校正角度,基于校正角度对待校正条形码图像进行旋转,得到校正后的条形码图像。The correction module 308 is used to obtain a correction angle based on the included angle calculation, and to rotate the barcode image to be corrected based on the correction angle to obtain a corrected barcode image.
进一步地,还包括:Furthermore, it also includes:
去噪模块309,用于对灰度化处理后的待校正条形码图像进行去噪处理。The denoising module 309 is used to perform denoising on the barcode image to be corrected after the grayscale processing.
进一步地,填充模块304具体用于:Furthermore, the filling module 304 is specifically used for:
根据漫水填充算法将面积小于预置阈值的白色前景区域进行黑色填充,得到第二二值图像。The white foreground area whose area is smaller than the preset threshold is filled with black according to the flood filling algorithm to obtain a second binary image.
进一步地,计算模块306具体用于:Furthermore, the calculation module 306 is specifically used for:
基于白色前景区域的第二轮廓得到第二轮廓的四个边界点,四个边界点为最上、最下、最左和最右的四个点;Based on the second contour of the white foreground area, four boundary points of the second contour are obtained, where the four boundary points are the top, bottom, leftmost and rightmost points;
基于四个边界点得到第二轮廓的外接矩形,基于外接矩形计算得到外接矩形的中心,将外接矩形的中心作为第二轮廓的中心,得到若干个中心点。A circumscribed rectangle of the second contour is obtained based on the four boundary points, a center of the circumscribed rectangle is calculated based on the circumscribed rectangle, and the center of the circumscribed rectangle is used as the center of the second contour to obtain a plurality of center points.
进一步地,还包括:Furthermore, it also includes:
图像获取模块310,用于获取待校正条形码图像。The image acquisition module 310 is used to acquire the barcode image to be corrected.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以通过一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(英文全称:Read-OnlyMemory,英文缩写:ROM)、随机存取存储器(英文全称:Random Access Memory,英文缩写:RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for executing all or part of the steps of the method described in each embodiment of the present application through a computer device (which can be a personal computer, a server, or a network device, etc.). The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (full name in English: Read-Only Memory, English abbreviation: ROM), random access memory (full name in English: Random Access Memory, English abbreviation: RAM), disk or optical disk and other media that can store program codes.
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features therein can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims (8)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010088727.5A CN111311497B (en) | 2020-02-12 | 2020-02-12 | A barcode image angle correction method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010088727.5A CN111311497B (en) | 2020-02-12 | 2020-02-12 | A barcode image angle correction method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111311497A CN111311497A (en) | 2020-06-19 |
CN111311497B true CN111311497B (en) | 2023-05-05 |
Family
ID=71152804
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010088727.5A Active CN111311497B (en) | 2020-02-12 | 2020-02-12 | A barcode image angle correction method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111311497B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111768378B (en) * | 2020-06-29 | 2025-01-14 | 广东电网有限责任公司 | A method and device for detecting live voltage of crimping hardware |
CN113449536B (en) * | 2021-07-16 | 2023-02-14 | 深圳思谋信息科技有限公司 | Bar code image repairing method and device, computer equipment and storage medium |
CN114140794A (en) * | 2021-11-26 | 2022-03-04 | 北京比特易湃信息技术有限公司 | General image correction method based on OCR |
CN116225270A (en) * | 2023-02-27 | 2023-06-06 | 荣耀终端有限公司 | Bar code image acquisition method and related device |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110309687A (en) * | 2019-07-05 | 2019-10-08 | 华中科技大学 | Method and device for correcting a two-dimensional code image |
CN110348264A (en) * | 2019-07-04 | 2019-10-18 | 北京电子工程总体研究所 | A kind of QR image in 2 D code bearing calibration and system |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104517089B (en) * | 2013-09-29 | 2017-09-26 | 北大方正集团有限公司 | A kind of Quick Response Code decodes system and method |
-
2020
- 2020-02-12 CN CN202010088727.5A patent/CN111311497B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110348264A (en) * | 2019-07-04 | 2019-10-18 | 北京电子工程总体研究所 | A kind of QR image in 2 D code bearing calibration and system |
CN110309687A (en) * | 2019-07-05 | 2019-10-08 | 华中科技大学 | Method and device for correcting a two-dimensional code image |
Also Published As
Publication number | Publication date |
---|---|
CN111311497A (en) | 2020-06-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111311497B (en) | A barcode image angle correction method and device | |
CN111814722B (en) | A form recognition method, device, electronic device and storage medium in an image | |
CN110866924B (en) | Line structured light center line extraction method and storage medium | |
KR102113911B1 (en) | Feature extraction and matching and template update for biometric authentication | |
CN107545207A (en) | DM two-dimensional code identification methods and device based on image procossing | |
CN111680690B (en) | Character recognition method and device | |
CN108596166A (en) | A kind of container number identification method based on convolutional neural networks classification | |
EP2393037A1 (en) | Data matrix decoding chip and decoding method thereof | |
CN110660072B (en) | Method and device for identifying straight line edge, storage medium and electronic equipment | |
CN110647882A (en) | Image correction method, device, equipment and storage medium | |
CN108717744B (en) | Method and device for identifying seal serial number on financial document and terminal equipment | |
CN107273777A (en) | A kind of Quick Response Code identification of code type method matched based on slide unit | |
CN112329779A (en) | Method and related device for improving certificate identification accuracy based on mask | |
CN112580383B (en) | Two-dimensional code identification method and device, electronic equipment and storage medium | |
CN113688846A (en) | Object size recognition method, readable storage medium, and object size recognition system | |
CN107578011A (en) | The decision method and device of key frame of video | |
CN111783493A (en) | Identification method and identification terminal for batch two-dimensional codes | |
CN108171098A (en) | A kind of code detection method and equipment | |
CN113228105B (en) | Image processing method, device and electronic equipment | |
CN109977714B (en) | A multi-QR code integrated visual positioning method for warehouse goods | |
CN115221910A (en) | Two-dimensional code identification method, device and equipment and computer readable storage medium | |
CN114758340A (en) | Intelligent identification method, device and equipment for logistics address and storage medium | |
CN118520893A (en) | Method, device and storage medium for identifying bar code label applied to AOI | |
CN112818983A (en) | Method for judging character inversion by using picture acquaintance | |
CN107358138B (en) | Correction method of nonlinear distortion EAN bar code, mobile terminal and storage device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |