QR code area detection methods, QR code recognition methods, electronic devices and media

By using deep learning models to detect and locate QR code regions through multi-level feature fusion, and combining this with secondary focusing technology, the problem of low QR code recognition rate was solved, achieving efficient recognition in complex environments and with multiple codes.

CN115713090BActive Publication Date: 2026-03-10FUZHOU ROCKCHIP SEMICON
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-21
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing QR code and barcode scanners have low recognition rates due to factors such as ambient light, recognition distance, recognition angle, and incomplete information, especially when multiple QR codes are present, making accurate positioning and recognition difficult.

Method used

A deep learning model is used to detect QR code features. The QR code region is located through multi-level feature fusion and edge expansion processing is performed. Combined with secondary focusing technology, image quality and recognition rate are improved.

Benefits of technology

It improves the accuracy and efficiency of QR code recognition, especially when multiple QR codes are present, it can accurately locate and identify each QR code individually, thus improving the recognition rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115713090B_ABST
    Figure CN115713090B_ABST
Patent Text Reader

Abstract

This application provides a QR code region detection method, a QR code recognition method, an electronic device, and a medium. The QR code region detection method includes: acquiring an image for QR code region detection; detecting QR code features in the image, the QR code features including barcode eye features and barcode dot features; and calculating a QR code region based on the QR code features. The QR code recognition method includes: detecting a QR code region according to the QR code region detection method; performing secondary focusing on the QR code region; receiving the secondary-focused QR code image; and calculating the feature code of the QR code image. This application significantly improves the QR code recognition rate.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, in particular to a two-dimensional code region detection method, a two-dimensional code recognition method, an electronic device and a computer readable storage medium. BACKGROUND

[0002] There are various feature codes in the product and industrial fields. One-dimensional product-level feature codes include: UPC-A, UPC-E, EAN-8, EAN-13, UPC / EAN; one-dimensional industrial-level feature codes include: Code 39, Code 93, Code 128, Codabar, Extension 2 / 5. Two-dimensional feature codes include: QR Code, Data Matrix, Aztec, PDF 417, MaxiCode, RSS-14, RSS-Expanded. A two-dimensional code barcode scanner includes a light source emitter, an image sensor, a two-dimensional code recognition program, etc. The two-dimensional code barcode scanner emits a specific light source for barcode scanning by the light source emitter; the light source is reflected on a two-dimensional code medium (a screen two-dimensional code, a metal engraved code, a thin film reflective two-dimensional code, etc.), the two-dimensional code medium has a special feature, and the reflected light beam contains the feature information of the two-dimensional code; the reflected light beam passes through a condenser lens, and the image sensor records the brightness and color of the light signal and converts it into a digital image signal; the digital image signal is recognized by the two-dimensional code recognition program to obtain two-dimensional code information. The two-dimensional code barcode scanner has various forms, such as a mobile phone, a mobile two-dimensional code scanning gun, a fixed two-dimensional code scanning gun, etc.

[0003] The recognition rate of the two-dimensional code barcode scanner is affected by various conditions: environmental light, which is lower or higher than a threshold value, resulting in recognition failure; recognition distance, in the moving process, the two-dimensional code information is undersampled due to exceeding the effective distance, resulting in insufficient effective pixels and recognition failure; recognition angle, in the moving process, the two-dimensional code information is undersampled due to exceeding the effective angle, resulting in insufficient effective pixels and recognition failure; incomplete information, in the moving process, the effective information of the two-dimensional code information is lower than a threshold value, resulting in recognition failure. SUMMARY

[0004] The present application provides a two-dimensional code region detection method, a two-dimensional code recognition method, an electronic device and a computer readable storage medium, which can solve the above problems in the prior art.

[0005] In a first aspect, the present application provides a method for detecting a region of a two-dimensional code. The method comprises: obtaining an image for detecting a region of a two-dimensional code; detecting two-dimensional code features in the image, the two-dimensional code features comprising a code dot feature and a code point feature; and calculating a region of the two-dimensional code based on the two-dimensional code features. In the present application, the region of the two-dimensional code is located by detecting the two-dimensional code features, which is beneficial to indirectly improving the recognition rate of the two-dimensional code.

[0006] In an implementation form of the first aspect, the calculating the region of the two-dimensional code based on the two-dimensional code features comprises: performing region fusion on each region of the detected two-dimensional code features to obtain a two-dimensional code feature region; and calculating the region of the two-dimensional code based on the two-dimensional code feature region, the region of the two-dimensional code comprising the two-dimensional code feature region and an intermediate region between each two-dimensional code feature.

[0007] In an implementation form of the first aspect, the obtaining the image for detecting the region of the two-dimensional code comprises: performing grayscale processing on a collected image to obtain the image for detecting the region of the two-dimensional code. In this implementation form, the collected image is processed in grayscale to facilitate subsequent detection of the region of the two-dimensional code, which is beneficial to reducing the computational complexity and improving the detection speed.

[0008] In an implementation form of the first aspect, the code dot feature and the code point feature each comprise a plurality of hierarchical features. In this implementation form, the plurality of hierarchical features are extracted, which is beneficial to improving the accuracy of the calculation of the region of the two-dimensional code.

[0009] In an implementation form of the first aspect, the code dot feature comprises a code dot low-level feature, a code dot middle-level feature and a code dot high-level feature, the code dot low-level feature comprising a point / line feature of the code dot, the code dot middle-level feature comprising a structure feature of the code dot, and the code dot high-level feature comprising a configuration feature of the code dot.

[0010] In an implementation form of the first aspect, the code point feature comprises a code point low-level feature, a code point middle-level feature and a code point high-level feature, the code point low-level feature comprising a point / line feature of the code point, the code point middle-level feature comprising a structure feature of the code point, and the code point high-level feature comprising a configuration feature of the code point.

[0011] In an implementation form of the first aspect, the calculating the region of the two-dimensional code based on the two-dimensional code features comprises: performing fusion on the plurality of hierarchical code dot features to locate a code dot region in the image; performing fusion on the plurality of hierarchical code point features to locate a code point region in the image; and performing region fusion on the code dot region and the code point region to obtain a maximum fusion region comprising a complete two-dimensional code, the maximum fusion region being the region of the two-dimensional code.

[0012] In an implementation form of the first aspect, the region merging of the code dot region and the code eye region to obtain a maximum merged region comprising one complete two-dimensional code comprises: when the image comprises a plurality of two-dimensional codes, performing region merging based on the code dot region and the code eye region to obtain a plurality of maximum merged regions each comprising one complete two-dimensional code; and segmenting the plurality of maximum merged regions to obtain the plurality of two-dimensional code regions. In this implementation form, the method is applicable to the case of one image with multiple codes, and can separately distinguish the positions of each two-dimensional code in the image, thereby achieving segmentation of the multiple two-dimensional code regions, and further performing image matting, rotation, alignment and other operations on a single two-dimensional code.

[0013] In an implementation form of the first aspect, the detecting the two-dimensional code feature in the image comprises: performing feature detection using a deep learning model to obtain the two-dimensional code feature in the image. In this implementation form, the deep learning model is used to perform multi-level feature detection, which can more accurately identify the positions of large-code-small-image and small-code-large-image codes, and the time complexity does not increase with the increase of image resolution, because the deep learning model always reduces the image to a fixed resolution without affecting the recognition effect. In addition, the time complexity does not increase with the increase of the number of two-dimensional codes in the image, because the deep learning model only performs feature extraction once to extract the two-dimensional code features of all two-dimensional codes in the image.

[0014] In an implementation form of the first aspect, the calculating the two-dimensional code region based on the two-dimensional code feature comprises: calculating the two-dimensional code region using a deep learning model based on the two-dimensional code feature.

[0015] In an implementation form of the first aspect, the two-dimensional code region detection method further comprises: performing edge expansion processing on the two-dimensional code region to generate an image for two-dimensional code recognition comprising the two-dimensional code region. In this implementation form, the edge expansion processing is beneficial to expand the effective pixels of the two-dimensional code region and indirectly improve the recognition rate.

[0016] In a second aspect, the present application provides a two-dimensional code recognition method. The two-dimensional code recognition method comprises: detecting a two-dimensional code region using the two-dimensional code region detection method according to any one of the first aspect of the present application; performing secondary focusing on the two-dimensional code region; receiving a two-dimensional code image after secondary focusing; and calculating a feature code of the two-dimensional code image. In the present application, the two-dimensional code region is detected and the two-dimensional code region is subjected to secondary focusing, so that the two-dimensional code image is complete and has no missing, and the two-dimensional code image is more sharp and clear, thereby improving the quality of the original two-dimensional code image from the data source, which is beneficial to indirectly improve the two-dimensional code recognition rate.

[0017] In a third aspect, the present application provides an electronic device. The electronic device comprises a memory configured to store a computer program; and a processor configured to invoke the computer program to execute the method for detecting a two-dimensional code region according to any one of the first aspect of the present application and / or the method for recognizing a two-dimensional code according to the second aspect of the present application.

[0018] In a fourth aspect, the present application provides a computer readable storage medium having stored thereon a computer program. The computer program is executed to implement the method for detecting a two-dimensional code region according to any one of the first aspect of the present application and / or the method for recognizing a two-dimensional code according to the second aspect of the present application.

[0019] In the method for detecting a two-dimensional code region, the method for recognizing a two-dimensional code, the electronic device and the computer readable medium according to the present application, the two-dimensional code region is detected, the two-dimensional code region is accurately positioned, the effective two-dimensional code image pixels are improved, and the recognition rate of the two-dimensional code is improved. BRIEF DESCRIPTION OF DRAWINGS

[0020] Figure 1 FIG. 4 is a scene schematic diagram of the method for detecting a two-dimensional code region and the method for recognizing a two-dimensional code according to an embodiment of the present application applied to a scanning gun.

[0021] Figure 2 FIG. 5 is a scene schematic diagram of the method for detecting a two-dimensional code region and the method for recognizing a two-dimensional code according to another embodiment of the present application applied to a scanning gun.

[0022] Figure 3 FIG. 6 is a flowchart of the method for detecting a two-dimensional code region according to an embodiment of the present application.

[0023] Figure 4 FIG. 7 is a schematic diagram of a two-dimensional code eye according to an embodiment of the present application.

[0024] Figure 5 FIG. 8 is a schematic diagram of a two-dimensional code dot according to an embodiment of the present application.

[0025] Figure 6 FIG. 9 is a flowchart of the method for detecting a two-dimensional code region according to another embodiment of the present application.

[0026] Figure 7 FIG. 10 is a specific flowchart of the method for detecting a two-dimensional code region according to another embodiment of the present application.

[0027] Figure 8 FIG. 11 is a flowchart of the method for recognizing a two-dimensional code according to an embodiment of the present application.

[0028] Figure 9 FIG. 12 is a block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0029] Following make the embodiments of the present application through specific specific examples, those skilled in the art can easily understand the advantages and effects of the present application from the disclosure of the present application. The present application can also be implemented or applied by another different specific implementation, and the details in the specification can be modified or changed based on different views and applications without departing from the spirit of the present application. It should be noted that the following examples and features in the examples can be combined with each other without conflict.

[0030] It should be noted that the diagrams provided in the following examples only illustrate the basic concept of the present application in a schematic manner, and only show the components related to the present application in the diagrams, not the number, shape and size of the components when actually implemented. The actual implementation of each component may be a random change in number, shape and size, and the component layout pattern may be more complex. In addition, in this paper, relational terms such as "first", "second" and the like are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between the entities or operations.

[0031] The following embodiments of the present application provide a two-dimensional code region detection and two-dimensional code recognition method based on multi-frame fusion, an electronic device, and a medium, including but not limited to a terminal device with image acquisition function such as a scanning gun, a smart phone, a PAD, etc. The following will be described taking a two-dimensional code scanning gun as an example.

[0032] Figure 1 The following is a scene schematic diagram of the two-dimensional code region detection and two-dimensional code recognition method according to an embodiment of the present application applied to a scanning gun. As shown in Figure 1 The scanning gun system includes a scanning gun 1 and a two-dimensional code medium 2, and a two-dimensional code 3 is presented on the two-dimensional code medium 2. The scanning gun 1 includes a light source emitter, an image sensor, a memory and a processor, etc. The memory stores a computer program for two-dimensional code region detection and two-dimensional code recognition, and the processor is configured to call the computer program to perform two-dimensional code region detection and two-dimensional code recognition. The two-dimensional code medium 2 includes screen medium, metal carving medium, thin film reflective medium, etc., and the two-dimensional code 3 is presented on the two-dimensional code medium 2 to form a screen two-dimensional code, a metal carving two-dimensional code, and a thin film reflective two-dimensional code. In the present embodiment, the two-dimensional code medium is a screen medium, preferably the screen medium includes but is not limited to a liquid crystal screen of an electronic device, and the present embodiment takes a liquid crystal screen of a smart phone as an example. Figure 1In this process, a single QR code image is displayed on the screen medium. The light source is reflected on the QR code medium (screen QR code, metal engraved code, thin film reflective QR code, etc.). The screen features have unique characteristics, and the reflected light beam contains the feature information of the QR code. The reflected light beam passes through a focusing lens, and the brightness and color of the light signal are recorded by an image sensor and converted into a digital image signal. The digital image signal is processed by a computer program to detect the QR code area, and then QR code recognition is performed based on the detected QR code area to obtain the QR code features.

[0033] Figure 2 This is a schematic diagram illustrating a scenario where the QR code region detection and QR code recognition method according to another embodiment of this application is applied to a barcode scanner. Figure 1 The difference is, such as Figure 2 As shown, in this embodiment, two QR code images are displayed on the screen medium, and everything else is the same as in Embodiment 1. In this embodiment, the region of each QR code is detected by a QR code region detection method, which can then segment each QR code and complete the QR code recognition.

[0034] It should be noted that: Figure 2 The image shows two QR code images, both of which are approximately the same size. In other embodiments, a single QR code medium may include any number of QR codes, and the sizes of each QR code may differ. This application provides a QR code region detection method that can detect multiple QR codes on the same QR code medium, locate the position of each QR code, segment each QR code, and then complete the QR code recognition.

[0035] The technical solutions in the embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0036] Figure 3 This is a flowchart of the QR code region detection method according to an embodiment of this application. Figure 3 As shown, the QR code region detection method in this embodiment includes the following steps S11 to S14.

[0037] In step S11, an image for two-dimensional code region detection is acquired. As described in the above embodiments, the image for two-dimensional code region detection includes one or more two-dimensional code images. In some embodiments, the acquired image is subjected to grayscale processing to acquire the image for two-dimensional code region detection. The grayscale image acquired by grayscale processing can be an 8-bit grayscale image or a 10-bit grayscale image or a 12-bit grayscale image. Conversion into a grayscale image is advantageous for reducing computational complexity and thus improving the speed of two-dimensional code region detection and two-dimensional code recognition. Of course, grayscale processing of the acquired image in this step S11 is an optional step, and in other embodiments, the acquired image can be directly subjected to subsequent steps S12 and S13.

[0038] In step S12, two-dimensional code features in the image are detected, including code eye features and code point features. Generally, a two-dimensional code includes three code eyes and a plurality of code points, the code eyes are located at the upper left, lower left and upper right corner points of the two-dimensional code, the code eyes are used to determine the position of the detection region, and the code points store the feature code information of the two-dimensional code.

[0039] In step S13, a two-dimensional code region is calculated based on the two-dimensional code features. In some embodiments, the regions of the detected two-dimensional code features are fused to obtain a two-dimensional code feature region. Subsequently, the two-dimensional code region is calculated based on the two-dimensional code feature region, which includes the two-dimensional code feature region and the intermediate region between the two-dimensional code features.

[0040] In steps S12 and S13, intelligent algorithms are used for two-dimensional code feature detection and two-dimensional code region calculation. The intelligent algorithms are not limited to computer vision image algorithms, machine learning image algorithms and deep learning image algorithms, etc.

[0041] Common computer vision image algorithms are edge detection-based image segmentation methods. Computer vision image algorithms attempt to solve the segmentation problem by detecting the edges of different regions. Generally, the grayscale values of pixels on the boundaries of different regions change sharply. If the image is transformed from the spatial domain to the frequency domain by Fourier transform, the edges correspond to the high-frequency part. The simplest edge detection method is the parallel differential operator method, which uses the discontinuity of pixel values in adjacent regions to detect edge points using first or second derivatives.

[0042] Deep Learning (DL) is a subfield of machine learning. Deep learning is inspired by the way the human brain works, and is a learning process that uses deep neural networks to solve feature expression. Deep neural networks are not a completely new concept, and can be understood as a neural network structure containing multiple hidden layers. In order to improve the training effect of deep neural networks, people have made adjustments to the connection method of neurons and the activation function, etc. The purpose is to establish, simulate the neural network that analyzes and learns the human brain, and imitate the mechanism of the human brain to interpret data such as text, images, and sound.

[0043] Preferably, the embodiment uses a deep learning model to detect features to obtain the two-dimensional code features in the image, and then calculates the two-dimensional code region based on the two-dimensional code features using a deep learning model.

[0044] The deep learning model network has a variety of basic network structures: convolutional layer, residual network (ResNet), VGG unit, fully connected layer, nonlinear Relu layer, pooling layer, etc. The deep learning model network structure can use but is not limited to the structure of Mobilenet, Deep Residual Network (ResNet), or VGGnet (Visual Geometry Group Network) network.

[0045] In this embodiment, the code eye features and the code point features each include multiple levels of features. By extracting multiple levels of features, the application can improve the accuracy of two-dimensional code region positioning, thereby obtaining a complete two-dimensional code image, and further improving the accuracy of subsequent two-dimensional code recognition.

[0046] As shown in Figure 4 The two-dimensional code image of different code eye features is shown in Figure 4 In this embodiment, the code eye pattern includes rounded rectangle, inner circle and outer square, square, rounded rectangle, circle, and concentric circle. The configuration feature of the code eye is the composite morphological feature of the code eye. The deep learning engine uses the automatic differentiation and error back propagation components to obtain the configuration feature. The configuration feature is a high-level feature, which has poor visualization and interpretability, and will not be explained in detail here.

[0047] As shown in Figure 5The image shows QR code images with different code point features. These features include low-level, mid-level, and high-level features. Low-level features include the dot / line features of the code points; mid-level features include the structural features; and high-level features include the configuration features. The dot / line features are the dots and lines that make up the code points, and the structural features are the pattern features. Figure 5 In this context, code point patterns include rhombuses, squares, circles, small dots, rounded rectangles, rounded rectangles, and midpoints. The configuration features of code points are composite morphological features, obtained using convolutional layers with large kernels. Deep learning engines employ automatic differentiation and error backpropagation components to acquire these configuration features. Configuration features are high-level features, with relatively poor visualization and interpretability, and will not be explained in detail here.

[0048] Since this application requires the extraction of features at multiple levels of the QR code eye and code point, the deep learning model uses a multi-layer neural network to perform feature recognition on the image, including a multi-layer convolutional network for recognizing the primary features of the QR code (low-level features of the QR code eye and low-level features of the code point), a multi-layer convolutional network for recognizing the intermediate features of the QR code (intermediate features of the QR code eye and intermediate features of the code point), and a multi-layer convolutional network for recognizing the advanced features of the QR code (advanced features of the QR code eye and advanced features of the code point).

[0049] Figure 6 This is a flowchart of a QR code region detection method according to another embodiment of this application. Figure 6 As shown, the QR code region detection method in this embodiment includes steps S11 to S14.

[0050] In this embodiment, steps S11, S12, and S13 are the same as in the above embodiment, and will not be repeated here. Based on the above steps S11 to S13, the QR code region detection method in this embodiment further includes step S14.

[0051] In step S14, the QR code region is expanded to generate an image including the QR code region for QR code recognition. This expansion process extends the image boundary. Since the QR code feature region occupies a limited area in the image, the expansion process in step S14 helps to increase the effective pixels of the QR code region, indirectly improving the recognition rate.

[0052] Figure 7 This is a flowchart illustrating a QR code region detection method according to another embodiment of this application. This embodiment includes steps S11 to S14. In step S13 of this embodiment, calculating the QR code region based on the QR code features includes steps S131 to S133.

[0053] In step S131, the features of multiple levels of the keyhole are fused to locate the keyhole region in the image. That is, after multi-level feature extraction, the multi-level keyhole features need to be fused to locate the keyhole region in the image.

[0054] In step S132, the code point features at multiple levels are fused to locate the code point regions in the image. That is, after multi-level feature extraction, the multi-level code eye features of the code points need to be fused to locate the code point regions in the image.

[0055] In step S133, the code eye region and the code dot region are fused to obtain the largest fused region including a complete QR code, and the largest fused region is the QR code region.

[0056] When the image contains multiple QR codes, after the image is input into the deep learning model, it can detect the eye features of all the QR codes in the image and the dot features of each QR code. Then, after fusion, the eye region and dot region of each QR code are located. Then, based on the eye region and the dot region, region fusion is performed to obtain multiple maximum fused regions containing a complete QR code. Each maximum fused region corresponds to one QR code region. Finally, the multiple maximum fused regions are segmented to obtain multiple QR code regions, thereby enabling the identification of each QR code.

[0057] In the above embodiments, the QR code region detection uses an intelligent algorithm (preferably a deep learning algorithm) to detect the QR code features (multi-level features of the code eye and code dot) in the image, and then locates the QR code region based on the QR code features, thereby achieving accurate positioning of the QR code region, which is beneficial to improving the subsequent QR code recognition rate.

[0058] In some implementations of QR code feature detection, the CPU is used to traverse the image to find QR code (one-dimensional barcode) features. However, this method is only suitable for low-dimensional (width x height) feature detection, and its disadvantages are:

[0059] a. The accuracy is not high; it can only detect low-dimensional textures in images.

[0060] b. The time complexity increases exponentially with the image resolution (as the number of pixels traversed increases).

[0061] c. The time complexity increases linearly with the number of codes, and if there are multiple codes on one image and the multiple QR codes are close together, it is impossible to distinguish the independent positions of two QR codes.

[0062] d. Since the method of using the CPU to traverse the image to find QR code (one-dimensional barcode) features only obtains the QR code by rotating the image at the bullseye position, multiple QR codes in the image cannot be detected when there are multiple codes in one image and the rotation angle of each QR code is inconsistent.

[0063] The QR code region detection method using the preferred deep learning algorithm employed in this application has the following advantages:

[0064] a. Using convolutional neural networks (multi-layer convolution) in deep learning models for multi-dimensional feature detection can more accurately identify the positions of large images with small codes, small images with large codes, etc.

[0065] b. Since deep learning models can reduce images to a fixed resolution, the time complexity of this detection method does not increase with the increase of image resolution, and does not affect the recognition effect (similar to the human brain's processing mechanism).

[0066] c. Since the deep learning model only performs feature extraction once, the time complexity of the deep learning model for QR code feature detection and QR code region calculation does not increase with the number of QR codes in the image.

[0067] d. The advantage of using artificial intelligence for detecting multiple QR codes in a single image lies in its ability to individually identify the position of each QR code within the image, and then separately extract, rotate, and align each code. For example... Figure 2 As shown, in a scenario with multiple QR codes in a single image, all QR codes contained in the image can be detected with a single scan.

[0068] Based on the above description of the QR code region detection method, this application also provides a QR code recognition method. Figure 8 This is a flowchart of a QR code recognition method according to an embodiment of this application. Figure 8 As shown, the QR code recognition method includes the following steps S1 to S3.

[0069] In step S1, the QR code region is detected using the QR code region detection method described in the above embodiments of this application. Preferably, step S1 includes steps S11 to S14, and the specific implementations of steps S11 to S14 have been described in detail in the above embodiments, and will not be repeated here.

[0070] In step S2, the QR code area is refocused.

[0071] The preferred implementation of step S2 includes: based on the detected QR code area (rectangle), using the center of the QR code area as the focus center, calling the camera focus interface of the terminal device (such as the scanner in this embodiment) to automatically focus on the QR code area, making the image of the QR code area sharper and clearer, which is beneficial to indirectly improve the QR code recognition rate.

[0072] for Figure 2 In the case of multiple QR codes in a single image, the target QR code to be identified can be determined through human-computer interaction commands, thereby achieving focus on a single QR code. That is, receiving a recognition command on the terminal device, the recognition command being a human-computer interaction action generated in the target QR code area (such as clicking any position in the area where the target QR code to be identified is displayed on the terminal device), thereby achieving automatic focus on the target QR code.

[0073] In step S3, the QR code image after secondary focusing is received.

[0074] In step S4, the feature code of the QR code image is calculated.

[0075] for Figure 2 In the case of multiple QR codes in a single image, if all QR codes in the image are needed, steps S1 to S4 can be repeated to complete the recognition of each QR code one by one.

[0076] Some QR code recognition methods lack steps such as detecting the QR code region and refocusing the QR code region. This application uses an intelligent algorithm to detect the QR code region and refocus it, thereby improving the quality of the QR code image from the data source and indirectly improving the QR code recognition rate.

[0077] The scope of protection for the QR code region detection method and QR code recognition method described in this application is not limited to the execution order of the steps listed in this embodiment. Any solution implemented by adding, subtracting, or replacing steps in the prior art based on the principles of this application is included within the scope of protection of this application.

[0078] This application also provides an electronic device. Figure 9 This is a block diagram of an electronic device according to an embodiment of the present invention. (Reference) Figure 9 In one embodiment of the present invention, the electronic device 9 includes a memory 91 and a processor 92. The memory 91 is configured to store a computer program, the processor 92 is communicatively connected to the memory 91, and the processor 92 is configured to invoke the computer program to execute the QR code area detection method and / or the QR code recognition method according to the present application.

[0079] Optionally, the electronic device 9 also includes a display 93. The display 93 is communicatively connected to the memory 91 and the processor 92, and serves as a GUI interface for the QR code area detection method and / or QR code recognition method.

[0080] This application also provides a computer-readable storage medium storing a computer program thereon. The computer program is executed by a processor to implement the QR code area detection method and / or the QR code recognition method according to this application. Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing a processor. The program can be stored in a computer-readable storage medium, which is a non-transitory medium, such as random access memory, read-only memory, flash memory, hard disk, solid-state hard disk, magnetic tape, floppy disk, optical disk, and any combination thereof. The above storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0081] This application embodiment may also provide a computer program product comprising one or more computer instructions. When the computer instructions are loaded and executed on a computing device, all or part of the processes or functions described in this application embodiment are generated. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.

[0082] When the computer program product is executed by a computer, the computer performs the method described in the foregoing method embodiments. The computer program product can be a software installation package; when the foregoing method is required, the computer program product can be downloaded and executed on the computer.

[0083] The descriptions of the processes or structures corresponding to the above figures each have their own emphasis. For parts of a process or structure that are not described in detail, please refer to the relevant descriptions of other processes or structures.

[0084] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.

Claims

1. A method of detecting a region of a two-dimensional code, characterized by, The method comprises: acquiring an image for two-dimensional code region detection; detecting two-dimensional code features in the image, the two-dimensional code features comprising code dot features and code point features, the code dot features and the code point features each comprising multiple levels of features; and calculating a two-dimensional code region based on the two-dimensional code features, comprising fusing multiple levels of code dot features to locate a code dot region in the image, fusing multiple levels of code point features to locate a code point region in the image, and regionally fusing the code dot region and the code point region to acquire a maximum fusion region comprising one complete two-dimensional code, the maximum fusion region being the two-dimensional code region.

2. The method of claim 1, wherein Calculating a two-dimensional code region based on the two-dimensional code features comprises: regionally fusing regions of the detected two-dimensional code features to acquire two-dimensional code feature regions; and calculating the two-dimensional code region based on the two-dimensional code feature regions, the two-dimensional code region comprising the two-dimensional code feature regions and intermediate regions between the two-dimensional code features.

3. The method of claim 1, wherein the step of detecting the two-dimensional code region is characterized by, Acquiring an image for two-dimensional code region detection comprises: performing grayscale processing on an acquired image to acquire an image for two-dimensional code region detection.

4. The method of claim 1, wherein The code dot features comprise code dot low-level features, code dot middle-level features and code dot high-level features, the code dot low-level features comprising point / line features of the code dots, the code dot middle-level features comprising structural features of the code dots, and the code dot high-level features comprising configuration features of the code dots.

5. The method of claim 1, wherein The code point features comprise code point low-level features, code point middle-level features and code point high-level features, the code point low-level features comprising point / line features of the code points, the code point middle-level features comprising structural features of the code points, and the code point high-level features comprising configuration features of the code points.

6. The method of claim 1, wherein Regionally fusing the code dot region and the code point region to acquire a maximum fusion region comprising one complete two-dimensional code comprises: when the image comprises multiple two-dimensional codes, regionally fusing the code dot region and the code point region to acquire multiple maximum fusion regions each containing one complete two-dimensional code, each maximum fusion region corresponding to one two-dimensional code region; and segmenting the multiple maximum fusion regions to acquire the multiple two-dimensional code regions.

7. The method of claim 1, wherein Detecting two-dimensional code features in the image comprises: performing feature detection on the image using a deep learning model to acquire the two-dimensional code features in the image.

8. The method of claim 1, wherein Calculating a two-dimensional code region based on the two-dimensional code features comprises: calculating the two-dimensional code region based on the two-dimensional code features using a deep learning model.

9. The method of claim 1, wherein The method further comprises: performing edge expansion processing on the two-dimensional code region to generate an image for two-dimensional code recognition comprising the two-dimensional code region.

10. A two-dimensional code recognition method characterized by comprising: The method comprises: detecting a two-dimensional code region using the two-dimensional code region detection method according to any one of claims 1 to 9; performing secondary focusing on the two-dimensional code region; receiving a two-dimensional code image after secondary focusing; and calculating a feature code of the two-dimensional code image.

11. An electronic device, comprising: The method comprises: a memory configured to store a computer program; and a processor configured to invoke the computer program to execute the two-dimensional code region detection method according to any one of claims 1 to 9 and / or the two-dimensional code recognition method according to claim 10. ​ 12. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed to implement the two-dimensional code region detection method according to any one of claims 1 to 9 and / or the two-dimensional code recognition method according to claim 10. The computer program is executed to implement the two-dimensional code region detection method according to any one of claims 1 to 9 and / or the two-dimensional code recognition method according to claim 10.

Citation Information

Patent Citations

  • Two-dimensional code identification, reading and micro platemaking method and device

    CN103336985A

  • Two-dimensional code positioning frame recognition method and device, electronic equipment and storage medium

    CN111507120A

  • Two-dimensional code image identification method and device, and storage medium

    CN111950318A