AI-based two-dimensional code identification method, device, equipment and medium

文档序号:1113580 发布日期:2020-09-29 浏览:4次 中文

阅读说明:本技术 一种基于ai的二维码识别方法、装置、设备和介质 (AI-based two-dimensional code identification method, device, equipment and medium ) 是由 胡一川 汪冠春 褚瑞 李玮 刘金艳 胡景超 于 2020-06-30 设计创作,主要内容包括:本发明实施例公开一种基于AI的二维码识别方法、装置、设备和介质。该方法包括:检测待检测图片得到二维码在所述待检测图片中的位置信息;根据所述位置信息生成二维码图片;对所述二维码图片进行图片质量增强并识别得到二维码识别结果。本发明实施例中通过对二维码图片进行图片质量增强的方式提高二维码图片的清晰度,以便于后续在进行二维码识别时可以得到二维码识别结果,提高了二维码的识别率。(The embodiment of the invention discloses a two-dimensional code identification method, a two-dimensional code identification device, two-dimensional code identification equipment and a two-dimensional code identification medium based on AI. The method comprises the following steps: detecting a picture to be detected to obtain position information of the two-dimensional code in the picture to be detected; generating a two-dimensional code picture according to the position information; and performing picture quality enhancement on the two-dimension code picture and identifying to obtain a two-dimension code identification result. In the embodiment of the invention, the definition of the two-dimensional code picture is improved by enhancing the picture quality of the two-dimensional code picture, so that a two-dimensional code identification result can be obtained in the subsequent two-dimensional code identification process, and the identification rate of the two-dimensional code is improved.)

1. A two-dimension code identification method based on AI is characterized by comprising the following steps:

s1, detecting the picture to be detected to obtain the position information of the two-dimensional code in the picture to be detected;

s2, generating a two-dimensional code picture according to the position information;

and S3, performing picture quality enhancement on the two-dimensional code picture and identifying to obtain a two-dimensional code identification result.

2. The method according to claim 1, wherein the step S1 specifically includes:

s11, carrying out two-dimensional code detection on the picture to be detected by adopting the detection model to obtain the position information of each two-dimensional code in the picture to be detected.

3. The method according to claim 2, wherein the step S11 specifically includes:

s111, performing two-dimension code detection on a picture to be detected based on a pre-established two-dimension code detection model to obtain position information of each two-dimension code in the picture to be detected;

wherein, the two-dimensional code detection model is: the network model is obtained by training an initial network model based on a plurality of two-dimensional code sample pictures with position information of two-dimensional codes as model training data, wherein the two-dimensional code detection model is used for enabling the two-dimensional code sample pictures to be associated with the position information of the corresponding two-dimensional codes, the two-dimensional code sample pictures are obtained by rotating, carrying out size conversion and/or carrying out picture quality conversion on a plurality of original pictures containing the two-dimensional codes, and the positions of the two-dimensional codes in the original pictures containing the two-dimensional codes are different.

4. The method according to claim 1, wherein the step S2 specifically includes:

s21, determining a target area of the two-dimensional code in the picture to be detected according to the position information;

and S22, generating a two-dimensional code picture containing the target area.

5. The method according to claim 1, wherein the step S3 specifically includes:

s31, selecting a mode from a plurality of preset picture quality enhancement modes to carry out picture quality enhancement on the two-dimensional code picture;

s32, taking the picture with the enhanced picture quality as a current picture, and identifying the current picture by adopting a two-dimensional code identification algorithm;

s33, judging whether an identification result is obtained;

and S34, if yes, using the obtained recognition result as a two-dimensional code recognition result.

6. The method of claim 5, further comprising, after the step S33:

s35, if not, selecting a mode from the rest preset picture quality enhancing modes to enhance the picture quality of the current picture, and returning to execute the step S32.

7. The method according to claim 5, wherein the plurality of preset picture quality enhancement modes in the step S31 include at least two of the following modes:

the method comprises the steps of carrying out picture rotation and picture zooming on the two-dimensional code picture, adjusting the visual color characteristic of the two-dimensional code picture, carrying out morphological opening operation on the two-dimensional code picture, extracting a foreground picture of the two-dimensional code picture and carrying out distortion removal on the two-dimensional code picture.

8. The method of claim 7, wherein the performing picture rotation and picture scaling on the two-dimensional code picture specifically comprises:

rotating two mutually parallel sides of the two-dimensional codes in the two-dimensional code picture to a horizontal direction, and rotating the other two mutually parallel sides to a vertical direction;

and scaling the size of the rotated two-dimensional code picture to a preset size.

9. The method according to claim 7, wherein the adjusting the color intuition characteristic of the two-dimensional code picture specifically comprises:

determining an adjustment value according to the color visual characteristic of the two-dimensional code picture;

and adjusting the color visual characteristics of the two-dimensional code picture according to the adjustment value, wherein the color visual characteristics of the two-dimensional code picture comprise hue, brightness and saturation.

10. The utility model provides a two-dimensional code recognition device based on AI which characterized in that includes:

the two-dimension code detection module is configured to detect a picture to be detected to obtain position information of the two-dimension code in the picture to be detected;

the two-dimensional code picture generating module is configured to generate a two-dimensional code picture according to the position information;

and the two-dimension code identification module is configured to enhance the picture quality of the two-dimension code picture and identify the two-dimension code picture to obtain a two-dimension code identification result.

11. A computing device, the device comprising:

a memory storing executable program code;

a processor coupled to the memory;

wherein the processor calls the executable program code stored in the memory to execute an AI-based two-dimensional code recognition method according to any one of claims 1 to 9.

12. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements an AI-based two-dimensional code recognition method according to any one of claims 1 to 9.

Technical Field

The invention relates to the technical field of two-dimension code identification, in particular to a two-dimension code identification method, a two-dimension code identification device, two-dimension code identification equipment and a two-dimension code identification medium based on AI.

Background

Artificial Intelligence (AI), also known as intelligent machine and machine Intelligence, is a technical science for studying and developing theories, methods, techniques and application systems for simulating, extending and expanding human Intelligence. Refers to the intelligence exhibited by man-made machines. Artificial intelligence generally refers to techniques for presenting human intelligence through ordinary computer programs.

At present, two-dimensional codes are widely applied to various industries, and in many scenes, a user needs to photograph the two-dimensional codes on a paper surface and then scan and identify the two-dimensional codes on a picture. Because the two-dimensional code is difficult to identify on the picture which is not clear enough due to the influence of multiple aspects such as the abrasion of the paper surface, the loss of the paper surface, the color of the paper surface, the brightness of the light at the time of photographing, the photographing technology and the like, the photographed picture is not clear enough, and the identification rate of the two-dimensional code is low.

Disclosure of Invention

The invention provides a two-dimension code identification method, a device, equipment and a medium based on AI (Artificial Intelligence) so as to improve the identification rate of two-dimension codes. The specific technical scheme is as follows.

In a first aspect, an embodiment of the present invention provides an AI-based two-dimensional code identification method, where the method includes:

s1, detecting the picture to be detected to obtain the position information of the two-dimensional code in the picture to be detected;

s2, generating a two-dimensional code picture according to the position information;

and S3, performing picture quality enhancement on the two-dimensional code picture and identifying to obtain a two-dimensional code identification result.

Optionally, the step S1 specifically includes:

s11, carrying out two-dimensional code detection on the picture to be detected by adopting the detection model to obtain the position information of each two-dimensional code in the picture to be detected.

Optionally, the step S11 specifically includes:

s111, performing two-dimension code detection on a picture to be detected based on a pre-established two-dimension code detection model to obtain position information of each two-dimension code in the picture to be detected;

wherein, the two-dimensional code detection model is: the network model is obtained by training an initial network model based on a plurality of two-dimensional code sample pictures with position information of two-dimensional codes as model training data, wherein the two-dimensional code detection model is used for enabling the two-dimensional code sample pictures to be associated with the position information of the corresponding two-dimensional codes, the two-dimensional code sample pictures are obtained by rotating, carrying out size conversion and/or carrying out picture quality conversion on a plurality of original pictures containing the two-dimensional codes, and the positions of the two-dimensional codes in the original pictures containing the two-dimensional codes are different.

Optionally, the step S2 specifically includes:

s21, determining a target area of the two-dimensional code in the picture to be detected according to the position information;

and S22, generating a two-dimensional code picture containing the target area.

Optionally, the step S3 specifically includes:

s31, selecting a mode from a plurality of preset picture quality enhancement modes to carry out picture quality enhancement on the two-dimensional code picture;

s32, taking the picture with the enhanced picture quality as a current picture, and identifying the current picture by adopting a two-dimensional code identification algorithm;

s33, judging whether an identification result is obtained;

and S34, if yes, using the obtained recognition result as a two-dimensional code recognition result.

Optionally, after step S33, the method further includes:

s35, if not, selecting a mode from the rest preset picture quality enhancing modes to enhance the picture quality of the current picture, and returning to execute the step S32.

Optionally, the preset picture quality enhancement modes in step S31 include at least two of the following modes:

the method comprises the steps of carrying out picture rotation and picture zooming on the two-dimensional code picture, adjusting the visual color characteristic of the two-dimensional code picture, carrying out morphological opening operation on the two-dimensional code picture, extracting a foreground picture of the two-dimensional code picture and carrying out distortion removal on the two-dimensional code picture.

Optionally, the image rotation and image scaling are performed on the two-dimensional code image, which specifically includes:

rotating two mutually parallel sides of the two-dimensional codes in the two-dimensional code picture to a horizontal direction, and rotating the other two mutually parallel sides to a vertical direction;

and scaling the size of the rotated two-dimensional code picture to a preset size.

Optionally, the adjusting of the color intuition characteristic of the two-dimensional code picture specifically includes:

determining an adjustment value according to the color visual characteristic of the two-dimensional code picture;

and adjusting the color visual characteristics of the two-dimensional code picture according to the adjustment value, wherein the color visual characteristics of the two-dimensional code picture comprise hue, brightness and saturation.

In a second aspect, an embodiment of the present invention provides an AI-based two-dimensional code recognition apparatus, where the apparatus includes:

the two-dimension code detection module is configured to detect a picture to be detected to obtain position information of the two-dimension code in the picture to be detected;

the two-dimensional code picture generating module is configured to generate a two-dimensional code picture according to the position information;

and the two-dimension code identification module is configured to enhance the picture quality of the two-dimension code picture and identify the two-dimension code picture to obtain a two-dimension code identification result.

In a third aspect, an embodiment of the present invention provides a computing device, where the device includes:

a memory storing executable program code;

a processor coupled to the memory;

the processor calls the executable program code stored in the memory to execute the AI-based two-dimensional code identification method according to the first aspect.

In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the AI-based two-dimensional code recognition method according to the first aspect.

As can be seen from the above, in the embodiment of the present invention, in order to identify the two-dimensional code, the picture to be detected needs to be detected to obtain the position information of the two-dimensional code in the picture to be detected, and then the two-dimensional code picture is generated according to the position information, so that the picture quality of the two-dimensional code picture is enhanced and identified to obtain the two-dimensional code identification result. In the embodiment of the invention, the definition of the two-dimensional code picture is improved by enhancing the picture quality of the two-dimensional code picture, so that a two-dimensional code identification result can be obtained in the subsequent two-dimensional code identification process, and the identification rate of the two-dimensional code is improved. Of course, not all of the advantages described above need to be achieved at the same time in the practice of any one product or method of the invention.

The innovation points of the embodiment of the invention comprise:

1. in the embodiment of the invention, in order to identify the two-dimensional code, the picture to be detected needs to be detected to obtain the position information of the two-dimensional code in the picture to be detected, then the two-dimensional code picture is generated according to the position information, and further the picture quality of the two-dimensional code picture is enhanced and identified to obtain the two-dimensional code identification result. In the embodiment of the invention, the definition of the two-dimensional code picture is improved by enhancing the picture quality of the two-dimensional code picture, so that a two-dimensional code identification result can be obtained in the subsequent two-dimensional code identification process, and the identification rate of the two-dimensional code is improved.

2. The AI-based two-dimensional code identification method provided by the embodiment of the invention is executed by a computer in the whole process, and manual participation is not needed in the whole process, so that the two-dimensional code identification efficiency is improved.

3. According to the embodiment of the invention, the definition of the two-dimensional code picture is improved in a mode of enhancing the picture quality of the two-dimensional code picture, so that the two-dimensional codes in some pictures which are not clear enough can be identified to obtain the two-dimensional code identification result, therefore, a client does not need to take clear pictures deliberately when taking pictures of the two-dimensional codes, the limitation of the client on taking pictures is small, and the satisfaction degree of the client is improved.

4. Because the two-dimension code sample picture adopted when the two-dimension code detection model is established is obtained by rotating, carrying out size conversion and/or picture quality conversion on a plurality of original pictures containing the two-dimension codes, and the positions of the two-dimension codes in the original pictures containing the two-dimension codes are different, the two-dimension code sample picture in the embodiment of the invention covers various conditions of different positions of the two-dimension codes in the pictures as much as possible, so that the two-dimension code detection model obtained by training the initial network model based on the two-dimension code sample picture as model training data can more accurately position the two-dimension codes in the pictures to be detected, and the detection accuracy is improved.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below. It is to be understood that the drawings in the following description are merely exemplary of some embodiments of the invention. For a person skilled in the art, without inventive effort, further figures can be obtained from these figures.

Fig. 1 is a schematic flow chart of two-dimensional code identification provided in this embodiment;

fig. 2 is a schematic flowchart of an AI-based two-dimensional code recognition method according to an embodiment of the present invention;

FIG. 3 is a schematic diagram illustrating the principle of determining a target region in a picture to be detected based on position information;

fig. 4 is a schematic structural diagram of an AI-based two-dimensional code recognition apparatus according to an embodiment of the present invention;

fig. 5 is a schematic structural diagram of a computing device according to an embodiment of the present invention.

Detailed Description

The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. It is to be understood that the described embodiments are merely a few embodiments of the invention, and not all embodiments. All other embodiments, which can be obtained by a person skilled in the art without inventive effort based on the embodiments of the present invention, are within the scope of the present invention.

It is to be noted that the terms "comprises" and "comprising" and any variations thereof in the embodiments and drawings of the present invention are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.

In the description of the present invention, the term "two-dimensional code", also called two-dimensional bar code, is an encoding mode that is popular on mobile devices in recent years, and can store more information and represent more data types than the traditional bar code. The two-dimensional code is a pattern which is distributed in a two-dimensional direction of a plane according to a certain rule by using a certain specific geometric figure, is black and white and is alternated and records data symbol information.

In the description of the present invention, the term "position information" refers to information that can be used to identify a position of a two-dimensional code, which is identified from a picture to be detected, for example: the position of three positioning points which can be used for identifying the position of the two-dimensional code is contained in the two-dimensional code.

In the description of the present invention, the term "target region" refers to a region where a two-dimensional code is located in a picture to be detected, and the target region ideally includes only the two-dimensional code, and in an actual state, the periphery of the two-dimensional code may include some edges formed by background colors.

In the description of the present invention, the term "color visualization characteristic" is a color space, also called a hexagonal cone model, and the color parameters included in this model are: hue, brightness and saturation.

In the description of the present invention, the term "morphological opening operation" refers to an operation of erosion followed by expansion. Erosion refers to scanning each pixel in an image with a size of a structural element, typically 3 x 3, and anding each pixel in the structural element with its overlying pixel, if both are 1, then the pixel is 1, otherwise it is 0. The center and the field have a point which is not a black point and is corroded to a white point. Dilation means that each pixel in the image is scanned with a structuring element, typically 3 x 3, and each pixel in the structuring element is anded with its overlying pixel, which is 0 if both are 0, and 1 otherwise.

The following provides a detailed description of the embodiments of the present invention with reference to the accompanying drawings.

16页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:图像处理方法、装置、设备及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!