QR code recognition method, device, computer equipment and storage medium

By preprocessing and positioning the QR code image for frame recognition, adjusting the offset angle, and converting the QR code image to an appropriate coordinate system, the problems of low efficiency and poor accuracy of QR code recognition in the existing technology are solved, and the Real-time recognition in high-speed mobile devices.

CN109753838BActive Publication Date: 2024-10-01深圳市三宝智能机器人有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910227328.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2018-12-12
Filing Date
2019-03-25
Publication Date
2024-10-01
Estimated Expiration
2039-03-25

AI Technical Summary

Technical Problem

When existing technology recognizes QR codes, especially when the image has severe geometric distortion, it is difficult to achieve rapid and accurate recognition, which affects the AGV's driving speed and recognition rate.

Method used

By acquiring the QR code image to be recognized for preprocessing, identifying the positioning frame of the QR code, adjusting the offset angle, and converting the QR code image from the image coordinate system to the QR code coordinate system, real-time high-speed recognition of the QR code is achieved. .

Benefits of technology

It improves the accuracy and efficiency of QR code recognition, enables real-time recognition in high-speed mobile devices, and is suitable for AGV navigation and transportation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN109753838B_ABST
    Figure CN109753838B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image recognition, and in particular to a two-dimensional code recognition method, device, computer equipment, and storage medium, the method comprising: obtaining an image containing a two-dimensional code to be recognized, and preprocessing the image; obtaining a regional image containing the two-dimensional code; adjusting the offset angle of the regional image to obtain a region containing only the two-dimensional code; projecting the region containing only the two-dimensional code into a coordinate system for recognition to obtain information of the two-dimensional code. The present invention uses two positioning frames to determine whether the image has a two-dimensional code by determining whether there are two positioning frames, and obtains the offset angle of the two-dimensional code according to the centroid of the two positioning frames. According to the calculated offset angle, the two-dimensional code image is converted from an image-based coordinate system to a two-dimensional code-based coordinate system, thereby realizing real-time and high-speed recognition of the two-dimensional code, and can be applied to high-speed mobile devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image recognition, and in particular to a two-dimensional code recognition method, device, computer equipment, and storage medium. Background Art

[0002] QR code is an information code relative to one-dimensional barcode. It makes full use of the two-dimensional space on the plane, greatly improves the information density, and makes it possible to encode big data in a small area. It has optimistic application scenarios and potential in various industries.

[0003] In the prior art, when recognizing a QR code, the preprocessing of the QR code relies on edge detection based on Gaussian Laplace. First, the image is subjected to Gaussian convolution filtering for noise reduction, and then the Laplace operator is used for edge detection. In addition, there is also straight line detection based on Hough transform. The gradient direction of the straight line is applied in reverse to obtain the endpoint information of the straight line segment, and the gradient direction of the straight line is integrated into the Hough transform. However, when the image has relatively serious geometric distortion, the two direct edges of the addressing image L will have curvature, which makes it difficult to detect and affects the final recognition rate. The straight line detection based on Hough transform has a large amount of calculation and is difficult to quickly calculate the result. Generally, it can only be processed by industrial computers, and there is no way to achieve real-time QR code recognition. When used for positioning and navigation of AGV (Automatic Guided Vehicle), the frame rate is insufficient, which affects the driving speed of AGV.

[0004] It can be seen that the existing technology is not efficient in recognizing QR codes with missing images, and is basically unable to recognize fast-moving QR codes. There are also problems of inaccurate recognition or unrecognizable codes, which need to be improved. Summary of the invention

[0005] Based on this, it is necessary to provide a two-dimensional code recognition method, device, computer equipment and storage medium to address the above-mentioned problems.

[0006] In one embodiment, the present invention provides a two-dimensional code recognition method, the method comprising:

[0007] Acquire a two-dimensional code image to be identified, and preprocess the two-dimensional code image;

[0008] Acquire a region image containing the QR code;

[0009] Adjusting the offset angle of the regional image to obtain a region containing only the QR code;

[0010] The area containing only the two-dimensional code is projected into a coordinate system for identification to obtain the information of the two-dimensional code.

[0011] In one embodiment, the present invention provides a two-dimensional code recognition device, the device comprising:

[0012] An image acquisition unit, the image acquisition unit is used to acquire a two-dimensional code image to be identified;

[0013] An image processing unit, the image processing unit is used to process the two-dimensional code image to be identified to obtain two-dimensional code information;

[0014] An information output unit, wherein the information output unit is used to output the two-dimensional code information.

[0015] In one embodiment, the present invention provides a computer device including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the above-mentioned two-dimensional code recognition method.

[0016] In one of the embodiments, the present invention further provides a computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the processor executes the steps of the above-mentioned two-dimensional code recognition method.

[0017] The above-mentioned QR code recognition method, device, computer equipment and storage medium, with the help of two positioning frames, can determine whether there is a QR code in the image by judging whether there are two positioning frames, and obtain the offset angle of the QR code according to the centroid of the two positioning frames. According to the calculated offset angle, the QR code image is converted from an image-based coordinate system to a QR code-based coordinate system, thereby realizing real-time and high-speed recognition of QR codes, and can be applied to high-speed mobile devices. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 A diagram of an application environment of a two-dimensional code recognition method provided in one embodiment;

[0019] Figure 2 A diagram showing steps of a two-dimensional code recognition method provided by an embodiment;

[0020] Figure 3 A schematic diagram of the coordinates of a two-dimensional code provided by an embodiment;

[0021] Figure 4 is a structural block diagram of a two-dimensional code recognition device provided in one embodiment;

[0022] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0023] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0024] It is understood that the terms "first", "second", etc. used in this application may be used herein to describe various elements, but unless otherwise specified, these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, without departing from the scope of this application, a first xx script may be referred to as a second xx script, and similarly, a second xx script may be referred to as a first xx script.

[0025] Figure 1 FIG. 1 is an application environment diagram of a two-dimensional code recognition method provided in an embodiment, such as Figure 1 As shown, in the application environment, a computer device 110 and a terminal 120 are included.

[0026] In an embodiment of the present invention, the computer device may be an independent physical server or terminal, or a server cluster composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud servers, cloud databases, cloud storage, and CDN.

[0027] The terminal 110 may be a camera, a smart phone, a tablet computer, a laptop computer, etc., but is not limited thereto. The terminal 110 and the computer device 120 may be connected via a network, and the present invention does not limit this.

[0028] like Figure 2 As shown, in one embodiment, a two-dimensional code recognition method is proposed. This embodiment mainly applies this method to the above Figure 1 The computer device 120 in FIG. 1 is used as an example. Specifically, the following steps may be included:

[0029] In step S201, a two-dimensional code image to be identified is obtained, and the two-dimensional code image is preprocessed.

[0030] In the embodiment of the present invention, the two-dimensional code image to be identified refers to an image containing a two-dimensional code. After the computer device 120 obtains the image, the image is pre-processed to reduce the influence of interference noise.

[0031] As an embodiment of the present invention, the method for obtaining the to-be-recognized QR code may be by receiving the to-be-recognized QR code image obtained by a camera, or by reading the to-be-recognized QR code image stored in a storage medium. After the computer device obtains the to-be-recognized QR code image, the image is preprocessed to reduce the influence of interference noise. Specifically, the preprocessing process of the to-be-recognized QR code image includes filtering the image and then binarizing it.

[0032] The embodiment of the present invention can effectively reduce the influence of interference noise and increase the accuracy of two-dimensional code recognition by acquiring a two-dimensional code image to be recognized and preprocessing the image.

[0033] In step S202, an area image containing the two-dimensional code is obtained.

[0034] In the embodiment of the present invention, the regional image containing the QR code in the QR code image to be identified after preprocessing in step S201 is obtained, and the regional image containing the QR code refers to identifying the QR code in the image by identifying the positioning frame of the QR code, and cutting out the regional image of the QR code in the image according to the frame, wherein the positioning frame of the QR code is the frame of the QR code itself. Specifically, the image is scanned for a connected domain, the positioning frame of the QR code is obtained according to the scanning result, and the regional image of the QR code is obtained.

[0035] As an embodiment of the present invention, the preprocessed QR code image contains not only the QR code but also areas that are not QR codes. The image is first scanned for a connected domain, and then the positioning border of the QR code is determined based on the scanning result. The area where the QR code is located is determined based on the positioning border of the QR code. Then, the area where the QR code is located is cut out, and other areas are discarded, leaving the area image containing the QR code.

[0036] The embodiment of the present invention obtains the regional image containing the QR code by identifying the positioning frame of the QR code, thereby reducing the content of image recognition and increasing the accuracy of recognition.

[0037] In step S203, the offset angle of the regional image is adjusted to obtain a region containing only the two-dimensional code.

[0038] In the embodiment of the present invention, after obtaining the area image containing the two-dimensional code, it is necessary to adjust the offset angle of the area image to obtain an area containing only the two-dimensional code. The area containing only the two-dimensional code refers to the black square area containing only the two-dimensional code in the final image, and a two-dimensional code image is obtained.

[0039] As an embodiment of the present invention, after obtaining the regional image containing the QR code, in the regional image, the QR code may be at an inclined angle relative to this image, and the angle of the QR code needs to be adjusted according to the positioning border of the QR code. The positioning border is adjusted so that the angle of the QR code is corrected.

[0040] The embodiment of the present invention adjusts the angle offset of the two-dimensional code according to the recognition frame of the two-dimensional code, thereby ensuring that the two-dimensional code is easy to recognize and increasing the accuracy of two-dimensional code recognition.

[0041] In step S204, the area containing only the two-dimensional code is projected into a coordinate system for identification to obtain information of the two-dimensional code.

[0042] In an embodiment of the present invention, after obtaining the area containing only the QR code, the QR code is projected into a new coordinate system, and the QR code is identified to identify the information of the QR code. The QR code should be orthographically projected into the coordinate system before being identified.

[0043] As an embodiment of the present invention, after the QR code is projected into the coordinate system, the black squares of the QR code remain black, and other areas in the coordinate system are white, so as to highlight the specific shape of the QR code, and the QR code is identified according to the coordinates and grayscale values ​​of the QR code to extract the information in the QR code.

[0044] The embodiment of the present invention projects the QR code into a coordinate system, identifies the QR code according to the coordinate value and grayscale value of the QR code, and then extracts the information of the QR code with high accuracy.

[0045] In the embodiment of the present invention, preprocessing the two-dimensional code image includes filtering the two-dimensional code image and binarizing the two-dimensional code.

[0046] As an embodiment of the present invention, the entire acquired image is filtered to reduce the influence of interference noise. The filtering method can be a noise reduction algorithm such as a median filter or a Gaussian filter. For example, the median filter is used to set the gray value of each pixel to the median of the gray values ​​of all pixels in a certain field window of the point. This method can effectively filter out the noise; the camera equipment refers to a camera or equipment with a camera function, which is used to collect image information to be detected. Binarization is to set the gray value of the pixel of the image, that is, to set the gray value on the image to 0 or 255, so as to obtain a binary image. The binarization method can be an algorithm such as a threshold method, and specifically a method of global uniform threshold. The image is regarded as two types of areas with different gray levels, namely, background and target. The pixel points of the image are compared to distinguish the two types of target and background areas, and the pixels are represented by black and white respectively.

[0047] The embodiment of the present invention pre-processes the entire image, performs filtering and binarization processing, so as to make the image clearer and improve the accuracy of recognizing the two-dimensional code.

[0048] Figure 3 A schematic diagram of a two-dimensional code frame structure suitable for an embodiment of the present invention is shown, and is described in detail as follows:

[0049] In an embodiment of the present invention, obtaining a regional image containing the two-dimensional code includes: scanning the two-dimensional code image into a connected domain; and obtaining two positioning frames of the two-dimensional code.

[0050] As an embodiment of the present invention, white pixels are used as the background, and connected domain processing is performed on black pixels. The so-called connected domain processing means that by marking the black pixels (targets) in the binary image, each individual connected area forms a marked block. Further, we can obtain geometric parameters such as the outline, circumscribed rectangle, centroid, and invariant moment of these blocks. Filter all connected domains, whose connected domains are composed of black pixels, such as Figure 3 As shown, the auxiliary graphic is a square bracket type positioning frame. According to the illustrated two-dimensional code, the number of positioning frames screened is 2. The offset angle of the two-dimensional code is obtained according to the centroid of the two positioning frames. According to the calculated offset angle, the two-dimensional code image is converted from the image-based coordinate system to the two-dimensional code-based coordinate system. Based on the coordinate XOY of the image, the centroid coordinates of the two positioning frames obtained according to the connected domain result are (x 0, y 0) and (x 1, y 1), respectively, and the corresponding two-dimensional code positioning frame coordinates are (max_x 0, min_x 0, max_y 0, min_y 0) and (max_x 1, min_x 1, max_y 0, min_y 1). Then the coordinates of the center of the QR code area are: the offset angle is the positioning frame coordinates of the QR code area are (max_x, min_x, max_y, min_y); where max_x is the maximum value of max_x 0 and max_x 1, min_x is the minimum value of min_x 0 and min_x 1, max_y is the maximum value of max_y 0 and max_y1, and min_y is the minimum value of min_y 0 and min_y 1.

[0051] The embodiment of the present invention can not only identify whether there is a QR code in the image by scanning the connected domain of the QR code, but also filter out the positioning frame of the QR code to obtain the regional image containing the QR code for recognition, thereby further improving the recognition accuracy of the QR code.

[0052] In an embodiment of the present invention, adjusting the offset angle of the regional image to obtain an area containing only the QR code includes: obtaining the regional coordinates and the offset angle of the QR code in the QR code image; rotating the area of ​​the QR code according to the offset angle; performing connected domain processing on the rotated QR code area, and filtering the QR code positioning border according to the connected domain result, thereby obtaining an area containing only the QR code.

[0053] As an embodiment of the present invention, the two-dimensional code area (max_x, min_x, max_y, min_y) is rotated with an offset angle of angle, so as to obtain a two-dimensional code image with no deviation angle from the coordinate XOY of the image.

[0054] The embodiment of the present invention ensures the squareness of the angle of the two-dimensional code by adjusting the angle of the two-dimensional code, thereby further improving the recognition accuracy of the two-dimensional code.

[0055] In an embodiment of the present invention, the area containing only the QR code is projected into a coordinate system for identification to obtain information of the QR code, including: projecting the adjusted QR code into a new coordinate system; obtaining the grayscale values ​​of the black and white squares in the QR code to obtain the information matrix of the QR code; and obtaining decoding information.

[0056] As an embodiment of the present invention, the two-dimensional code area is projected along the X-axis and Y-axis in the new coordinate system to obtain the directionality of the two-dimensional code and the length and coordinates of the real boundary of the two-dimensional code. The coordinates of the center of gravity of all black and white squares in the two-dimensional code are obtained; the decoding information is obtained by substituting the two-dimensional code information matrix into the two-dimensional code decoding module and analyzing the two-dimensional code information matrix according to the two-dimensional code encoding rules. The two-dimensional code encoding rules, among which, Figure 3 As shown, the structure of the two-dimensional code consists of an edge-finding area and a data area. The edge-finding area includes an L-shaped solid border and an L-shaped virtual border opposite to the solid border.

[0057] The embodiment of the present invention accurately identifies the QR code by orthographically projecting the QR code into a new coordinate system and decoding the QR code according to the coordinate values ​​of the QR code to obtain the information carried by the QR code.

[0058] In an embodiment of the present invention, a region containing only a two-dimensional code is projected into a coordinate system for identification to obtain information of the two-dimensional code, and further includes: performing RS error correction on the decoded information to extract final two-dimensional code information.

[0059] As an embodiment of the present invention, data errors occur during network transmission and storage due to channel noise conditions, hardware equipment and other problems. The data may be damaged in the QR code or the codewords may be blocked by pictures. The general process of the error correction code is to group the data codes and generate error correction codewords according to the error correction level and the block codewords.

[0060] The embodiment of the present invention corrects the recognized two-dimensional code information through RS error correction, thereby further ensuring the accuracy of two-dimensional code recognition.

[0061] The embodiment of the present invention uses two positioning frames to determine whether the image contains a QR code by judging whether there are two positioning frames, and obtains the offset angle of the QR code according to the centroid of the two positioning frames. According to the calculated offset angle, the QR code image is converted from an image-based coordinate system to a QR code-based coordinate system, thereby realizing real-time and high-speed recognition of QR codes, and can be applied to high-speed mobile devices.

[0062] like Figure 4 As shown, in one embodiment, a two-dimensional code recognition device is provided, which can be integrated into the above-mentioned computer device 110, and specifically may include:

[0063] The image acquisition unit 410 is used to acquire a two-dimensional code image to be identified.

[0064] In the embodiment of the present invention, the two-dimensional code image to be identified refers to an image containing a two-dimensional code. After the computer device 120 obtains the image, the image is pre-processed to reduce the influence of interference noise.

[0065] As an embodiment of the present invention, the method for obtaining the to-be-recognized QR code may be by receiving the to-be-recognized QR code image obtained by a camera, or by reading the to-be-recognized QR code image stored in a storage medium. After the computer device obtains the to-be-recognized QR code image, the image is preprocessed to reduce the influence of interference noise. Specifically, the preprocessing process of the to-be-recognized QR code image includes filtering the image and then binarizing it.

[0066] The embodiment of the present invention can effectively reduce the influence of interference noise and increase the accuracy of two-dimensional code recognition by acquiring a two-dimensional code image to be recognized and preprocessing the image.

[0067] The image processing unit 420 is used to process the two-dimensional code image to be identified to obtain two-dimensional code information.

[0068] In an embodiment of the present invention, a region image containing a QR code is obtained in the above-mentioned QR code image to be identified, wherein the region image containing the QR code refers to identifying the QR code in the image by identifying the positioning frame of the QR code, and cutting out the region image of the QR code in the image according to the frame, wherein the positioning frame of the QR code is the frame of the QR code itself. Specifically, a connected domain scan is performed on the image, the positioning frame of the QR code is obtained according to the scanning result, and the region image of the QR code is obtained.

[0069] As an embodiment of the present invention, the preprocessed QR code image contains not only the QR code but also areas that are not QR codes. The image is first scanned for a connected domain, and then the positioning border of the QR code is determined based on the scanning result. The area where the QR code is located is determined based on the positioning border of the QR code. Then, the area where the QR code is located is cut out, and other areas are discarded, leaving the area image containing the QR code.

[0070] The embodiment of the present invention obtains the regional image containing the QR code by identifying the positioning frame of the QR code, thereby reducing the content of image recognition and increasing the accuracy of recognition.

[0071] In the embodiment of the present invention, after obtaining the area image containing the two-dimensional code, it is necessary to adjust the offset angle of the area image to obtain an area containing only the two-dimensional code. The area containing only the two-dimensional code refers to the black square area containing only the two-dimensional code in the final image, and a two-dimensional code image is obtained.

[0072] As an embodiment of the present invention, after obtaining the regional image containing the QR code, in the regional image, the QR code may be at an inclined angle relative to this image, and the angle of the QR code needs to be adjusted according to the positioning border of the QR code. The positioning border is adjusted so that the angle of the QR code is corrected.

[0073] The embodiment of the present invention adjusts the angle offset of the two-dimensional code according to the recognition frame of the two-dimensional code, thereby ensuring that the two-dimensional code is easy to recognize and increasing the accuracy of two-dimensional code recognition.

[0074] In an embodiment of the present invention, after obtaining the area containing only the QR code, the QR code is projected into a new coordinate system, and the QR code is identified to identify the information of the QR code. The QR code should be orthographically projected into the coordinate system before being identified.

[0075] As an embodiment of the present invention, after the QR code is projected into the coordinate system, the black squares of the QR code remain black, and other areas in the coordinate system are white, so as to highlight the specific shape of the QR code, and the QR code is identified according to the coordinates and grayscale values ​​of the QR code to extract the information in the QR code.

[0076] The embodiment of the present invention projects the QR code into a coordinate system, identifies the QR code according to the coordinate value and grayscale value of the QR code, and then extracts the information of the QR code with high accuracy.

[0077] The information output unit 430 is used to output the two-dimensional code information.

[0078] In the embodiment of the present invention, the information output unit 430 may be a structure for outputting information to the outside world, such as a display or an image, and is used to output the recognized two-dimensional code information.

[0079] The embodiment of the present invention uses two positioning frames to determine whether the image contains a QR code by judging whether there are two positioning frames, and obtains the offset angle of the QR code according to the centroid of the two positioning frames. According to the calculated offset angle, the QR code image is converted from an image-based coordinate system to a QR code-based coordinate system, thereby realizing real-time and high-speed recognition of QR codes, and can be applied to high-speed mobile devices.

[0080] Figure 5 The internal structure diagram of a computer device in one embodiment is shown. The computer device may specifically be Figure 1 The computer device 110 in FIG. Figure 5 As shown, the computer device includes a processor, a memory, a network interface, an input device and a display screen connected through a system bus. Among them, the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program. When the computer program is executed by the processor, the processor can implement a two-dimensional code recognition method. The internal memory may also store a computer program. When the computer program is executed by the processor, the processor can execute a two-dimensional code recognition method. The display screen of the computer device may be a liquid crystal display or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a button, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.

[0081] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0082] In one embodiment, the two-dimensional code recognition device provided by the present application can be implemented in the form of a computer program. The computer program can be Figure 5The computer device is shown in FIG. 1 and FIG. 2 is a block diagram of a computer device for performing a two-dimensional code recognition operation. The computer device memory can store various program modules constituting the two-dimensional code recognition device.

[0083] In one embodiment, a computer device is provided, the computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:

[0084] Acquire an image containing a two-dimensional code to be identified, and pre-process the image;

[0085] Acquire a region image containing the QR code;

[0086] Adjusting the offset angle of the regional image to obtain a region containing only the QR code;

[0087] The area containing only the two-dimensional code is projected into a coordinate system for identification to obtain the information of the two-dimensional code.

[0088] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the processor performs the following steps:

[0089] Acquire an image containing a two-dimensional code to be identified, and pre-process the image;

[0090] Acquire a region image containing the QR code;

[0091] Adjusting the offset angle of the regional image to obtain a region containing only the QR code;

[0092] The area containing only the two-dimensional code is projected into a coordinate system for identification to obtain the information of the two-dimensional code.

[0093] It should be understood that, although each step in the flow chart of each embodiment of the present invention is shown in sequence according to the indication of the arrow, these steps are not necessarily performed in sequence according to the order indicated by the arrow. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be performed in other orders. Moreover, at least a portion of the steps in each embodiment may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with at least a portion of other steps or sub-steps or stages of other steps.

[0094] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0095] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0096] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

Claims

1. A two-dimensional code recognition method, characterized in that: The method comprises: Acquire an image containing a two-dimensional code to be identified, and pre-process the image; Acquire a region image containing the QR code; Adjusting the offset angle of the regional image to obtain a region containing only the QR code; Projecting the area containing only the two-dimensional code into a coordinate system for identification to obtain information of the two-dimensional code; The obtaining of the regional image containing the two-dimensional code comprises: Scanning the two-dimensional code image into a connected domain; Obtain two positioning frames of the QR code; By identifying the positioning frame of the QR code, the QR code in the image is identified, and the regional image of the QR code in the image is cut out according to the frame, wherein the positioning frame of the QR code is a frame that comes with the QR code. Specifically, the image is scanned for a connected domain, and the positioning frame of the QR code is obtained according to the scanning result, and the regional image of the QR code is obtained; First, the image is scanned for connected areas, and then the positioning frame of the QR code is determined according to the scanning result, and the area where the QR code is located is determined according to the positioning frame of the QR code, and then the area where the QR code is located is cut out, and other areas are discarded, leaving the area image containing the QR code; Adjusting the offset angle of the regional image to obtain a region containing only the two-dimensional code includes: Obtaining the area coordinates and offset angle of the two-dimensional code in the two-dimensional code image; Rotating the area of ​​the two-dimensional code according to the offset angle; The rotated two-dimensional code region is processed by a connected domain, and the two-dimensional code positioning frame is filtered according to the connected domain result, so as to obtain a region containing only the two-dimensional code.

2. The method according to claim 1, characterized in that The preprocessing of the two-dimensional code image comprises: Performing filtering processing on the two-dimensional code image; The two-dimensional code image is binarized.

3. The method according to claim 2, characterized in that The filtering process of the two-dimensional code image includes but is not limited to: Using a median filter method to filter the two-dimensional code image; or The two-dimensional code image is filtered using a Gaussian filtering method.

4. The method according to claim 1, characterized in that: The step of projecting the area containing only the two-dimensional code into a coordinate system for identification to obtain information of the two-dimensional code includes: Projecting the adjusted QR code into a new coordinate system; Obtaining the grayscale values ​​of the black and white squares in the two-dimensional code to obtain the information matrix of the two-dimensional code; Get the decoded information.

5. The method according to claim 4, characterized in that The projecting the area containing only the two-dimensional code into a coordinate system for identification to obtain the information of the two-dimensional code also includes: Perform RS error correction on the decoded information to extract the final two-dimensional code information.

6. A two-dimensional code recognition device, characterized in that: The device comprises: An image acquisition unit, the image acquisition unit is used to acquire a two-dimensional code image to be identified; An image processing unit, the image processing unit is used to process the two-dimensional code image to be identified to obtain two-dimensional code information; An information output unit, the information output unit is used to output the two-dimensional code information; The obtaining of the regional image containing the two-dimensional code comprises: Scanning the two-dimensional code image into a connected domain; Obtain two positioning frames of the QR code; By identifying the positioning frame of the QR code, the QR code in the image is identified, and the regional image of the QR code in the image is cut out according to the frame, wherein the positioning frame of the QR code is a frame that comes with the QR code. Specifically, the image is scanned for a connected domain, and the positioning frame of the QR code is obtained according to the scanning result, and the regional image of the QR code is obtained; First, the image is scanned for connected areas, and then the positioning frame of the QR code is determined according to the scanning result, and the area where the QR code is located is determined according to the positioning frame of the QR code, and then the area where the QR code is located is cut out, and other areas are discarded, leaving the area image containing the QR code; The image processing unit includes adjusting the offset angle of the regional image to obtain a region containing only the two-dimensional code, specifically: Obtaining the area coordinates and offset angle of the two-dimensional code in the two-dimensional code image; Rotating the area of ​​the two-dimensional code according to the offset angle; The rotated two-dimensional code region is processed by a connected domain, and the two-dimensional code positioning frame is filtered according to the connected domain result, so as to obtain a region containing only the two-dimensional code.

7. A computer device, characterized in that: It comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of a two-dimensional code recognition method as claimed in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of a two-dimensional code recognition method as described in any one of claims 1 to 5.