WO2020119301A1 - 二维码识别方法、装置及设备 - Google Patents

二维码识别方法、装置及设备 Download PDF

Info

Publication number
WO2020119301A1
WO2020119301A1 PCT/CN2019/114218 CN2019114218W WO2020119301A1 WO 2020119301 A1 WO2020119301 A1 WO 2020119301A1 CN 2019114218 W CN2019114218 W CN 2019114218W WO 2020119301 A1 WO2020119301 A1 WO 2020119301A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
dimensional code
recognized
unit
specified number
Prior art date
Application number
PCT/CN2019/114218
Other languages
English (en)
French (fr)
Inventor
陈家大
Original Assignee
阿里巴巴集团控股有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 阿里巴巴集团控股有限公司 filed Critical 阿里巴巴集团控股有限公司
Publication of WO2020119301A1 publication Critical patent/WO2020119301A1/zh

Links

Images

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/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes
    • 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/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1439Methods for optical code recognition including a method step for retrieval of the optical code
    • G06K7/1443Methods for optical code recognition including a method step for retrieval of the optical code locating of the code in an image

Definitions

  • One or more embodiments of this specification relate to the field of image recognition, and in particular, to a two-dimensional code recognition method, device, and equipment.
  • a two-dimensional code (2-dimensional bar code) is a bar code that records information by graphs distributed in a two-dimensional direction on a plane according to certain rules.
  • QR two-dimensional code is the most common.
  • the QR two-dimensional code has three patterns resembling "back" characters for positioning (hereinafter referred to as backword features), which are located in the upper left corner, upper right corner, and lower left corner of the two-dimensional code, respectively.
  • the recognition method can be as follows: the image processing technology is used to search for the three linguistic features of the two-dimensional code in the image to be recognized. According to the number and location of the backtracking features, the normal image to be recognized is restored. Then through the binarization method, it is converted into a binarization lattice. Finally, the character content implied by the dot matrix is parsed according to the standard grammar of the QR code.
  • the to-be-recognized image is not perfect, for example, the lingering feature of the two-dimensional code in the to-be-recognized image is greatly deformed, blocked, or the to-be-recognized image is a large-angle image.
  • One or more embodiments of this specification describe a two-dimensional code identification method, device, and equipment, which can accurately identify two-dimensional codes in imperfect images.
  • a two-dimensional code recognition method including:
  • the specified number of corner points of the two-dimensional code are detected in the image to be recognized according to the deep learning detection algorithm
  • the image correction includes at least a perspective transformation
  • a two-dimensional code identification device including:
  • An obtaining unit used to obtain an image to be recognized
  • the detection unit is configured to detect a specified number of corner points of the two-dimensional code in the image to be recognized according to a deep learning detection algorithm when the image to be recognized acquired by the acquisition unit includes a two-dimensional code ;
  • a determining unit configured to determine a target area where the two-dimensional code is located in the image to be identified according to the position coordinates of the specified number of corner points detected by the detecting unit;
  • a correction unit configured to perform image correction on the target area determined by the determination unit to obtain a corrected image; the image correction includes at least perspective transformation;
  • the identification unit is used for performing two-dimensional code identification on the image corrected by the correction unit.
  • a two-dimensional code identification device including:
  • One or more processors are One or more processors.
  • One or more programs wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and when the programs are executed by the processors, the following steps are implemented:
  • the specified number of corner points of the two-dimensional code are detected in the image to be recognized according to the deep learning detection algorithm
  • the image correction includes at least perspective transformation
  • the two-dimensional code recognition method, device and equipment provided in one or more embodiments of this specification acquire images to be recognized.
  • the specified number of corner points of the two-dimensional code are detected in the image to be recognized according to the deep learning detection algorithm.
  • the target area where the two-dimensional code is located in the image to be identified is determined.
  • the image correction here may include at least perspective transformation.
  • Figure 1 is a schematic diagram of the two-dimensional code recognition system provided by this specification.
  • FIG. 2 is a flowchart of a two-dimensional code recognition method provided by an embodiment of the present specification
  • Figure 3 is a schematic diagram of the two-dimensional code provided by this specification.
  • FIG. 5 is a schematic diagram of corners of a two-dimensional code provided by this specification.
  • Figure 6a is a schematic diagram of the corrected image provided by this specification.
  • 6b is a schematic diagram of a contrast-enhanced image provided by this specification.
  • 6c is a schematic diagram of a binary image provided by the specification.
  • FIG. 7 is a schematic diagram of a two-dimensional code recognition device provided by an embodiment of the present specification.
  • FIG. 8 is a schematic diagram of a two-dimensional code identification device provided by an embodiment of the present specification.
  • the acquired image of the two-dimensional code to be recognized (referred to as the image to be recognized for short) is usually not a perfect image.
  • traditional methods usually design complex multi-feature fusion logic, that is, the complexity of traditional two-dimensional code recognition methods is usually relatively high.
  • the QR code here can refer to PDF417 QR code, Datamatrix QR code and QR QR code. In the following description of this specification, a QR two-dimensional code is used as an example for description.
  • the present application is based on a deep learning detection algorithm to determine the two-dimensional code area of the image to be recognized, and then correct and identify the two-dimensional code area.
  • the deep learning detection algorithm is a relatively computationally intensive algorithm, so it is necessary to minimize unnecessary input.
  • One implementation idea may be: first determine whether the image to be recognized contains a two-dimensional code, and then input the deep learning detection algorithm only when it is determined that the image contains a two-dimensional code.
  • the process of determining the confidence of the above-mentioned back word feature may be as follows: the center point of the back word feature is used as a starting point, and a number of pixels are extended around it to obtain a regular rectangular area containing the back word feature. The gray histogram statistics are performed on the regular rectangular area. If the statistical gray-scale histogram is a bimodal histogram, the confidence of the Huizi feature is relatively high, otherwise the confidence of the Huizi feature is relatively low.
  • an attempt can be made to detect 3 ideal linguistic features in the image to be recognized. If the 3 ideal linguistic features are detected, it can also be determined that the image to be recognized contains a two-dimensional code.
  • picture correction is usually a time-consuming process, and because we are ultimately trying to recognize the two-dimensional code in the recognized image, in order to speed up the correction efficiency of the image to be recognized, we can consider only the two Dimension code area for correction. So how to determine and recognize the two-dimensional code area from the image to be recognized?
  • One implementation idea may be that, according to the deep learning detection algorithm, a specified number of corner points of the two-dimensional code are detected in the image to be recognized. According to the position coordinates of the specified number of corner points, the two-dimensional code area in the image to be recognized is determined. It should be noted that the above-mentioned deep learning detection algorithm may be obtained by training a plurality of images of a specified number of corner points of a pre-calibrated two-dimensional code.
  • Another implementation idea may be that the two-dimensional code area is determined according to the positions of the three ideal ligature features detected in the image to be recognized.
  • the specified number of corner points of the two-dimensional code can be detected. Therefore, based on the coordinates of the specified number of corner points, image correction processing such as perspective transformation and lens distortion correction can be simultaneously performed on the two-dimensional code area.
  • image correction processing such as perspective transformation and lens distortion correction
  • multiple writing of image data in the memory can be avoided, which can greatly improve the correction efficiency of the image, thereby further improving the recognition efficiency of the two-dimensional code.
  • FIG. 1 is a schematic diagram of a two-dimensional code recognition system provided by this specification.
  • the two-dimensional code recognition system 10 may include: a feature detection module 102, a corner detection module 104, an image correction module 106, and a recognition module 108.
  • the feature detection module 102 is used to detect a back word feature with relatively high confidence in the image to be recognized.
  • the hyphen feature here has the following characteristics: the length ratio of line segments composed of black and white pixels is 1:1:3:1:1. Using this feature, the Huizi feature can be recognized in the image to be recognized. The determination of the confidence level of the above-mentioned back word feature is as described above and will not be repeated here.
  • the corner detection module 104 is configured to detect a specified number of corners of the two-dimensional code in the image to be recognized including the two-dimensional code.
  • the to-be-recognized image containing the two-dimensional code here may refer to the to-be-recognized image that has detected a character with high confidence.
  • the corner detection module 104 can specifically detect the specified number of corners of the two-dimensional code through a deep learning detection algorithm.
  • the image correction module 106 is used to perform image correction on the area (that is, the two-dimensional code area) determined by the position coordinates of the specified number of corner points.
  • the image correction here may include but is not limited to perspective transformation and lens distortion correction. It should be noted that, due to the deep learning detection algorithm, a specified number of corner points of the two-dimensional code can be detected. Therefore, based on the specified number of corner points, two-dimensional code regions can be simultaneously subjected to perspective transformation and lens distortion correction, which can greatly improve the efficiency of image correction.
  • the recognition module 108 is used to recognize the two-dimensional code area after image correction. For example, identify and output the content contained in the QR code.
  • the above two-dimensional code recognition system may further include a contrast enhancement module 110.
  • the contrast enhancement module 110 is used to enhance the contrast of the image-corrected two-dimensional code region by using a local histogram method, so that a better contrast can be obtained.
  • a binarization module 112 may also be included.
  • the binarization module 112 is used to perform binarization processing on the image-corrected two-dimensional code region or the contrast-enhanced two-dimensional code region, thereby making the two-dimensional code region easier to recognize.
  • the execution subject of the method may be a device with processing capabilities: a server or a system or an apparatus, for example, it may be a two-dimensional code recognition system in FIG. 1.
  • the method may specifically include:
  • Step 202 Acquire an image to be recognized.
  • the image to be recognized may be obtained through the camera of the terminal device, and the terminal device here may refer to a smartphone, tablet computer, digital camera, or other similar terminal device.
  • the image to be recognized may be processed in grayscale to obtain a grayscale image.
  • the value range of the gray value (referred to as the pixel value) of the pixels in the gray image may be: [0,255].
  • the following determination step of whether a two-dimensional code is included may be performed. This step may be specifically performed by the feature detection module 102, which may specifically include:
  • Step a Perform feature detection on the gray-scale image to detect whether the image to be recognized contains linguistic features.
  • the syllable feature in this specification has the characteristics of 1:1:3:1:1, so the aforementioned syllable feature can be detected based on this feature.
  • the image to be recognized is relatively perfect, it is usually possible to detect three back features.
  • the ideal three ligature features cannot be detected, but a single ligature feature can usually be detected.
  • the method for judging whether a two-dimensional code is included in the embodiment of the specification has high robustness. Taking the two-dimensional code shown in FIG. 3 as an example, the back word feature in the upper left corner can be detected.
  • step b if the lingering feature is detected, the center point of the lingering feature is used as a starting point, and a number of pixels are expanded to the surrounding area to obtain a regular rectangular area containing the lingering feature.
  • “surrounding” may refer to the four directions of the back character feature, so the above expansion operation is to extend several pixels in the four directions of the back character feature, respectively.
  • the number of pixels expanded in each direction is determined by the size of the back word feature.
  • the number of the extended pixels may be: 1*8, which is set to 8 here because the final rectangular area obtained needs to include a back word feature (that is, greater than 7 dot-matrix units),
  • the 1 here represents the aforementioned 1 pixel.
  • the 8 in the formula can also be replaced by any number greater than 8, which is not limited in this manual.
  • Step c Perform gray histogram statistics on the positive rectangular area.
  • the horizontal coordinate of the grayscale histogram here can be different pixel values contained in the regular rectangular area.
  • the value range of the pixel value here is: [0,255], and the vertical coordinate is the number of different pixel values .
  • Step d If the statistical grayscale histogram is a bimodal histogram, it is determined that the image to be recognized contains a two-dimensional code.
  • steps b-d may be performed when the ideal three syllable features cannot be detected. If three ideal linguistic features can be detected through step a, it can be directly judged that the image to be recognized contains a two-dimensional code without performing steps b-d, which is not limited in this specification.
  • a method for determining whether a two-dimensional code is included in an image to be recognized by detecting a single linguistic feature with high confidence can reduce the misrecognition rate of whether a two-dimensional code is included.
  • Step 204 When the image to be recognized contains a two-dimensional code, detect the specified number of corner points of the two-dimensional code in the image to be recognized according to the deep learning detection algorithm.
  • the corner detection module 104 detects the specified number of corners of the two-dimensional code in the image to be recognized according to the deep learning detection algorithm.
  • the deep learning detection algorithm can detect the specified number of corners of the two-dimensional code, before performing step 204 in this embodiment of the present specification, the following two may also be performed:
  • the judgment steps of the dimension code include:
  • Get the size of the back word feature Convert the size of the QR code according to the preset conversion rules and the size of the back word feature. If the size of the two-dimensional code does not satisfy the preset condition, the region to be recognized centered on the character back is extracted from the image to be recognized. Enlarge the area to be identified.
  • the above-mentioned preset conversion rule can also be set to other algorithms, for example, the size of the back word feature is enlarged by a preset multiple to determine the size of the two-dimensional code, which is not limited in this specification.
  • FIG. 4 shows a schematic diagram of an enlargement process of an area to be recognized.
  • the character-return feature can be extracted from the image to be recognized as
  • the size of the area to be recognized in the center may be 400*400, and then the 400*400 area to be recognized is enlarged.
  • step 204 may be replaced by: detecting the specified number of corner points of the two-dimensional code in the enlarged area to be recognized according to the deep learning detection algorithm.
  • the specified number of corner points in step 204, or in the step after the replacement may refer to 4 corner points of the two-dimensional code. Taking FIG. 3 as an example, the detected four corner points may be as shown in FIG. 5.
  • the deep learning detection algorithm in this specification may be obtained by training a plurality of images of a specified number of corner points of a pre-calibrated two-dimensional code.
  • the human eye's ability to perceive the corners of the two-dimensional code can be simulated, thereby obtaining higher robustness.
  • the algorithm can also be updated faster through deep learning fine tuning.
  • the single-word-return feature detected with high confidence in this specification can be used not only to determine whether the image to be recognized contains a two-dimensional code, but also to convert the size of the two-dimensional code.
  • the surrounding area of the back word feature can be enlarged, thereby improving the success rate of detecting the corner points of the two-dimensional code.
  • the enlarged area can also be understood as the coarse positioning of the two-dimensional code, and this coarse positioning method can reduce the search space of the deep learning detection algorithm.
  • the embodiment of this specification uses a deep learning detection algorithm to determine the two-dimensional code area compared with the traditional method (that is, based on three ideal ligature features to locate the two-dimensional code area), the method has better Greatness.
  • the deep learning detection algorithm provided by the embodiments of the present specification can accurately locate the two-dimensional code area even when the traverse feature of the two-dimensional code is deformed, blocked, or the image to be recognized is a large-angle image.
  • Step 206 Determine the target area where the two-dimensional code is located in the image to be recognized according to the position coordinates of the specified number of corner points.
  • the target area determined in this step may be a rectangular area composed of four corner points in the figure.
  • Step 208 Perform image correction on the target area to obtain a corrected image.
  • the image correction module 108 may perform the above steps 206 and 208.
  • the corrected image as shown in FIG. 6a can be obtained.
  • the above image correction may include at least perspective transformation.
  • lens distortion correction can also be included. It should be noted that, since step 4 can already determine the four corner points of the target area, this step can directly perform perspective transformation. There is no need to perform lens distortion correction on the target area to determine the four corner points of the target area, and then perform perspective transformation on it. In one implementation, when lens distortion correction is also performed on the target area, the lens distortion correction and perspective transformation can be performed simultaneously, that is, only image data needs to be written to the memory once, thereby greatly improving the efficiency of image correction .
  • the lens distortion correction is a non-linear change, it is very resource intensive. Therefore, in this step, only the image correction is performed on the target area, and the image correction is not performed on the entire image to be recognized, which can greatly reduce the amount of calculation.
  • Step 210 perform two-dimensional code recognition on the corrected image.
  • the recognition module 108 may perform two-dimensional code recognition on the corrected image.
  • the embodiments of the present specification may also perform image processing steps such as contrast enhancement and binarization on the corrected image.
  • image processing steps such as contrast enhancement and binarization
  • the local histogram method is first used to perform contrast enhancement processing on the corrected image to obtain a contrast enhanced image.
  • the enhanced image is binarized to obtain a binarized image.
  • two-dimensional code recognition is performed on the binary image.
  • FIG. 6a after performing contrast enhancement processing on it, a contrast enhanced image as shown in FIG. 6b can be obtained. After that, when the image shown in FIG. 6b is binarized, the binarized image shown in FIG. 6c can be obtained.
  • the two-dimensional code recognition method determines whether the two-dimensional code is included in the image to be recognized by detecting a single ligature feature with high confidence. Discard the to-be-recognized images that do not contain the two-dimensional code, so that all images can be prevented from going through a deep learning detection algorithm that is relatively computationally intensive. In addition, through the single-word-back feature with high confidence, coarse positioning of the two-dimensional code can also be achieved, so that when the size of the two-dimensional code does not meet the preset conditions, the back-characteristic feature is used as the center to determine the surrounding area. To zoom in.
  • an embodiment of this specification also provides a two-dimensional code recognition device.
  • the device may include:
  • the obtaining unit 702 is used to obtain an image to be recognized.
  • the detection unit 704 is configured to detect a specified number of corner points of the two-dimensional code in the image to be recognized according to the deep learning detection algorithm when the image to be recognized acquired by the acquisition unit 702 includes the two-dimensional code.
  • the function of the detection unit 704 can be realized by the corner detection module 104.
  • the determining unit 706 is configured to determine the target area where the two-dimensional code is located in the image to be identified according to the position coordinates of the specified number of corner points detected by the detecting unit 704.
  • the correction unit 708 is configured to perform image correction on the target area determined by the determination unit 706 to obtain a corrected image.
  • the image correction here may include at least perspective transformation.
  • lens distortion correction can also be included.
  • the functions of the determination unit 706 and the correction unit 708 described above may be implemented by the image correction module 106.
  • the recognition unit 710 is configured to perform two-dimensional code recognition on the image corrected by the correction unit 708.
  • the function of the identification unit 710 can be implemented by the identification module 108.
  • the device may further include: a judging unit (not shown in the figure), which is used to perform feature detection on the image to be recognized to detect whether the image to be recognized contains a back word feature. If the backtrack feature is detected, the center point of the backtrack feature is used as the starting point, and a number of pixels are extended around it to obtain a regular rectangular area containing the backtrack feature. The gray histogram statistics are performed on the regular rectangular area. If the statistical grayscale histogram is a bimodal histogram, it is determined that the image to be recognized contains a two-dimensional code.
  • the function of the above-mentioned judgment unit can be realized by the feature detection module 102.
  • the device may further include: a conversion unit, an extraction unit, and an amplification unit.
  • the obtaining unit 702 is also used to obtain the size of the back word feature.
  • the conversion unit is configured to convert the size of the two-dimensional code according to a preset conversion rule and the size of the back word feature acquired by the acquisition unit 702.
  • the extracting unit is used to extract the region to be recognized centered on the character-returning feature from the image to be recognized if the size of the two-dimensional code converted by the conversion unit does not satisfy the preset condition.
  • An enlargement unit is used to enlarge the region to be recognized extracted by the extraction unit.
  • the detection unit 704 is specifically used for:
  • a specified number of corner points of the two-dimensional code are detected in the enlarged area to be recognized.
  • the identification unit 710 is specifically used for:
  • the method of local histogram is used to perform contrast enhancement processing on the corrected image to obtain a contrast enhanced image.
  • the function of the recognition unit 710 here can be realized by the above-mentioned recognition module 108, contrast enhancement module 110, and binarization module 112 together.
  • the obtaining unit 702 obtains an image to be recognized.
  • the detection unit 704 detects the specified number of corner points of the two-dimensional code in the image to be recognized according to the deep learning detection algorithm.
  • the determining unit 706 determines the target area where the two-dimensional code is located in the image to be recognized according to the position coordinates of the specified number of corner points.
  • the correction unit 708 performs image correction on the target area to obtain a corrected image.
  • the image correction here may include at least perspective transformation.
  • the recognition unit 710 performs two-dimensional code recognition on the corrected image.
  • an embodiment of this specification also provides a two-dimensional code recognition device, as shown in FIG. 8, the device may include: a memory 802, one or more processors 804, and one or more Programs.
  • the one or more programs are stored in the memory 802, and are configured to be executed by one or more processors 804, and when the program is executed by the processor 804, the following steps are implemented:
  • the specified number of corner points of the two-dimensional code are detected in the image to be recognized.
  • the target area where the two-dimensional code is located in the image to be identified is determined.
  • the image correction includes at least perspective transformation.
  • the two-dimensional code recognition device provided by an embodiment of the present specification can realize accurate recognition of the two-dimensional code in imperfect images.
  • the steps of the method or algorithm described in conjunction with the disclosure of the present specification may be implemented in hardware, or may be implemented by a processor executing software instructions.
  • the software instructions can be composed of corresponding software modules, which can be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, mobile hard disk, CD-ROM or any other form of storage known in the art Medium.
  • An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and can write information to the storage medium.
  • the storage medium may also be a component of the processor.
  • the processor and the storage medium may be located in the ASIC.
  • the ASIC may be located in the server.
  • the processor and the storage medium may also exist as discrete components in the server.
  • Computer-readable media includes computer storage media and communication media, where communication media includes any medium that facilitates transfer of a computer program from one place to another.
  • the storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.

Landscapes

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

Abstract

本说明书实施例提供一种二维码识别方法、装置及设备,获取待识别图像。当待识别图像中包含二维码时,根据深度学习检测算法,在待识别图像中检测二维码的指定个数的角点。根据指定个数的角点的位置坐标,确定二维码在待识别图像中所在的目标区域。对目标区域进行图像校正,得到校正后的图像。这里的图像校正至少可以包括透视变换。对校正后的图像进行二维码识别。

Description

二维码识别方法、装置及设备 技术领域
本说明书一个或多个实施例涉及图像识别领域,尤其涉及一种二维码识别方法、装置及设备。
背景技术
二维码(2-dimensional bar code)是通过按一定规律在平面的二维方向上分布的图形来记录信息的条码。其中,以QR二维码最为常见。QR二维码具有3个用于定位的类似“回”字的图案(以下称为回字特征),分别位于二维码的左上角、右上角、左下角。其识别方法可以如下:采用图像处理技术,在待识别图像中搜索二维码的3个回字特征。根据回字特征的个数和位置,恢复出正常的待识别图像。再通过二值化方法,转换成二值化点阵。最终根据二维码标准语法解析出点阵隐含的字符内容。
然而,当待识别图像不够完美时,如,待识别图像中的二维码的回字特征出现较大形变、被遮挡或者待识别图像为大角度图像。依照传统的方法通常搜索不到理想的3个回字特征,从而也就不能恢复出正常的待识别图像,最终也就无法对二维码进行识别。因此,需要提供一种鲁棒性更强的二维码识别方法。
发明内容
本说明书一个或多个实施例描述了一种二维码识别方法、装置及设备,可以对非完美图像中的二维码进行准确识别。
第一方面,提供了一种二维码识别方法,包括:
获取待识别图像;
当所述待识别图像中包含二维码时,根据深度学习检测算法,在所述待识别图像中检测所述二维码的指定个数的角点;
根据所述指定个数的角点的位置坐标,确定所述二维码在所述待识别图像中所在的目标区域;
对所述目标区域进行图像校正,得到校正后的图像;所述图像校正至少包括透视 变换;
对所述校正后的图像进行二维码识别。
第二方面,提供了一种二维码识别装置,包括:
获取单元,用于获取待识别图像;
检测单元,用于当所述获取单元获取的所述待识别图像中包含二维码时,根据深度学习检测算法,在所述待识别图像中检测所述二维码的指定个数的角点;
确定单元,用于根据所述检测单元检测到的所述指定个数的角点的位置坐标,确定所述二维码在所述待识别图像中所在的目标区域;
校正单元,用于对所述确定单元确定的所述目标区域进行图像校正,得到校正后的图像;所述图像校正至少包括透视变换;
识别单元,用于对所述校正单元校正后的图像进行二维码识别。
第三方面,提供了一种二维码识别设备,包括:
存储器;
一个或多个处理器;以及
一个或多个程序,其中所述一个或多个程序存储在所述存储器中,并且被配置成由所述一个或多个处理器执行,所述程序被所述处理器执行时实现以下步骤:
获取待识别图像;
当所述待识别图像中包含二维码时,根据深度学习检测算法,在所述待识别图像中检测所述二维码的指定个数的角点;
根据所述指定个数的角点的位置坐标,确定所述二维码在所述待识别图像中所在的目标区域;
对所述目标区域进行图像校正,得到校正后的图像;所述图像校正至少包括透视变换;
对所述校正后的图像进行二维码识别。
本说明书一个或多个实施例提供的二维码识别方法、装置及设备,获取待识别图像。当待识别图像中包含二维码时,根据深度学习检测算法,在待识别图像中检测二维 码的指定个数的角点。根据指定个数的角点的位置坐标,确定二维码在待识别图像中所在的目标区域。对目标区域进行图像校正,得到校正后的图像。这里的图像校正至少可以包括透视变换。对校正后的图像进行二维码识别。由此可以看出,本说明书提供的方案,在识别二维码之前,先基于深度学习检测算法,在待识别图像中确定出二维码区域。之后对二维码区域进行校正并识别。由此可以实现对非完美图像中二维码的准确识别,此外,还可以大大提升二维码的识别效率。
附图说明
为了更清楚地说明本说明书实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。
图1为本说明书提供的二维码识别系统示意图;
图2为本说明书一个实施例提供的二维码识别方法流程图;
图3为本说明书提供的二维码示意图;
图4为本说明书提供的待识别区域的放大过程示意图;
图5为本说明书提供的二维码的角点示意图;
图6a为本说明书提供的校正后的图像示意图;
图6b为本说明书提供的对比度增强图像示意图;
图6c为本说明书提供的二值化图像示意图;
图7为本说明书一个实施例提供的二维码识别装置示意图;
图8为本说明书一个实施例提供的二维码识别设备示意图。
具体实施方式
下面结合附图,对本说明书提供的方案进行描述。
在描述本说明书提供的方案之前,先对该方案的发明构思作如下介绍:
由于受到摄像头位置、距离、角度、环境光照等因素的影响,获取的待识别二维 码的图像(简称待识别图像)通常不是完美的图像。为了适应各种质量的待识别图像,传统方法通常会设计复杂的多特征融合的逻辑,也即传统的二维码识别方法的复杂度通常都比较高。这里的二维码可以是指PDF417二维码,Datamatrix二维码以及QR二维码等等。在本说明书的以下描述中,以QR二维码为例进行说明。
本申请的申请人考虑到,传统的二维码识别方法之所以复杂,是因为待识别图像本身不够完美。如果能在对待识别图像进行识别之前,先对其进行很好的校正,那么将大大降低二维码识别方法的复杂度。因此,本方案主要是针对待识别图像的前期处理流程(框架)而提出的。
首先,由于本申请是基于深度学习检测算法,来确定待识别图像的二维码区域,之后针对该二维码区域进行校正并识别。而深度学习检测算法是一种比较耗算力的算法,因此要尽量减少不必要的输入。一种实现思路可以是:先对待识别图像是否包含二维码进行判断,在判断其包含二维码的情况下才输入深度学习检测算法。
在一种实现方式中,可以在待识别图像中检测置信度比较高的回字特征。若检测到一个置信度比较高的回字特征,则可以判断该待识别图像中包含二维码。上述回字特征的置信度的判断过程可以如下:以回字特征的中心点为起点,向其周围扩展若干个像素,以得到包含回字特征的正矩形区域。针对正矩形区域进行灰度直方图统计。若统计的灰度直方图为双峰型直方图,则该回字特征的置信度比较高,否则该回字特征的置信度比较低。
在另一种实现方式中,可以尝试在待识别图像中检测3个理想的回字特征,如果检测到该3个理想的回字特征,则也可以判断该待识别图像中包含二维码。
其次,图片校正通常是一个比较耗时的过程,而因为我们最终是为了对待识别图像中的二维码进行识别,因此,为了加快待识别图像的校正效率,可以考虑仅对待识别图像中的二维码区域进行校正。那么如何从待识别图像中确定识别出二维码区域呢?
一种实现思路可以是,根据深度学习检测算法,在待识别图像中检测二维码的指定个数的角点。根据指定个数的角点的位置坐标,确定待识别图像中的二维码区域。需要说明的是,上述深度学习检测算法可以是根据多张预先标定好二维码的指定个数的角点的多张图像训练得到的。
另一种实现思路可以是,根据在待识别图像中检测到的3个理想的回字特征的位置,来确定二维码区域。
最后,由于通过深度学习检测算法,可以检测出二维码的指定个数的角点。从而基于该指定个数的角点的坐标,可以同时对二维码区域进行透视变换以及镜头畸变校正等图像校正处理。当上述多种图像校正处理可以同时进行时,可以避免图像数据在内存的多次写入,这可以大大提升图像的校正效率,从而可以进一步提升二维码的识别效率。
可以理解的是,在待识别图像经过上述一系列的前期处理之后,可以大幅提升待识别图像的质量,从而使得后续识别算法能够更轻松的识别出二维码包含的内容。
基于上述发明构思,就可以得到本说明提供的方案。以下对本说明书提供的方案进行详细描述。
图1为本说明书提供的二维码识别系统示意图。图1中,该二维码识别系统10可以包括:特征检测模块102、角点检测模块104、图像校正模块106以及识别模块108。
特征检测模块102,用于在待识别图像中检测置信度比较高的回字特征。这里的回字特征具有如下特点:黑白像素构成的线段长度比为:1:1:3:1:1。利用这个特点,可以在待识别图像中识别出该回字特征。上述回字特征的置信度高低的判断如上所述,在此不复赘述。
角点检测模块104,用于在包含二维码的待识别图像中检测二维码的指定个数的角点。这里的包含二维码的待识别图像可以是指检测到置信度比较高的回字特征的待识别图像。如前所述,角点检测模块104具体可以通过深度学习检测算法,来检测二维码的指定个数的角点。
图像校正模块106,用于对由上述指定个数的角点的位置坐标所确定的区域(即二维码区域)进行图像校正。这里的图像校正可以包括但不限于透视变换以及镜头畸变校正等。需要说明的是,由于通过深度学习检测算法,可以检测出二维码的指定个数的角点。从而基于该指定个数的角点,可以同时对二维码区域进行透视变换以及镜头畸变校正,这可以大大提升图像校正的效率。
识别模块108,用于对图像校正后的二维码区域进行识别。如,识别输出二维码中所包含的内容。
可选地,上述二维码识别系统还可以包括对比度增强模块110。对比度增强模块110,用于采用局部直方图的方法对图像校正后的二维码区域进行对比度增强,从而可以得到更好的对比度。
此外,还可以包括二值化模块112。二值化模块112,用于对图像校正后的二维码区域或者对比度增强后的二维码区域进行二值化处理,从而使得二维码区域更易于识别。
图2为本说明书一个实施例提供的二维码识别方法流程图。所述方法的执行主体可以为具有处理能力的设备:服务器或者系统或者装置,如,可以为图1中的二维码识别系统。如图2所示,所述方法具体可以包括:
步骤202,获取待识别图像。
此处,可以是通过终端设备的摄像头获取待识别图像,这里的终端设备可以是指智能手机、平板电脑、数码相机或其它类似终端设备。在获取到待识别图像之后,可以对待识别图像进行灰度处理,以得到灰度图像。需要说明的是,灰度图像中的像素点的灰度值(简称像素值)的取值范围可以为:[0,255]。
如前所述,为了减少深度学习检测算法的不必要的输入,在得到上述灰度图像之后,还可以执行如下是否包含二维码的判断步骤。该步骤具体可以是由特征检测模块102来执行,其具体可以包括:
步骤a,对灰度图像进行特征检测,以检测待识别图像中是否包含回字特征。
如前所述,本说明书中的回字特征具有1:1:3:1:1的特点,因此可以基于该特点来检测上述回字特征。需要说明的是,在待识别图像比较完美的情况下,通常可以检测出3个回字特征。而在待识别图像中的回字特征出现变形、遮挡或者待识别图像为大角度图像时,往往不能检测出理想的3个回字特征,但是单个回字特征通常还是可以检测到的,从而本说明书实施例的是否包含二维码的判断方法具有较高的鲁棒性。以图3所示的二维码为例来说,可以检测到左上角的回字特征。
步骤b,若检测到该回字特征,则以回字特征的中心点为起点,向其周围扩展若干个像素,以得到包含回字特征的正矩形区域。
这里的“周围”可以是指回字特征的四个方向,因此上述扩展的操作即为在回字特征的四个方向上分别扩展若干个像素。其中,在每个方向上所扩展像素的个数由回字特征的大小确定。具体地,根据上述1:1:3:1:1的特点可知,本说明书中的回字特征可以包含7*7个点阵单元,假设1个点阵单元与1个像素相对应,则回字特征的大小为:1*7=7个像素。在一种实现方式中,上述扩展像素的个数可以为:1*8,这里设定为8是因为最终得到的正矩形区域需包含回字特征(也即要大于7个点阵单元),这里的1代表前述1个像素。当然,在实际应用中,公式中的8也可以替换为任一大于8的数字,本说 明书对此不作限定。
步骤c,针对正矩形区域进行灰度直方图统计。
这里的灰度直方图的横坐标可以为正矩形区域所包含的不同的像素值,如前所述,这里的像素值的取值范围为:[0,255],纵坐标为不同像素值的个数。
步骤d,若统计的灰度直方图为双峰型直方图,则判断待识别图像中包含二维码。
需要说明的是,上述步骤b-步骤d可以是在检测不到理想的3个回字特征时执行。若通过步骤a可以检测到3个理想的回字特征,则可以直接判断待识别图像中包含二维码,而不执行步骤b-步骤d,本说明书对此不作限定。
本说明书实施例通过检测单个置信度较高的回字特征,来判断待识别图像中是否包含二维码的方法,可以降低是否包含二维码的误识别率。
步骤204,当待识别图像中包含二维码时,根据深度学习检测算法,在待识别图像中检测二维码的指定个数的角点。
此处,可以是指角点检测模块104根据深度学习检测算法,在待识别图像中检测二维码的指定个数的角点。
可选地,为了确保在待识别图像包含二维码时,深度学习检测算法能够检测到该二维码的指定个数的角点,本说明书实施例在执行步骤204之前,还可以执行如下二维码大小的判断步骤,包括:
获取回字特征的大小。根据预设的换算规则以及回字特征的大小,换算二维码的大小。若二维码的大小不满足预设条件,则从待识别图像中提取以回字特征为中心的待识别区域。对该待识别区域进行放大。
上述二维码的大小的换算过程可以举例如下:假设获取的回字特征的大小为:3*7=21个像素,从而可以确定回字特征的1个点阵单元对应3个像素。且假设预设的换算规则为:二维码的大小根据1个点阵单元对应的像素个数与预设的最大二维码点阵确定。那么当预设的最大二维码点阵为:57*57时,二维码的大小可以为:3*57=171个像素。
当然,在实际应用中,上述预设的换算规则也可以设定为其它算法,如,将回字特征的大小放大预设倍数来确定二维码的大小,本说明书对此不作限定。
图4示出了待识别区域的放大过程示意图。图4中,假设待识别图像的大小为: 1000*1000,且假设根据上述换算规则,换算得到的二维码的大小不满足预设条件,则可以从待识别图像中提取以回字特征为中心的待识别区域,其大小可以为400*400,之后对该400*400的待识别区域进行放大。
可以理解的是,当还执行待识别区域的放大操作时,步骤204可以替换为:根据深度学习检测算法,在放大后的待识别区域中检测二维码的指定个数的角点。
在一个例子中,步骤204中,或者上述替换后的步骤中的指定个数的角点可以是指二维码的4的角点。还以图3为例来说,检测出的4个角点可以如图5所示。
此外,本说明书中的深度学习检测算法可以是根据多张预先标定好二维码的指定个数的角点的多张图像训练得到的。通过训练该深度学习检测算法,可以模拟人眼对二维码角点的感知能力,从而得到较高的鲁棒性。当出现新的场景时,通过深度学习微调(finetune),也可以较快的更新算法。
由此可以看出,本说明书检测出的单个置信度较高的回字特征,不仅可以用于判断待识别图像中是否包含二维码,其大小还可以用于换算二维码的大小。当二维码的大小不满足预设条件时,可以对回字特征的周围区域进行放大,由此来提升二维码的角点的检测的成功率。此外,放大后的区域也可以理解为是二维码的粗定位,通过该粗定位方式,可以降低深度学习检测算法的搜索空间。
再者,本说明书实施例通过深度学习检测算法,来确定二维码区域的方法相比于传统的方法(即基于3个理想的回字特征来定位二维码区域),具有较好的鲁棒性。具体地,本说明书实施例提供的深度学习检测算法,在二维码的回字特征出现变形、被遮挡或者待识别图像为大角度图像时,也能够准确地对二维码区域进行定位。
步骤206,根据指定个数的角点的位置坐标,确定二维码在待识别图像中所在的目标区域。
以图5为例来说,该步骤确定的目标区域可以为由图中4个角点所构成的矩形区域。
步骤208,对目标区域进行图像校正,得到校正后的图像。
如,可以是由图像校正模块108来执行上述步骤206以及步骤208。
还以图5为例来说,在对其目标区域进行图像校正之后,可以得到如图6a所示的校正后的图像。
上述图像校正至少可以包括透视变换。此外,还可以包括镜头畸变校正等。需要说明的是,由于通过步骤204已经可以确定出目标区域的4个角点,所以该步骤可以直接进行透视变换。而无需先对目标区域进行镜头畸变校正,以确定目标区域的4个角点,之后再对其进行透视变换。在一种实现方式中,当还对目标区域进行镜头畸变校正时,该镜头畸变校正与透视变换可以同时进行,也即只需向内存中写入一次图像数据,从而可以大大提升图像校正的效率。
此外,由于镜头畸变校正属于非线性变化,其非常消耗资源。因此本步骤只对目标区域进行图像校正,而不对整个待识别图像进行图像校正的方式,可以大大降低运算量。
步骤210,对校正后的图像进行二维码识别。
如,可以是由识别模块108来对校正后的图像进行二维码识别。
为了使得校正后的图像更易于识别,本说明书实施例还可以对校正后的图像执行对比度增强以及二值化等图像处理步骤。具体地,先采用局部直方图的方法,对校正后的图像进行对比度增强处理,得到对比度增强图像。再对增强图像进行二值化处理,得到二值化图像。最后对二值化图像进行二维码识别。
以图6a为例来说,在对其执行对比度增强处理之后,可以得到如图6b所示的对比度增强图像。之后,当对图6b所示的图像进行二值化处理之后,可以得到如图6c所示的二值化图像。
综上,本说明书实施例提供的二维码识别方法,通过检测单个置信度较高的回字特征,来判断待识别图像中是否包含二维码。对不包含二维码的待识别图像进行丢弃,由此可以避免所有图像都经过后续比较耗算力的深度学习检测算法。此外,通过该单个置信度较高的回字特征,还可以实现二维码的粗定位,以便在二维码的大小不满足预设条件时,以该回字特征为中心,对其周围区域进行放大。再者,通过训练深度学习检测算法,来对二维码的角点进行定位,可以避免传统算法为了适应各种二维码图像质量,而设计复杂的多特征融合的逻辑。最后,基于深度学习检测算法所检测出的角点,可以同时对二维码区域进行透视变化以及镜头畸变校正等图像校正处理,从而大大提升了图像的校正效率。
与上述二维码识别方法对应地,本说明书一个实施例还提供的一种二维码识别装置,如图7所示,该装置可以包括:
获取单元702,用于获取待识别图像。
检测单元704,用于当获取单元702获取的待识别图像中包含二维码时,根据深度学习检测算法,在待识别图像中检测二维码的指定个数的角点。
检测单元704的功能可以由角点检测模块104来实现。
确定单元706,用于根据检测单元704检测到的指定个数的角点的位置坐标,确定二维码在待识别图像中所在的目标区域。
校正单元708,用于对确定单元706确定的目标区域进行图像校正,得到校正后的图像,这里的图像校正至少可以包括透视变换。此外,还可以包括镜头畸变校正等。
上述确定单元706以及校正单元708的功能可以由图像校正模块106来实现。
识别单元710,用于对校正单元708校正后的图像进行二维码识别。
其中,识别单元710的功能可以由识别模块108来实现。
可选地,该装置还可以包括:判断单元(图中未示出),用于对待识别图像进行特征检测,以检测待识别图像中是否包含回字特征。若检测到回字特征,则以回字特征的中心点为起点,向其周围扩展若干个像素,以得到包含回字特征的正矩形区域。针对所述正矩形区域进行灰度直方图统计。若统计的灰度直方图为双峰型直方图,则判断待识别图像中包含二维码。
上述判断单元的功能可以由特征检测模块102来实现。
可选地,该装置还可以包括:换算单元、提取单元以及放大单元。
获取单元702,还用于获取回字特征的大小。
换算单元,用于根据预设的换算规则以及获取单元702获取的回字特征的大小,换算二维码的大小。
提取单元,用于若换算单元换算的二维码的大小不满足预设条件,则从待识别图像中提取以回字特征为中心的待识别区域。
放大单元,用于对提取单元提取的待识别区域进行放大。
检测单元704具体用于:
根据深度学习检测算法,在放大后的待识别区域中检测二维码的指定个数的角点。
识别单元710具体用于:
采用局部直方图的方法,对校正后的图像进行对比度增强处理,得到对比度增强图像。
对对比度增强图像进行二值化处理,得到二值化图像。
对二值化图像进行二维码识别。
这里的识别单元710的功能可以由上述识别模块108、对比度增强模块110以及二值化模块112共同来实现。
本说明书上述实施例装置的各功能模块的功能,可以通过上述方法实施例的各步骤来实现,因此,本说明书一个实施例提供的装置的具体工作过程,在此不复赘述。
本说明书一个实施例提供的二维码识别装置,获取单元702获取待识别图像。当待识别图像中包含二维码时,检测单元704根据深度学习检测算法,在待识别图像中检测二维码的指定个数的角点。确定单元706根据指定个数的角点的位置坐标,确定二维码在待识别图像中所在的目标区域。校正单元708对目标区域进行图像校正,得到校正后的图像,这里的图像校正至少可以包括透视变换。识别单元710对校正后的图像进行二维码识别。由此,可以实现对非完美图像中二维码的准确识别,此外,还可以大大提升二维码的识别效率。
与上述二维码识别方法对应地,本说明书实施例还提供了一种二维码识别设备,如图8所示,该设备可以包括:存储器802、一个或多个处理器804以及一个或多个程序。其中,该一个或多个程序存储在存储器802中,并且被配置成由一个或多个处理器804执行,该程序被处理器804执行时实现以下步骤:
获取待识别图像。
当待识别图像中包含二维码时,根据深度学习检测算法,在待识别图像中检测二维码的指定个数的角点。
根据指定个数的角点的位置坐标,确定二维码在待识别图像中所在的目标区域。
对目标区域进行图像校正,得到校正后的图像,该图像校正至少包括透视变换。
对校正后的图像进行二维码识别。
本说明书一个实施例提供的二维码识别设备,可以实现对非完美图像中二维码的 准确识别。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于设备实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
结合本说明书公开内容所描述的方法或者算法的步骤可以硬件的方式来实现,也可以是由处理器执行软件指令的方式来实现。软件指令可以由相应的软件模块组成,软件模块可以被存放于RAM存储器、闪存、ROM存储器、EPROM存储器、EEPROM存储器、寄存器、硬盘、移动硬盘、CD-ROM或者本领域熟知的任何其它形式的存储介质中。一种示例性的存储介质耦合至处理器,从而使处理器能够从该存储介质读取信息,且可向该存储介质写入信息。当然,存储介质也可以是处理器的组成部分。处理器和存储介质可以位于ASIC中。另外,该ASIC可以位于服务器中。当然,处理器和存储介质也可以作为分立组件存在于服务器中。
本领域技术人员应该可以意识到,在上述一个或多个示例中,本发明所描述的功能可以用硬件、软件、固件或它们的任意组合来实现。当使用软件实现时,可以将这些功能存储在计算机可读介质中或者作为计算机可读介质上的一个或多个指令或代码进行传输。计算机可读介质包括计算机存储介质和通信介质,其中通信介质包括便于从一个地方向另一个地方传送计算机程序的任何介质。存储介质可以是通用或专用计算机能够存取的任何可用介质。
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。
以上所述的具体实施方式,对本说明书的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本说明书的具体实施方式而已,并不用于限定本说明书的保护范围,凡在本说明书的技术方案的基础之上,所做的任何修改、等同替换、改进等,均应包括在本说明书的保护范围之内。

Claims (11)

  1. 一种二维码识别方法,包括:
    获取待识别图像;
    当所述待识别图像中包含二维码时,根据深度学习检测算法,在所述待识别图像中检测所述二维码的指定个数的角点;
    根据所述指定个数的角点的位置坐标,确定所述二维码在所述待识别图像中所在的目标区域;
    对所述目标区域进行图像校正,得到校正后的图像;所述图像校正至少包括透视变换;
    对所述校正后的图像进行二维码识别。
  2. 根据权利要求1所述的方法,还包括:判断所述待识别图像中是否包含所述二维码的步骤,包括:
    对所述待识别图像进行特征检测,以检测所述待识别图像中是否包含回字特征;
    若检测到所述回字特征,则以所述回字特征的中心点为起点,向其周围扩展若干个像素,以得到包含所述回字特征的正矩形区域;
    针对所述正矩形区域进行灰度直方图统计;
    若统计的灰度直方图为双峰型直方图,则判断所述待识别图像中包含所述二维码。
  3. 根据权利要求2所述的方法,在所述根据深度学习检测算法,在所述待识别图像中检测所述二维码的指定个数的角点之前,还包括:
    获取所述回字特征的大小;
    根据预设的换算规则以及所述回字特征的大小,换算所述二维码的大小;
    若所述二维码的大小不满足预设条件,则从所述待识别图像中提取以所述回字特征为中心的待识别区域;
    对所述待识别区域进行放大;
    所述根据深度学习检测算法,在所述待识别图像中检测所述二维码的指定个数的角点,包括:
    根据深度学习检测算法,在放大后的待识别区域中检测所述二维码的指定个数的角点。
  4. 根据权利要求1所述的方法,所述图像校正还包括镜头畸变校正。
  5. 根据权利要求1-4任一项所述的方法,所述对所述校正后的图像进行二维码识别,包括:
    采用局部直方图的方法,对所述校正后的图像进行对比度增强处理,得到对比度增强图像;
    对所述对比度增强图像进行二值化处理,得到二值化图像;
    对所述二值化图像进行二维码识别。
  6. 一种二维码识别装置,包括:
    获取单元,用于获取待识别图像;
    检测单元,用于当所述获取单元获取的所述待识别图像中包含二维码时,根据深度学习检测算法,在所述待识别图像中检测所述二维码的指定个数的角点;
    确定单元,用于根据所述检测单元检测到的所述指定个数的角点的位置坐标,确定所述二维码在所述待识别图像中所在的目标区域;
    校正单元,用于对所述确定单元确定的所述目标区域进行图像校正,得到校正后的图像;所述图像校正至少包括透视变换;
    识别单元,用于对所述校正单元校正后的图像进行二维码识别。
  7. 根据权利要求6所述的装置,还包括:判断单元,用于对所述待识别图像进行特征检测,以检测所述待识别图像中是否包含回字特征;
    若检测到所述回字特征,则以所述回字特征的中心点为起点,向其周围扩展若干个像素,以得到包含所述回字特征的正矩形区域;
    针对所述正矩形区域进行灰度直方图统计;
    若统计的灰度直方图为双峰型直方图,则判断所述待识别图像中包含所述二维码。
  8. 根据权利要求7所述的装置,还包括:换算单元、提取单元以及放大单元;
    所述获取单元,还用于获取所述回字特征的大小;
    所述换算单元,用于根据预设的换算规则以及所述获取单元获取的所述回字特征的大小,换算所述二维码的大小;
    所述提取单元,用于若所述换算单元换算的所述二维码的大小不满足预设条件,则从所述待识别图像中提取以所述回字特征为中心的待识别区域;
    所述放大单元,用于对所述提取单元提取的所述待识别区域进行放大;
    所述检测单元具体用于:
    根据深度学习检测算法,在放大后的待识别区域中检测所述二维码的指定个数的角点。
  9. 根据权利要求6所述的装置,所述图像校正还包括镜头畸变校正。
  10. 根据权利要求6-9任一项所述的装置,所述识别单元具体用于:
    采用局部直方图的方法,对所述校正后的图像进行对比度增强处理,得到对比度增强图像;
    对所述对比度增强图像进行二值化处理,得到二值化图像;
    对所述二值化图像进行二维码识别。
  11. 一种二维码识别设备,包括:
    存储器;
    一个或多个处理器;以及
    一个或多个程序,其中所述一个或多个程序存储在所述存储器中,并且被配置成由所述一个或多个处理器执行,所述程序被所述处理器执行时实现以下步骤:
    获取待识别图像;
    当所述待识别图像中包含二维码时,根据深度学习检测算法,在所述待识别图像中检测所述二维码的指定个数的角点;
    根据所述指定个数的角点的位置坐标,确定所述二维码在所述待识别图像中所在的目标区域;
    对所述目标区域进行图像校正,得到校正后的图像;所述图像校正至少包括透视变换;
    对所述校正后的图像进行二维码识别。
PCT/CN2019/114218 2018-12-11 2019-10-30 二维码识别方法、装置及设备 WO2020119301A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811513649.8A CN110046529B (zh) 2018-12-11 2018-12-11 二维码识别方法、装置及设备
CN201811513649.8 2018-12-11

Publications (1)

Publication Number Publication Date
WO2020119301A1 true WO2020119301A1 (zh) 2020-06-18

Family

ID=67273847

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/114218 WO2020119301A1 (zh) 2018-12-11 2019-10-30 二维码识别方法、装置及设备

Country Status (3)

Country Link
CN (1) CN110046529B (zh)
TW (1) TWI726422B (zh)
WO (1) WO2020119301A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112818979A (zh) * 2020-08-26 2021-05-18 腾讯科技(深圳)有限公司 文本识别方法、装置、设备及存储介质
EP4202856A1 (de) * 2021-12-22 2023-06-28 Bayer AG Auslesen von optisch lesbaren codes

Families Citing this family (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110046529B (zh) * 2018-12-11 2020-06-09 阿里巴巴集团控股有限公司 二维码识别方法、装置及设备
CN110490023A (zh) * 2019-08-27 2019-11-22 广东工业大学 一种二维码形变恢复方法、装置及设备
CN110705329B (zh) * 2019-09-30 2021-09-14 联想(北京)有限公司 一种处理方法、装置及电子设备
CN112686959A (zh) * 2019-10-18 2021-04-20 菜鸟智能物流控股有限公司 待识别图像的矫正方法及装置
CN111860489A (zh) * 2019-12-09 2020-10-30 北京嘀嘀无限科技发展有限公司 一种证件图像校正方法、装置、设备及存储介质
CN110751004B (zh) * 2019-10-25 2024-04-30 北京达佳互联信息技术有限公司 二维码检测方法、装置、设备及存储介质
CN113378595B (zh) * 2020-03-10 2023-09-22 顺丰科技有限公司 二维码定位方法、装置、设备及存储介质
CN111222510B (zh) * 2020-03-13 2024-03-15 中冶长天国际工程有限责任公司 一种烧结机的台车箅条图像摄取方法及系统
CN111612012A (zh) * 2020-05-25 2020-09-01 信雅达系统工程股份有限公司 健康码的识别方法及装置
CN111428707B (zh) * 2020-06-08 2020-11-10 北京三快在线科技有限公司 图形识别码的识别方法、装置、存储介质及电子设备
CN111612115B (zh) * 2020-06-15 2023-10-20 支付宝(杭州)信息技术有限公司 交通卡的计次方法、装置、扫码设备和计次卡服务器
CN111723802A (zh) * 2020-06-30 2020-09-29 北京来也网络科技有限公司 一种基于ai的二维码识别方法、装置、设备和介质
CN112308899B (zh) * 2020-11-09 2024-05-07 北京经纬恒润科技股份有限公司 一种挂车角度识别方法及装置
CN112541367A (zh) * 2020-12-11 2021-03-23 上海品览数据科技有限公司 一种基于深度学习和图像处理的多种二维码识别方法
CN113935909A (zh) * 2021-09-22 2022-01-14 南方电网深圳数字电网研究院有限公司 一种二维码校正识别方法及装置
CN114139564B (zh) * 2021-12-07 2024-05-07 Oppo广东移动通信有限公司 二维码检测方法、装置、终端设备及检测网络的训练方法
CN116882433B (zh) * 2023-09-07 2023-12-08 无锡维凯科技有限公司 一种基于机器视觉的扫码识别方法和系统

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104268498A (zh) * 2014-09-29 2015-01-07 杭州华为数字技术有限公司 一种二维码的识别方法及终端
CN105046184A (zh) * 2015-07-22 2015-11-11 福建新大陆自动识别技术有限公司 基于畸变图像校正的二维码解码方法和系统
CN105701434A (zh) * 2015-12-30 2016-06-22 广州卓德信息科技有限公司 二维码扭曲图像的图像校正方法
CN108629221A (zh) * 2018-05-11 2018-10-09 南京邮电大学 一种褶皱畸变qr二维码的校正方法
CN110046529A (zh) * 2018-12-11 2019-07-23 阿里巴巴集团控股有限公司 二维码识别方法、装置及设备

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104424458B (zh) * 2013-08-23 2017-08-04 希姆通信息技术(上海)有限公司 图像识别方法及装置、网络服务器、图像识别设备及系统
CN104200188B (zh) * 2014-08-25 2017-02-15 北京慧眼智行科技有限公司 一种快速定位qr码位置探测图形的方法和系统
CN104809422B (zh) * 2015-04-27 2017-09-05 江苏中科贯微自动化科技有限公司 基于图像处理的qr码识别方法
CN104881770A (zh) * 2015-06-03 2015-09-02 秦志勇 一种快递单信息识别系统和方法
CN105260693B (zh) * 2015-12-01 2017-12-08 浙江工业大学 一种激光二维码定位方法
CN106951812B (zh) * 2017-03-31 2018-12-07 腾讯科技(深圳)有限公司 识别二维码的方法、装置和终端
CN108416412B (zh) * 2018-01-23 2021-04-06 浙江瀚镪自动化设备股份有限公司 一种基于多任务深度学习的物流复合码识别方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104268498A (zh) * 2014-09-29 2015-01-07 杭州华为数字技术有限公司 一种二维码的识别方法及终端
CN105046184A (zh) * 2015-07-22 2015-11-11 福建新大陆自动识别技术有限公司 基于畸变图像校正的二维码解码方法和系统
CN105701434A (zh) * 2015-12-30 2016-06-22 广州卓德信息科技有限公司 二维码扭曲图像的图像校正方法
CN108629221A (zh) * 2018-05-11 2018-10-09 南京邮电大学 一种褶皱畸变qr二维码的校正方法
CN110046529A (zh) * 2018-12-11 2019-07-23 阿里巴巴集团控股有限公司 二维码识别方法、装置及设备

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112818979A (zh) * 2020-08-26 2021-05-18 腾讯科技(深圳)有限公司 文本识别方法、装置、设备及存储介质
CN112818979B (zh) * 2020-08-26 2024-02-02 腾讯科技(深圳)有限公司 文本识别方法、装置、设备及存储介质
EP4202856A1 (de) * 2021-12-22 2023-06-28 Bayer AG Auslesen von optisch lesbaren codes
WO2023117687A1 (de) * 2021-12-22 2023-06-29 Bayer Aktiengesellschaft Auslesen von optisch lesbaren codes
WO2023117688A1 (de) * 2021-12-22 2023-06-29 Bayer Aktiengesellschaft Auslesen von optisch lesbaren codes
US11922269B2 (en) 2021-12-22 2024-03-05 Bayer Aktiengesellschaft Reading out optically readable codes

Also Published As

Publication number Publication date
TW202024997A (zh) 2020-07-01
CN110046529B (zh) 2020-06-09
CN110046529A (zh) 2019-07-23
TWI726422B (zh) 2021-05-01

Similar Documents

Publication Publication Date Title
WO2020119301A1 (zh) 二维码识别方法、装置及设备
CN107220640B (zh) 字符识别方法、装置、计算机设备和计算机可读存储介质
US9171204B2 (en) Method of perspective correction for devanagari text
US9076056B2 (en) Text detection in natural images
US20130129216A1 (en) Text Detection Using Multi-Layer Connected Components With Histograms
JP2016167273A (ja) オブジェクトにおけるテキスト情報を認識するための方法およびシステム
US10438083B1 (en) Method and system for processing candidate strings generated by an optical character recognition process
US10339657B2 (en) Character detection apparatus and method
US9171224B2 (en) Method of improving contrast for text extraction and recognition applications
CN110647882A (zh) 图像校正方法、装置、设备及存储介质
US20180082456A1 (en) Image viewpoint transformation apparatus and method
US11341739B2 (en) Image processing device, image processing method, and program recording medium
US11354883B2 (en) Image processing method and apparatus, and electronic device
CN112287867B (zh) 一种多摄像头的人体动作识别方法及装置
WO2014129018A1 (ja) 文字認識装置、文字認識方法及び記録媒体
US10509934B1 (en) Methods and apparatus for improving QR code locator detectability and/or finding the corners of a locator pattern
CN112419207A (zh) 一种图像矫正方法及装置、系统
US10217020B1 (en) Method and system for identifying multiple strings in an image based upon positions of model strings relative to one another
JP7121132B2 (ja) 画像処理方法、装置及び電子機器
WO2019019681A1 (zh) 身份证图像的倾斜值获取方法及装置、终端、存储介质
CN113129298A (zh) 文本图像的清晰度识别方法
US11087122B1 (en) Method and system for processing candidate strings detected in an image to identify a match of a model string in the image
CN110610163A (zh) 一种自然场景下基于椭圆拟合的表格提取方法及工具
JP5857634B2 (ja) 単語間空白検出装置、単語間空白検出方法及び単語間空白検出用コンピュータプログラム
CN112308044B (zh) 针对掌静脉图像的图像增强处理方法和掌静脉识别方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19894591

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19894591

Country of ref document: EP

Kind code of ref document: A1