CN113947097A - Two-dimensional code identification method and electronic equipment - Google Patents

Two-dimensional code identification method and electronic equipment Download PDF

Info

Publication number
CN113947097A
CN113947097A CN202010830616.7A CN202010830616A CN113947097A CN 113947097 A CN113947097 A CN 113947097A CN 202010830616 A CN202010830616 A CN 202010830616A CN 113947097 A CN113947097 A CN 113947097A
Authority
CN
China
Prior art keywords
dimensional code
line
electronic device
line segment
electronic equipment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010830616.7A
Other languages
Chinese (zh)
Other versions
CN113947097B (en
Inventor
钟伟才
池育浩
王昱璇
田新
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Device Co Ltd
Petal Cloud Technology Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Publication of CN113947097A publication Critical patent/CN113947097A/en
Application granted granted Critical
Publication of CN113947097B publication Critical patent/CN113947097B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1439Methods for optical code recognition including a method step for retrieval of the optical code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/146Methods for optical code recognition the method including quality enhancement steps
    • G06K7/1473Methods for optical code recognition the method including quality enhancement steps error correction

Landscapes

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

Abstract

The application discloses a two-dimensional code identification method and electronic equipment, wherein the method comprises the following steps: the electronic device acquires an image containing a two-dimensional code in which edge line segments of black pixel blocks and white pixel blocks are curved. The electronic equipment constructs a horizontal broken line and a vertical broken line for the two-dimensional code image, and the horizontal broken line and the vertical broken line construct the two-dimensional code image into a grid image. The electronic device divides the two-dimensional code into a plurality of grids by the grid map and acquires the topological relation between each grid (i.e., the positional relation of one grid to the other grids, for example, the adjacency). The electronic equipment reconstructs the lattices into the two-dimensional code with straightness according to the acquired topological relation of the lattices. And finally, the electronic equipment decodes the reconstructed two-dimensional code. In this way, the electronic device can accurately decode a deformed, bent, or wrinkled two-dimensional code.

Description

Two-dimensional code identification method and electronic equipment
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a two-dimensional code recognition method and an electronic device.
Background
With the development of the internet of things, the two-dimensional code is increasingly applied to life. The user can utilize the electronic equipment to scan the two-dimensional code to realize payment, information acquisition, account login and the like. Generally, a two-dimensional code image is printed or pasted on the surface of an object (such as a sharing bicycle, an article package, an electronic device and the like) with any shape. When the surface of an object to which the two-dimensional code image is attached is uneven, curved, or wrinkled, the two-dimensional code image may be distorted, such as deformed, curved, or wrinkled.
When the two-dimensional code only has frame deformation, or the deformation of the edge line segments of the black pixel block and the white pixel block in the two-dimensional code is consistent with the frame deformation direction, the two-dimensional code identification method based on the perspective principle provided by the prior art can identify the two-dimensional code. For example, fig. 1A shows a two-dimensional code whose frame a1A2a3a4 is deformed but still has straightness. In the prior art, after the deformed frame a1a2a3a4 of the two-dimensional code is corrected to b1b2b3b4, the two-dimensional code can be identified and decoded.
However, when the two-dimensional code image is wrinkled, bent, deformed and the like, and the two-dimensional code does not have straightness, the two-dimensional code cannot be correctly decoded by the prior art.
Therefore, how to accurately and effectively decode the two-dimensional code without straightness by the electronic equipment is a problem which needs to be solved urgently.
Disclosure of Invention
The application provides a two-dimension code identification method and electronic equipment, which can be used for accurately decoding a two-dimension code without straightness.
In a first aspect, the present application provides a method for identifying a two-dimensional code, including: the method comprises the steps that the electronic equipment obtains an image to be recognized, wherein the image to be recognized comprises an uneven first two-dimensional code image; the first two-dimensional code is formed by n × m lattices; the electronic equipment detects edge line segments in the first two-dimensional code image; the edge line segments comprise a first edge line segment in a first direction and a second edge line segment in a second direction, and the first direction is vertical to the second direction; the electronic equipment constructs (n +1) first direction broken lines according to the first edge line segments, and constructs (m +1) second direction broken lines according to the second edge line segments; the electronic equipment determines the position information and the coding information of n × m lattices forming the first two-dimensional code image according to the (n +1) first direction folding lines and the (m +1) second direction folding lines; the electronic equipment constructs a two-dimensional code image according to the position information of the n-by-m grids and the coding information, wherein the two-dimensional code image is a two-dimensional code image with straightness; the electronic equipment decodes the two-dimensional code image and displays the decoding result.
In one possible implementation, the first direction may be a horizontal direction and the second direction may be a vertical direction. n may be equal to m.
In one possible implementation, the first two-dimensional code image is a deformed, bent, or wrinkled two-dimensional code image.
According to the two-dimensional code identification method provided by the embodiment of the application, when a user scans a deformed, bent or folded two-dimensional code image by using an electronic equipment area, the electronic equipment acquires the position information and the coding information of each grid in the two-dimensional code by constructing a broken line. The electronic device can then reconstruct a two-dimensional code with straightness based on the position information of each grid in the two-dimensional code, the coded information, and the topological relationship between the grids (e.g., two grids are adjacent or not adjacent). And finally, the electronic equipment decodes the reconstructed two-dimensional code and displays a decoding result. Therefore, when the user scans the deformed, bent or folded two-dimensional code image by using the electronic equipment area, the decoding result can still be displayed by the electronic equipment, and the user experience is improved.
With reference to the first aspect, in a possible implementation manner, the electronic device constructs (n +1) first direction folding lines according to the first edge line segment, and constructs (m +1) second direction folding lines according to the second edge line segment, specifically including: the electronic equipment takes a first edge line segment with the slope smaller than a first preset threshold value as a first direction target line segment, and takes a second edge line segment with the slope smaller than a second preset threshold value as a second direction target line segment; the electronic equipment constructs (n +1) first direction broken lines according to the first direction target line segments, and constructs (m +1) second direction broken lines according to the second direction target line segments. In general, an edge line segment in a two-dimensional code is a straight line, i.e., has a slope of 0. When the two-dimensional code has certain degree of inclination or deformation, bending, fold, the marginal line segment in the two-dimensional code has certain degree of inclination. When the slope of an edge line segment is too large, the edge line segment may not be a true edge line segment in the two-dimensional code. Errors may occur due to the electronic device performing edge segment detection. In this way, erroneous edge line segments can be reduced, enabling the electronic device to recognize the two-dimensional code more readily.
In one possible implementation, the first preset threshold may be equal to the second preset threshold.
With reference to the first aspect, in a possible implementation manner, the electronic device constructs (n +1) first-direction folding lines according to a first-direction target line segment, and constructs (m +1) second-direction folding lines according to a second-direction target line segment, which specifically includes: the electronic equipment divides the first two-dimensional code image into R first intervals and L second intervals; r, L is a positive integer; r is less than n, L is less than m; the electronic equipment constructs one or more first direction broken lines according to the first direction target line segments in each first interval, wherein the sum of the number of the first direction broken lines in the R first intervals is (n + 1); and constructing one or more second direction broken lines according to the second direction target line segments in each second interval, wherein the sum of the number of the second direction broken lines in the L second intervals is (m + 1). The two-dimensional code image is divided into smaller areas, and the deformation, bending and wrinkling degrees or directions of target line segments in one area are consistent. In this way, the two-dimensional code can be reconstructed more accurately.
In one possible implementation, R may be equal to L.
With reference to the first aspect, in a possible implementation manner, the constructing, by the electronic device, one or more first-direction polylines according to the first-direction target line segments in each first interval specifically includes: the electronic equipment constructs a first direction broken line for two or more first direction target line segments with first projection distances smaller than a first preset distance in a first interval; the first projection distance is the projection of a connecting line of central points of two adjacent first-direction target line segments in a first interval on a first vector, the first vector is a normal vector of a first unit vector, and the first unit vector is determined according to the line length and the inclination angle of the first-direction target line segments in the first interval.
With reference to the first aspect, in a possible implementation manner, the constructing, by the electronic device, one or more second direction polylines according to the second direction target line segments in each second interval specifically includes: the electronic equipment constructs a second direction broken line by two or more second direction target line segments with second projection distances smaller than a second preset distance in the first and second intervals; the second projection distance is the projection of a connecting line of the central points of two adjacent second-direction target line segments in a second interval on a second vector, the second vector is a normal vector of a second unit vector, and the second unit vector is determined according to the line length and the inclination angle of the second-direction target line segments in the second interval.
With reference to the first aspect, in a possible implementation manner, after the electronic device constructs (n +1) first-direction folding lines according to the first edge line segment and (m +1) second-direction folding lines according to the second edge line segment, the method further includes: the electronic equipment determines a first error broken line and a second error broken line which do not meet preset conditions in the first direction broken line and the second direction broken line; the electronic equipment constructs a first direction broken line for the second target line segment according to the first average inclination angle of the first target line segment, and constructs a second direction broken line for the fourth target line segment according to the second average inclination angle of the third target line segment.
The first target line segment is a first direction target line segment for constructing a first broken line, the first broken line is a first direction broken line adjacent to a first error broken line, and the second target line segment comprises a plurality of first edge line segments in a first interval where the first error broken line is located.
The third target line segment is a second direction target line segment for constructing a second broken line, the second broken line is a second direction broken line adjacent to a second error broken line, and the fourth target line segment is a plurality of second edge line segments in a second interval including the second error broken line.
In this way, the electronic device can correct the wrong polyline and reconstruct the edge line segment of the area where the wrong polyline is located into the correct polyline.
In one possible implementation, the preset conditions include: the distance between the adjacent first direction folding lines is in a first distance interval, and the distance between the adjacent second direction folding lines is in a second distance interval.
In one possible implementation, the first distance interval is determined by a median of distances of all adjacent first direction polylines; the second distance interval is determined by the median of the distances of all adjacent second direction polylines.
With reference to the first aspect, in a possible implementation manner, the constructing, by the electronic device, the first direction broken line by using the second target line segment according to the first average inclination angle of the first target line segment specifically includes: the electronic equipment performs coordinate transformation on the first coordinate of the central point on the second target line segment according to the first average inclination angle to obtain a second coordinate; and the electronic equipment constructs two or more second target line segments of which the vertical coordinate difference values of the second coordinates belong to the first distance interval into a first direction broken line.
With reference to the first aspect, in a possible implementation manner, the constructing, by the electronic device, a fourth target line segment into the second direction broken line according to a second average inclination angle of the third target line segment specifically includes: the electronic equipment performs coordinate transformation on the third coordinate of the central point on the fourth target line segment according to the second average angle to obtain a fourth coordinate; and the electronic equipment constructs two or more fourth target line segments of which the vertical coordinate difference values of the fourth coordinates belong to the second distance interval into a second direction broken line.
With reference to the first aspect, in one possible implementation manner, the n × m lattices include a first lattice; the position information and the code information of the first lattice are determined as follows: the electronic equipment determines position information of the first grid according to intersection points of the first fold line and the second fold line with the third fold line and the fourth fold line respectively; the first direction folding line comprises a first folding line and a second folding line, and the first folding line is adjacent to the second folding line; the second direction fold lines comprise a third fold line and a fourth fold line; the third fold line and the fourth fold line are adjacent; the electronic device determines encoding information of the first grid according to the proportion of the pixels in the first grid; the pixels in the first lattice are pixels in a range determined in the first two-dimensional code image according to the position information of the first lattice.
With reference to the first aspect, in a possible implementation manner, the electronic device determines the position information of the first lattice according to intersection points of the first folding line and the second folding line and intersection points of the third folding line and the fourth folding line, and specifically includes: the electronic equipment determines the coordinates of a first intersection point of the first folding line and the third folding line; the electronic equipment determines the coordinates of a second intersection point of the first fold line and the fourth fold line; the electronic equipment determines coordinates of a third intersection point of the second fold line and the third fold line; the electronic equipment determines coordinates of a fourth intersection point of the second fold line and the fourth fold line; wherein the first intersection point, the second intersection point, the third intersection point and the fourth intersection point are four vertexes of the first lattice.
With reference to the first aspect, in a possible implementation manner, the determining, by the electronic device, coordinates of a first intersection point of the first folding line and the third folding line specifically includes: the electronic equipment converts the first folding line into a first rectangle, and converts the third folding line into a second rectangle; the electronic device determines an intersecting rectangle of the first rectangle and the second rectangle; the electronic device determines one or more first coordinate points on the first fold line and the third fold line within the intersecting rectangle; the electronic device determines coordinates of a first intersection point of the first fold line and the third fold line according to the one or more first coordinate points.
With reference to the first aspect, in a possible implementation manner, the determining, by the electronic device, encoding information of the first lattice according to a proportion of pixels at the first lattice in the first two-dimensional code image specifically includes: if the proportion of the pixels in the first grid is larger than or equal to a preset proportion, the electronic equipment determines that the coding information of the first grid is a first preset number; if the proportion of the pixels in the first grid is smaller than the preset proportion, the electronic equipment determines that the coding information of the first grid is a second preset number.
In one possible implementation, the preset ratio is 50%.
In one possible implementation, the pixels are black pixels.
In a second aspect, the present application provides an electronic device comprising one or more processors and one or more memories. The one or more memories are coupled to the one or more processors and the one or more memories are configured to store computer program code comprising computer instructions that, when executed by the one or more processors, cause the electronic device to perform the method for two-dimensional code recognition in any of the possible implementations of the first aspect described above.
In a third aspect, an embodiment of the present application provides a computer storage medium, which includes computer instructions, and when the computer instructions are run on an electronic device, the communication apparatus is caused to perform the method for two-dimensional code identification in any possible implementation manner of the first aspect.
In a fourth aspect, an embodiment of the present application provides a computer program product, which when run on a computer, causes the computer to execute the method for two-dimensional code identification in any one of the possible implementations of the first aspect.
Drawings
Fig. 1A is a schematic view of a two-dimensional code recognition based on a perspective principle according to an embodiment of the present application;
fig. 1B is a schematic view of a two-dimensional code provided in an embodiment of the present application;
fig. 2 is a schematic view of a two-dimensional code provided in an embodiment of the present application;
fig. 3 is a schematic flow chart of a two-dimensional code recognition method provided in the prior art;
fig. 4 is a schematic flowchart of a two-dimensional code identification method according to an embodiment of the present disclosure;
fig. 5 is a schematic view of a user interface for scanning a two-dimensional code according to an embodiment of the present application;
fig. 6 is a schematic diagram of a two-dimensional code image provided in an embodiment of the present application;
fig. 7 is a schematic diagram of a horizontal target line segment in a two-dimensional code according to an embodiment of the present application;
fig. 8 is a schematic view of a vertical target line segment in a two-dimensional code according to an embodiment of the present application;
FIG. 9A is a schematic diagram of a horizontal section according to an embodiment of the present application;
FIG. 9B is a schematic view of a vertical interval provided in the present application;
fig. 9C is a schematic diagram of a target line segment according to an embodiment of the present application;
fig. 9D is a schematic diagram illustrating a calculation of a projection distance between two target line segments according to an embodiment of the present application;
fig. 10 is a schematic view of a horizontal broken line in a two-dimensional code according to an embodiment of the present application;
fig. 11 is a schematic diagram of a vertical broken line in a two-dimensional code according to an embodiment of the present application;
fig. 12 is a schematic view of a horizontal direction error broken line in a two-dimensional code according to an embodiment of the present application;
fig. 13 is a schematic diagram of a vertical error broken line in a two-dimensional code according to an embodiment of the present disclosure;
fig. 14 is a schematic diagram of a projection histogram provided in an embodiment of the present application;
FIG. 15 is a schematic diagram of a corrected horizontal broken line provided in the embodiment of the present application;
FIG. 16 is a schematic diagram of a corrected vertical broken line provided in the embodiment of the present application;
fig. 17 is a two-dimensional code grid diagram provided in an embodiment of the present application;
fig. 18 is a schematic diagram of an intersection point of a horizontal broken line and a vertical broken line in a two-dimensional code provided in an embodiment of the present application;
FIG. 19 is a schematic diagram of solving intersection points by using a horizontal broken line and a vertical broken line provided in the embodiment of the present application;
fig. 20 is a schematic diagram of a lattice in a two-dimensional code according to an embodiment of the present application;
fig. 21 is a schematic diagram of a reconstructed two-dimensional code according to an embodiment of the present application;
FIG. 22 is a schematic view of a user interface provided by an embodiment of the present application;
fig. 23 is a schematic flowchart of reconstructing a curved two-dimensional code by an electronic device according to an embodiment of the present application;
fig. 24 is a schematic flowchart of reconstructing a wrinkled two-dimensional code by an electronic device according to an embodiment of the present disclosure;
fig. 25 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solution in the embodiments of the present application will be described in detail and removed with reference to the accompanying drawings. In the description of the embodiments herein, "/" means "or" unless otherwise specified, for example, a/B may mean a or B; "and/or" in the text is only an association relationship describing an associated object, and means that three relationships may exist, for example, a and/or B may mean: three cases of a alone, a and B both, and B alone exist, and in addition, "a plurality" means two or more than two in the description of the embodiments of the present application.
In the following, the terms "first", "second" are used for descriptive purposes only and are not to be understood as implying or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of embodiments of the application, unless stated otherwise, "plurality" means two or more.
First, the concept related to the embodiments of the present application, such as flatness, will be explained.
(1) Straightness of
In the embodiment of the present application, the straightness refers to that the edge line segment of the two-dimensional code and the edge line segment of the black pixel block and the white pixel block in the two-dimensional code are still straight lines after being scanned by the electronic device. And the relative positions of a plurality of edge line segments of the black pixel block and the white pixel block in the two-dimensional code are kept unchanged.
(2) Edge line segment
In the embodiment of the application, the edge line segment of the two-dimensional code and the edge line segment of the black pixel block and the white pixel block in the two-dimensional code are both called edge line segments. As shown in fig. 1B, the line segment 10a and the line segment 10c are both edge line segments of the two-dimensional code. The line segment 10b is an edge line segment of the black pixel block and the white pixel block.
(3) Location information
In the embodiment of the present application, the position information of each lattice in the two-dimensional code image refers to the position of four vertices of each lattice in the two-dimensional code image. It is understood that the two-dimensional code image is composed of n × m lattices. In the embodiments of the present application, n and m may be equal. In the embodiment of the present application, one pixel block is one of n × m lattices in the two-dimensional code image. A pixel block may comprise a black pixel block or a white pixel block.
The common code system of the two-dimensional code is as follows: quick Response (QR) codes, Data Matrices (DM), AZTEC, and the like. Each code system has its specific character set; each character occupies a certain width; has certain checking function and the like. Meanwhile, the method has the characteristics of automatic recognition function of information of different lines, processing of graph rotation change and the like. The two-dimensional code can be divided into various types of two-dimensional codes according to different code systems, such as a QR code, a DM code, an AZTEC code, and the like. The QR code is taken as an example to describe the identification process of the two-dimensional code.
1. QR code composition
Fig. 2 schematically shows the structure of a QR code. As shown in fig. 2, the QR code is constituted by symbols such as a position detection image 201, a position detection image 202, a position detection image 203, format information 204, format information 205, format information 206, version information 207, version information 208, positioning patterns 209, positioning patterns 210, correction patterns 211, correction patterns 212, correction patterns 213, correction patterns 214, correction patterns 215, correction patterns 216, position detection pattern separators 217, and some data (not shown) and error correction code words (not shown).
The position detection image 201, the position detection image 202 and the position detection image 203 are used to determine a rectangular area where the two-dimensional code is located.
The positioning pattern 209 and the positioning pattern 210 are used to determine two-dimensional code coordinates.
The position detection pattern separator 217 is used to separate the position detection image 201, the position detection image 202, and the position detection image 203 from other symbols.
The correction patterns 211, 212, 213, 214, 215, and 216 are used to align the two-dimensional code patterns and correct the two-dimensional code.
The format information 204, the format information 205, and the format information 206 are used to store format information of a two-dimensional code, for example, an encoding format of the two-dimensional code.
The version information 207 and the version information 208 contain version information and error correction related information. The difference between the two-dimensional codes of different versions is mainly the difference between the modules for storing data (each black/white block is a module).
2. QR code identification process
(1) Image pre-processing
After the electronic equipment acquires the first image containing the two-dimensional code, the first image is preprocessed. The preprocessing may include one or more of a graying process, a denoising process, a binarization process, an expansion process, and an erosion process.
The specific processes of the graying processing and the denoising processing can refer to the prior art, and are not described herein again.
The binarization processing is a processing manner in which a gradation value of each pixel block in an image is set to a first numerical value or a second numerical value (the first numerical value and the second numerical value may differ greatly for easy discrimination). After the image is subjected to binarization processing, the image only comprises two pixel blocks with larger gray value difference. For example, when the electronic device performs the binarization process, the electronic device may determine whether a grayscale value of each pixel block in the binarized image is greater than a preset threshold. When the electronic device determines that the gray value of a certain pixel block is greater than or equal to the preset threshold, the electronic device may set the pixel block to white (the gray value of white is 255 in 256 levels of gray). When the electronic device determines that the gray value of a certain pixel block is less than the preset threshold, the electronic device may set the pixel block to black (the gray value of black is 0 in 256 levels of gray). Until the electronic device has finished processing each block of pixels in the image. The binarized image may be referred to as a binarized image.
The specific operation of the dilation process is to scan each element in the binarized image with a structuring element (typically 3 × 3 in size), convolve each pixel with the structuring element with the pixel it covers, and if both are 0, the pixel is 0, otherwise 1. In other words, when the structural element traverses to a certain position in the binary image, the surrounding of the structural element is all black, the black is kept, and otherwise, the structural element becomes white.
The specific operation of the etching process is to scan each element in the binarized image with a structural element (typically 3 × 3 in size), convolve each pixel with its overlying pixel with each pixel of the structural element being 1 if both are 1, otherwise 0. In other words, when the structural element traverses to a certain position in the binary image, the surrounding of the structural element is all white, the color is kept white, and otherwise, the structural element becomes black.
The electronic device can perform expansion processing and then corrosion processing on the binary image. This can fill small holes in the object in the image and smooth the object boundaries. The electronic device may perform the erosion process on the binary image first and then perform the expansion process. This eliminates fine noise in the image and smoothes the object boundaries.
The electronic device pre-processing the first image may improve the quality of the first image and reduce the impact of noise (e.g., illumination) in the environment.
(2) Positioning
And the electronic equipment positions the two-dimensional code in the preprocessed first image. First, the electronic apparatus locates a position detection pattern (e.g., a position detection image 201, a position detection image 202, a position detection image 203 shown in fig. 2) of the two-dimensional code. The electronic equipment can determine the area of the two-dimensional code in the first image according to the position detection graph.
(3) Decoding
The electronic device decodes the data according to the encoding format information (for example, the format information 204, the format information 205, and the format information stored in the format information shown in fig. 2) of the two-dimensional code and the error correction code, and obtains a decoding result (for example, a website, a personal business card, a commodity price, and the like).
When the two-dimensional code scanned by the electronic device cannot maintain straightness, the electronic device cannot recognize various modules (e.g., black pixel blocks, white pixel blocks) and symbols (e.g., position detection patterns, format information, correction patterns, positioning patterns, etc.) in the two-dimensional code. Thus, the electronic device cannot correctly decode the two-dimensional code.
In a possible implementation manner of the prior art, a two-dimensional code identification method based on a perspective principle provided in the prior art may include: the electronic equipment firstly preprocesses a first image, wherein the first image comprises a two-dimensional code. Then, the electronic equipment positions and rotationally corrects the two-dimensional code in the first image according to the two-dimensional code frame characteristics. The electronic equipment divides the two-dimensional code, and decodes the two-dimensional code after acquiring the two-dimensional code sampling information. The method may specifically refer to a flowchart of a two-dimensional code identification method shown in fig. 3. As shown in fig. 3, taking the DM code as an example, the electronic device may pre-process the first image, including: 1. graying, 2, filtering, 3, binarization, 4 and edge extraction. The image preprocessing methods can all refer to the prior art, and are not described herein again. The electronic device locating the first image may include: 5. the initial positioning, i.e., the electronic device positions the DM code in the first image. 6. And (4) straight line detection, namely, the electronic equipment detects a straight line in the DM code. The specific implementation of the electronic device to divide the DM code may be that the electronic device respectively projects the DM code in the horizontal direction and the vertical direction, respectively obtains a horizontal dividing line and a vertical dividing line, and then divides the DM code by using the horizontal dividing line and the vertical dividing line.
The method in the prior art is only suitable for scenes in which two-dimensional code images can keep straightness. When the two-dimensional code is deformed and bent, the border line segment or the edge line segment of the black pixel block and the white pixel block in the two-dimensional code is bent or deformed, and the straightness cannot be maintained. The electronic device cannot correctly judge whether each pixel block of the two-dimensional code is a black pixel block or a white pixel block, so that the electronic device cannot correctly recognize the two-dimensional code.
The embodiment of the application provides a two-dimension code identification method, aiming at the problem that electronic equipment cannot correctly identify two-dimension codes without straightness in the prior art. The method comprises the following steps: the method comprises the steps that the electronic equipment obtains an image to be recognized, wherein the image to be recognized comprises an uneven first two-dimensional code image; the first two-dimensional code is formed by n × m lattices; the electronic equipment detects edge line segments in the first two-dimensional code image; the edge line segments comprise a first edge line segment in a first direction and a second edge line segment in a second direction, and the first direction is vertical to the second direction; the electronic equipment constructs (n +1) first direction broken lines according to the first edge line segments, and constructs (m +1) second direction broken lines according to the second edge line segments; the electronic equipment determines the position information and the coding information of n × m lattices forming the first two-dimensional code image according to the (n +1) first direction folding lines and the (m +1) second direction folding lines; the electronic equipment constructs a two-dimensional code image according to the position information of the n-by-m grids and the coding information, wherein the two-dimensional code image is a two-dimensional code image with straightness; the electronic equipment decodes the two-dimensional code image and displays the decoding result.
The following describes a two-dimensional code identification method provided in an embodiment of the present application with reference to the accompanying drawings. Referring to fig. 4, fig. 4 is a schematic flowchart illustrating a method for identifying a two-dimensional code according to an embodiment of the present application. As shown in fig. 4, taking an AZTEC code as an example, the method for identifying a two-dimensional code provided in the embodiment of the present application may include:
s101, the electronic equipment acquires a first image containing a two-dimensional code image.
The electronic device may acquire a first image containing a two-dimensional code. The electronic device may acquire the first image through the camera, or may acquire the first image in a gallery of the electronic device. The first image includes a two-dimensional code image.
It is to be understood that the image to be recognized in the embodiment of the present application may include the first image. The two-dimensional code image included in the first image may be referred to as a first two-dimensional code image.
In one possible implementation manner, the electronic device may receive an operation of triggering the two-dimensional code recognition by a user, and in response to the operation, the electronic device acquires a first image containing the two-dimensional code. The operation of triggering the two-dimensional code recognition by the user can be various, for example, the operation of triggering the two-dimensional code recognition by the user can be that the user clicks a two-dimensional code recognition key in the electronic device. The two-dimensional code recognition key may include a scan key in various applications. The operation of the user triggering the two-dimensional code recognition may be that the user inputs a voice command for recognizing the two-dimensional code to the electronic device. And is not limited herein. In response to the user operation, the electronic device may enter a two-dimensional code recognition interface 200 as shown in fig. 5. The electronic equipment can continuously acquire the first image through the camera and can display the first image in the two-dimensional code recognition interface.
Fig. 5 is a schematic diagram of the electronic device 100 acquiring an image on the two-dimensional code scanning interface 200. As shown in fig. 5, the two-dimensional code scanning interface 200 shown in fig. 5 may include a control 201, a scan box 202, a gallery icon 203, a flashlight icon 204. The control 201 is configured to return to a previous interface of the two-dimensional code/barcode interface. The scan frame 202 is used to display an image scanned by the camera, such as the image 205 shown in fig. 10. The image 205 may be the first image in the embodiment of the present application. The gallery icon 203 is used by the user to select an image in a gallery of the electronic device 100. The user may click on the gallery icon 203, and in response to this operation, the electronic device 100 may display the images saved in the gallery. The user may select images stored in the gallery for scanning. Flashlight icon 204 the user turns on the flashlight of electronic device 100. When the environment in which the electronic device acquires the image is dark and the camera cannot clearly acquire the image, the user can click the flashlight icon 204 to turn on the flashlight.
Generally, a two-dimensional code is composed of n × m lattices (each lattice may be a circle, a square, or the like). n may be equal to m, and specific values of n and m are not limited herein. The embodiments of the present application are described by taking n and m as examples. For example, the AZTEC code in image 205 shown in fig. 5 in the embodiment of the present application is composed of a lattice of 27 × 27 squares. That is, the electronic device has 27 rows of grids, and 27 grids are stacked in each row. When the two-dimensional code keeps straightness, every row of grids in the horizontal direction of the two-dimensional code should be on a straight line, and every row of grids in the vertical direction should be on a straight line. Each grid is a block of pixels. When the binary code information of the grid is 0, the color of the grid is black, and the grid having the color of black is referred to as a black pixel block in the embodiment of the present application. When the binary code information of the grid is 1, the color of the grid is white, and the grid with the color of white is referred to as a white pixel block in the embodiment of the application.
It is understood that the encoded information in the two-dimensional code is not limited to 0 or 1, and the encoded information may be a first preset number and a second preset number. When the coded information of the lattice is a first preset number, the color of the lattice is a first color (e.g., white). When the encoded information of the lattice is a second preset number, the color of the lattice is a second color (e.g., black).
In one scenario, the two-dimensional code is a curved, deformed or wrinkled two-dimensional code, i.e., edge line segments of black pixel blocks and white pixel blocks in the two-dimensional code do not have straightness. When the two-dimensional code is bent, deformed, or wrinkled, the lattices in the two-dimensional code located in the same row may not be aligned.
S102, the electronic equipment preprocesses the first image.
The electronic device may pre-process the first image including performing one or more of binarization, graying, expansion, and erosion processing on the first image. Specifically, reference may be made to the above description of the preprocessing, which is not repeated herein. The electronic equipment can extract the two-dimensional code image contained in the first image through preprocessing. For example, after the image 205 shown in fig. 5 is preprocessed, a two-dimensional code image as shown in fig. 6 can be extracted. The two-dimensional code image shown in fig. 6 may be the first two-dimensional code image in the embodiment of the present application. As shown in fig. 6, edge line segments of the black pixel block and the white pixel block in the first two-dimensional code image are curved and deformed, and the deformation directions are not consistent and do not have straightness.
In one possible implementation, the electronic device further includes a filter and a magnification unit. The method for filtering the first image by the electronic device may be multiple, for example, a bilateral filtering method, which may specifically refer to the prior art and is not described herein again. There may be various methods for the electronic device to amplify the first image, for example, a nearest neighbor interpolation algorithm, which may specifically refer to the prior art and is not described herein again. In this way, the interference of noise on the two-dimensional code image can be reduced, and the edge information (e.g., edge line segments) of the two-dimensional code can be enhanced.
In a possible implementation manner, after the electronic device preprocesses the first image, the electronic device decodes the two-dimensional code image in the first image, and if the decoding is successful, displays a decoding result. If the decoding fails, step S103-step S106 are executed.
In the embodiment of the present application, step S102 may not be executed, that is, the electronic device does not execute the operation of preprocessing the first image.
S103, the electronic equipment constructs a broken line in the two-dimensional code.
The electronic device may divide the two-dimensional code into a plurality of regions. When the two-dimensional code is distorted (such as deformation, bending, wrinkling and the like), the electronic equipment can more accurately determine the distorted area in the two-dimensional code. And the subsequent electronic equipment can correct the distorted area in the two-dimensional code conveniently.
In one possible implementation manner, the electronic device segmenting the two-dimensional code may include the following steps:
1. the electronic equipment detects edge line segments (edge line segments of black pixel blocks and white pixel blocks and edge line segments of the two-dimensional code) in the two-dimensional code, and determines a target line segment from the edge line segments of the two-dimensional code, wherein the target line segment is the edge line segment meeting preset conditions.
Fig. 7 exemplarily shows a target line segment in the horizontal direction in the two-dimensional code image. As shown in fig. 7, the black line segment in the figure is a target line segment in the horizontal direction detected by the electronic device in the two-dimensional code image. Fig. 8 exemplarily shows a target line segment in a vertical direction in a two-dimensional code image. As shown in fig. 8, the black line segment in fig. 8 is a target line segment in the two-dimensional code image detected by the electronic device in the vertical direction. The two-dimensional code shown in fig. 7 and 8 is an AZTEC code. In the embodiment of the present application, the horizontal direction may be referred to as a first direction, and the vertical direction may be referred to as a second direction. The first direction may be a horizontal direction or other directions. The second direction may be a vertical direction or other directions. The first direction is perpendicular to the second direction, and the specific directions of the first direction and the second direction are not limited in the embodiments of the present application. The horizontal edge line segment may be referred to as a first edge line segment. The vertically oriented edge line segment may be referred to as a second edge line segment. The target line segment in the horizontal direction may be referred to as a first-direction target line segment, and the target line segment in the vertical direction may be referred to as a second-direction target line segment.
In one possible implementation, the preset condition may be that the slope of the edge line segment is smaller than a preset threshold. That is, the electronic device may detect all edge line segments in the horizontal direction and the vertical direction in the two-dimensional code image through a line detection algorithm, and then take a line segment whose slope is smaller than a preset threshold as a target line segment. It is understood that the electronic device may be preconfigured with the preset threshold. In this embodiment of the present application, the preset threshold of the edge line segment in the horizontal direction may be referred to as a first preset threshold, and the preset threshold of the edge line segment in the vertical direction may be referred to as a second preset threshold. The first preset threshold may be equal to the second preset threshold. The specific values of the first preset threshold and the second preset threshold are not limited in the embodiment of the application. The electronic device can detect the slopes of all edge line segments in the horizontal direction and the vertical direction in the two-dimensional code image. Generally, in a two-dimensional code having flatness, the slope of a line segment in the two-dimensional code approaches 0. When the slope of the edge line segment exceeds a preset threshold, the edge line segment is an error line segment detected by the electronic device. I.e. the line segment may not be the correct edge line segment in the two-dimensional code image. In this way, the electronic device only takes the line segment with the slope of the line segment smaller than the preset threshold as the target line segment, and can exclude some error line segments.
Further, the electronic device may merge two target line segments, which have a distance smaller than a distance threshold and a slope with an absolute value smaller than a first threshold, into one line segment. In this way, repeated line segments can be reduced.
2. The electronic device clusters the target line segments into polylines.
The electronic device clusters the target line segments in the horizontal direction into a polyline in the horizontal direction, which may be referred to as a first-direction polyline. The electronic device clusters the target line segments in the vertical direction into polylines in the vertical direction, which may be referred to as second-direction polylines.
In one possible implementation manner, the electronic device divides the first two-dimensional code image into R first intervals and L second intervals; r, L is a positive integer, R is less than said n, L is less than said m; the electronic equipment constructs one or more first direction broken lines according to the first direction target line segments in each first interval, wherein the sum of the number of the first direction broken lines in the R first intervals is (n + 1); and constructing one or more second direction broken lines according to the second direction target line segments in each second interval, wherein the sum of the number of the second direction broken lines in the L second intervals is (m + 1). R and L may be equal.
For example, take R and L equal to 2 as an example. Fig. 9A exemplarily shows a schematic diagram of a horizontal interval in the first two-dimensional code image when R is 2. When R is 2, the first two-dimensional code image is divided into two first intervals. Each first interval comprises a plurality of target line segments. Fig. 9B exemplarily shows a schematic diagram of a vertical interval in the first two-dimensional code image when L is 2. When L is 2, the first two-dimensional code is divided into two second intervals. Each second interval comprises a plurality of target line segments. For example, the two-dimensional code shown in fig. 9A is composed of 27 × 27 lattices, that is, n ═ m ═ 27, and then the number of polylines that can be constructed by the target line segment in the R horizontal sections is 28. When R is 2, the target line segments in the 2 first intervals may respectively construct 14 broken lines.
The values of R and L are related to the pixel value of the two-dimensional code image and the number of the target line segments. In one possible implementation, the larger the pixel value of the two-dimensional code image, the larger the number of target line segments, and the larger the values of R and L. In one possible implementation, R and L are fixed values configured for the electronic device, e.g., R, L may be equal to 12. And are not limited herein.
It is understood that the larger the value of R, the more the first intervals, and the uniform the direction of deformation, bending, or buckling of the target line segment in each first interval.
Taking the example that the electronic device clusters the target line segments in the horizontal direction into the broken lines in the horizontal direction, the clustering the target line segments into the broken lines by the electronic device may specifically include:
(1) and dividing the regions.
As described above, in the first two-dimensional code composed of 27 × 27 lattices, the two-dimensional code may be divided into 12 (i.e., R ═ 12) first sections. Each first span range (e.g., height and width) may be determined from the coordinates of the end points of the target line segment.
In one possible example, the target line segment may be represented by the coordinates of the end points of the line segment. Exemplarily, one target line segment in the horizontal direction shown in fig. 9A, i.e., the target line segment L2, may be represented as [ (x0, y0), (x1, y1) ]. (x0, y0) represents the left end point of the target line segment L2 (i.e., point a in fig. 9A), and (x1, y1) represents the right end point of the target line segment L2 (i.e., point B in fig. 9A). Taking a target line segment in the horizontal direction as an example, the electronic device may divide the two-dimensional code into R first sections, where R is a positive integer. As shown in fig. 9A, there are two first intervals in the figure. The electronic device clusters the target line segments within each first interval into polylines. Therefore, the directions of deformation, bending or folding of the target line segment in each first interval are consistent, and the electronic equipment can reconstruct the two-dimensional code more accurately according to the broken line in the first interval.
In one possible implementation, the electronic device may divide the first interval according to the target line segment. The height of each first interval may be the difference between the maximum and minimum values of the y-coordinate of the horizontal target line segment end point divided by the number of first intervals (i.e., divided by R). For example, if the target line segment in the horizontal direction is [ (60.98, 23.16), (71.08, 23.95) ], [ (155, 36.46), (263.04, 46.04) ], [ (68.01, 47.72), (100, 48.9) ]. [ (336.99, 645.35), (406.99, 648.64) ]. The maximum and minimum values of the y coordinate are 648.64, 23.16, respectively. Then, the height of the first interval may be (648.64-23.16)/R. The length of the first interval is the difference between the maximum value and the minimum value of the x coordinate of the end point of the target line segment in the horizontal direction. The electronic device clusters the target line segments within each first interval into polylines.
It will be appreciated that the above described way of dividing the segments of the electronic device is to divide all target line segments into sets. The electronic device determines a target line segment with the coordinates of the two end points. The electronic device may obtain the endpoint coordinates of all target line segments. The electronic device may then divide the endpoint coordinates into a plurality of intervals, each interval including one or more target line segments.
It can be understood that the electronic device may also divide the original two-dimensional code image into regions by average division, and the specific manner of dividing the regions is not limited in the present application.
(2) And clustering the target line segments in each interval into broken lines.
Further, in a possible implementation manner, the electronic device clustering the target line segments in each interval (the first interval or the second interval) into the polyline may include the following steps:
A. the electronic device obtains a weighted average angle α according to the length and the inclination angle of each line segment, and obtains a corresponding unit vector v ═ sin α + cos α.
For example, assume that there are 3 target line segments L1, L2, and L3 within a first interval. As shown in fig. 9C, the target line segment L1 has a length d1 and an inclination angle α 1. The target line segment L2 has a length d2 and an inclination angle α 2. The target line segment L3 has a length d3 and an inclination angle α 3. Then the weighted average angle α is (d1 α 1+ d2 α 2+ d3 α 3)/(d1+ d2+ d 3). Then, the electronic device may determine the unit vector v ═ sin α + cos α for the first section according to the weighted average angle of the first section. The projection distance between every two target line segments in the first interval may be calculated from the unit vector v.
The target line segment L1 shown in fig. 9C may be the target line segment L1 in fig. 9A. The target line segment L2 shown in fig. 9C may be the target line segment L2 in fig. 9A. The target line segment L3 shown in fig. 9C may be the target line segment L3 in fig. 9A.
B. The electronic equipment calculates the projection distance d of the connecting line of the midpoints of any two target line segments in the first interval on the normal vector of the unit vector v.
Fig. 9D exemplarily shows the projected distance D of the midpoint connecting line of the target line segment on the normal vector of the unit vector v. As shown in fig. 9D, the target line segment L2 and the target line segment L3 are included in fig. 9D, as well as the unit vector v in the first section. The center-point connecting line m is a line segment connecting the midpoint of the target line segment L2 and the midpoint of the target line segment L3. The electronic device can obtain the projection distance d from the center point connecting line m to the normal vector of the unit vector v. The target line segment L2 and the target line segment L3 shown in fig. 9D are the target line segment L2 and the target line segment L3 shown in fig. 9A.
C. And the electronic equipment clusters the two target line segments with the projection distance d smaller than the preset distance into a broken line.
A preset distance may be configured in the electronic device. If D is less than the preset distance, the electronic device may cluster the target line segment L2 and the target line segment L3 in fig. 9D as a polyline. For example, the target line segment L2 and the target line segment L3 in FIG. 9D may be clustered as a polyline C2 as shown in FIG. 9C. That is, the right end point of the target line segment L2 and the left end point of the target line segment L3 are connected to form a polygonal line.
In a possible implementation manner, the electronic device constructs a first direction broken line for two or more first direction target line segments with first projection distances smaller than a first preset distance in a first interval; the first projection distance is the projection of a connecting line of central points of two adjacent first-direction target line segments in a first interval on a first vector, and the first vector is a normal vector of a first unit vector; the first unit vector is determined according to the length and the inclination angle of the line segment of the first-direction target line segment in the first interval; the electronic equipment constructs a second direction broken line by two or more second direction target line segments with second projection distances smaller than a second preset distance in a second interval; the second projection distance is the projection of a connecting line of the central points of two adjacent second-direction target line segments in a second interval on a second vector, and the second vector is a normal vector of a second unit vector; and the second unit vector is determined according to the length and the inclination angle of the second direction target line segment in the second interval.
In the embodiment of the present application, the first preset distance may be equal to the second preset distance. The specific values of the first preset distance and the second preset distance are not limited in the embodiment of the application.
It is understood that the projection distance of the target line segment L2 and the left adjacent target line segment L1 is smaller than the preset distance, and the target line segment L2 and the target line segment L1 may constitute a polyline C1. The projection distance of the target line segment L2 and the right-adjacent target line segment L3 is smaller than the preset distance, and the target line segment L2 and the target line segment L3 may constitute a polyline C2. Fold line C1 and fold line C2 may form a continuous fold line C (shown as fold line C in FIG. 10).
According to the method, the electronic equipment can cluster all the target line segments in the horizontal direction and the vertical direction into the broken lines. It is understood that, in general, target line segments detected in the same row of grids in a two-dimensional code are clustered into a broken line. Fig. 10 exemplarily shows a broken line in a horizontal direction in a two-dimensional code. The broken line shown in fig. 10 is constituted by the target line segment shown in fig. 7. Specifically, the electronic device may cluster the target line segments shown in fig. 7 into the polyline shown in fig. 10 according to the above-described method for clustering the target line segments into the polyline. Fig. 11 exemplarily shows a broken line in the vertical direction of the two-dimensional code. The broken line shown in fig. 11 is constituted by the target line segment shown in fig. 8. Specifically, the electronic device may cluster the target line segments shown in fig. 8 into the polyline shown in fig. 11 according to the above method for clustering the target line segments into the polyline.
The electronic device constructs a horizontal fold line and a vertical fold line. Under the condition that errors do not occur in the horizontal folding line and the vertical folding line constructed by the electronic equipment, the electronic equipment can determine one grid in the two-dimensional code according to two adjacent horizontal folding lines and two adjacent vertical folding lines. Thus, the electronic equipment can determine each grid in the two-dimensional code according to the broken lines. The electronic equipment then reconstructs each determined lattice into a two-dimensional code with straightness. Here, the description in step S105 may be specifically referred to, and is not repeated here.
However, when the electronic device constructs the target line segments into the polylines, some target line segments are classified incorrectly or missed, which may cause the polylines constructed in some regions in the two-dimensional code to be incorrect or missing. In order to reduce the occurrence of errors or missing of the polyline constructed in the region in the two-dimensional code, the electronic device corrects the polyline constructed in the two-dimensional code, that is, the electronic device executes step S104.
And S104, the electronic equipment corrects the broken line constructed in the two-dimensional code.
In a possible implementation manner, the electronic device correcting the polyline constructed in the two-dimensional code may include the following steps:
1. and searching the area of the wrong broken line and/or the missing broken line in the two-dimensional code.
The electronic device may calculate the distances of all polylines from adjacent polylines in the horizontal direction and the vertical direction. Take a broken line in the horizontal direction as an example. The electronic device calculates the distance t1 between the first fold line and the second fold line in the horizontal direction. The distance t2 between the second fold line and the third fold line. The distance tw between the nth fold line and the (N +1) th fold line. The electronic equipment determines the distance interval [ T1, T2] between the correct folding lines according to the distances T1, T2, … and tw between the folding lines. The first folding line is adjacent to the second folding line, the second folding line is adjacent to the third folding line, and the Nth folding line is adjacent to the (N +1) th folding line. If the distance between the broken line and all the adjacent broken lines is within the distance interval [ T1, T2], the electronic equipment determines that the broken line is the correct broken line. If the distance between the broken line and any adjacent broken line is not within the distance interval [ T1, T2], the electronic equipment determines that the broken line is the wrong broken line. It is understood that when the distance between two adjacent fold lines in the horizontal direction is less than T1, it indicates that the two fold lines may overlap or intersect. When the distance between two adjacent fold lines in the horizontal direction is greater than T2, it indicates that there should be a missing fold line between the two fold lines. For example, if the distance T1 between the first folding line and the second folding line is not within the distance interval [ T1, T2], the electronic device determines that the first folding line is the wrong folding line. If the distance T1 between the second folding line and the first folding line and the distance T2 between the second folding line and the third folding line are within the distance interval [ T1, T2], the electronic device determines that the second folding line is the correct folding line. If the distance T1 between the second folding line and the first folding line and/or the distance T2 between the second folding line and the third folding line is not within the distance interval [ T1, T2], the electronic device determines that the second folding line is the wrong folding line.
In one possible implementation, T1 is 0.7ts, T2 is 1.3ts, ts is the median of T1, T2, …, tw. The distance interval is determined by the median, so that the distance interval is not easily influenced by extreme values in the distance data between folding lines.
The electronic equipment searches all the wrong broken lines in the horizontal direction and the areas of the missing broken lines according to the method. Likewise, the electronic device may find the wrong polyline in all vertical directions, and the area of the missing polyline, in the manner described above. Fig. 12 exemplarily shows an erroneous broken line in the horizontal direction in the two-dimensional code. As shown in fig. 12, the broken line portion indicates an erroneous broken line. Fig. 13 exemplarily shows a vertically wrong polyline in a two-dimensional code. As shown in fig. 13, the broken line portion indicates an erroneous broken line.
2. Correcting the wrong polyline and/or filling up the missing polyline.
In a possible implementation manner, the electronic device determines a first wrong fold line and a second wrong fold line which do not meet a preset condition in the first direction fold line and the second direction fold line; the electronic equipment constructs a first direction broken line for the second target line segment according to the first average inclination angle of the first target line segment, and constructs a second direction broken line for the fourth target line segment according to the second average inclination angle of the third target line segment.
The first target line segment is a first direction target line segment for constructing a first broken line, the first broken line is a first direction broken line adjacent to a first error broken line, and the second target line segment comprises a plurality of first edge line segments in a first interval where the first error broken line is located.
The third target line segment is a second direction target line segment for constructing a second broken line, the second broken line is a second direction broken line adjacent to a second error broken line, and the fourth target line segment is a plurality of second edge line segments in a second interval including the second error broken line.
In a possible implementation manner, the constructing, by the electronic device, the first direction broken line by the second target line segment according to the first average inclination angle of the first target line segment specifically includes: the electronic equipment performs coordinate transformation on the first coordinate of the central point on the second target line segment according to the first average inclination angle to obtain a second coordinate; and the electronic equipment constructs two or more second target line segments of which the vertical coordinate difference values of the second coordinates belong to the first distance interval into a first direction broken line.
With reference to the first aspect, in a possible implementation manner, the constructing, by the electronic device, a fourth target line segment into the second direction broken line according to a second average inclination angle of the third target line segment specifically includes: the electronic equipment performs coordinate transformation on the third coordinate of the central point on the fourth target line segment according to the second average angle to obtain a fourth coordinate; and the electronic equipment constructs two or more fourth target line segments of which the vertical coordinate difference values of the fourth coordinates belong to the second distance interval into a second direction broken line.
In a possible implementation manner, the electronic device specifically includes: determining the average inclination angle beta of the correct broken line adjacent to the wrong broken line; according to the average inclination angle beta, carrying out rotary projection on the error broken line in the two-dimensional code and the target line segment of the area lacking the broken line to obtain a projection histogram; and re-clustering the target line segments of the error broken line and the missing broken line region into broken lines according to the projection histogram.
Illustratively, taking the polyline in the horizontal direction as an example, if the electronic device determines that the first polyline and the second polyline are wrong polylines, the third polyline is a correct polyline. The electronic device may obtain the average tilt angle β from the tilt angles of all target line segments in the third fold line. And then, performing rotation projection on the coordinates of the central point of all the target line segments in the two-dimensional code, namely if the coordinates of the central point are (x, y), and the coordinates after rotation projection are (x2, y 2). x2 ═ xcos β + ysin β, y2 ═ xsin (- β) + ycos β. And for the target line segments of the error region in the horizontal direction, the electronic equipment rotates the projected coordinates according to the coordinates of the central points of all the target line segments of the error region to obtain a projection histogram. The horizontal axis in the projection histogram represents the ordinate y2 after the center point of the target line segment is rotated and projected, and the vertical axis represents the number of target line segments with the ordinate y2 after the center point is rotated and projected. Fig. 14 exemplarily shows a projection histogram of a target line segment in the horizontal direction. As shown in fig. 14, the horizontal axis in fig. 14 represents the vertical axis y1 after the center point of the target line segment is projected by rotation. The vertical axis represents the target line segment number. For example, when y2 is 12, the target line segment number is 1. When y2 is 78, the number of target line segments is 2. The electronic equipment determines the peak position in the projection histogram, and clusters the target line segments in the neighborhood of the peak position as a center to form a broken line. Thus, the electronic device can correct the wrong polyline in the horizontal direction and the vertical direction and fill up the missing polyline in the horizontal direction and the vertical direction by using the method.
The polyline after correction in the horizontal direction in the two-dimensional code can be as shown in fig. 15. Fig. 15 exemplarily shows a broken line diagram after horizontal direction correction in the two-dimensional code. The polyline after correction in the vertical direction in the two-dimensional code can be as shown in fig. 16. Fig. 16 exemplarily shows a broken line diagram after vertical direction correction in a two-dimensional code.
And S105, the electronic equipment reconstructs the two-dimensional code according to the corrected broken line.
The electronic equipment determines the coordinates of grids in the two-dimensional code according to the intersection point of the first direction fold line and the second direction fold line; then, determining the encoding information of the grids according to the positions of the determined grids in the two-dimensional code, wherein the encoding information is a first preset number or a second preset number; and finally, reconstructing the two-dimensional code according to the number of the grids and the coding information of each grid.
The first preset number may be 0, and the second preset number may be 1.
Specifically, an intersection point of the first horizontal direction broken line and the first vertical direction broken line is an upper left vertex of the first lattice in the two-dimensional code. And the intersection point of the first horizontal broken line and the second vertical broken line is the top right vertex of the first lattice in the two-dimensional code. And the intersection point of the second broken line in the horizontal direction and the first broken line in the vertical direction is the lower left vertex of the first lattice in the two-dimensional code. And the intersection point of the second horizontal broken line and the second vertical broken line is the right lower vertex of the first grid in the two-dimensional code. In this way, the electronic device can determine one grid in the two-dimensional code through the two first-direction broken lines and the two second-direction broken lines. Thus, the electronic equipment can determine each grid in the two-dimensional code according to the broken lines. The lattice formed by the first-direction folding lines and the second-direction folding lines may be as shown in fig. 17. Fig. 17 exemplarily shows a grid diagram of a two-dimensional code. The grid in fig. 17 is formed of first direction folding lines and second direction folding lines. The electronic equipment can determine the coordinates of four vertexes of a grid according to the intersection point of the first direction broken line and the second direction broken line. In turn, the electronic device can determine the vertices of all the lattices. The lattice vertices in the two-dimensional code determined by the electronic device can be as shown in fig. 18. Fig. 18 exemplarily shows a lattice vertex diagram in a two-dimensional code. And the electronic equipment takes each grid into the two-dimensional code for cutting, and if the proportion of the pixels corresponding to the cut pixel blocks is greater than or equal to a preset proportion, the coding information of the grid is determined to be a first preset number (for example 0). And if the proportion of the pixels corresponding to the clipped pixel blocks is lower than the preset proportion, determining the coding information of the grid as a second preset number (for example, 1). In this way, the electronic device can obtain encoded information for all of the lattices. And then, the electronic device redraws the two-dimensional code according to the number and the size of the lattices (it can be understood that the size of each lattice in the two-dimensional code is the same), the coordinates and the coding information of each lattice, namely, the two-dimensional code after reconstruction. The reconstructed two-dimensional code is a two-dimensional code with straightness. The preset ratio may be 50%, or may be other values, such as 60%, and is not limited herein. The pixel corresponding to the pixel block may be a black pixel, or may be a pixel of another color, which is not limited herein.
In one possible implementation, the electronic device determining the coordinates of the first grid may include: the electronic equipment determines the position information and the coding information of n × m lattices forming the first two-dimensional code image according to the (n +1) first direction folding lines and the (m +1) second direction folding lines; the method specifically comprises the following steps: the electronic equipment determines position information of the first grid according to intersection points of the first fold line and the second fold line with the third fold line and the fourth fold line respectively; the first direction folding line comprises a first folding line and a second folding line, and the first folding line is adjacent to the second folding line; the second directional fold lines include a third fold line and the fourth fold line; the third fold line and the fourth fold line are adjacent; the n × m cells include a first cell; the position information of the first lattice includes coordinates of four vertices of the first lattice; the electronic device determines the coding information of the first grid according to the proportion of the pixels at the first grid in the first two-dimensional code image. As shown in fig. 17, a first fold line and a second fold line adjacent in the horizontal direction are shown in fig. 17. Also included in fig. 17 are third and fourth fold lines that are vertically adjacent. Intersections of the first fold line and the second fold line with the third fold line and the fourth fold line, respectively, constitute a first lattice.
The process for the electronic device to determine the coordinates of the intersection of a first direction polyline and a second direction polyline may refer to FIG. 19. FIG. 19 schematically illustrates first direction fold line L3 and second direction fold line C5. As shown in fig. 19, the first direction folding line L3 is composed of a target line segment AB, a target line segment BC, a target line segment CD, a target line segment DE, and a target line segment EF. The electronic equipment can acquire coordinates of a point A, a point B, a point C, a point D, a point E and a point F of the end point of the target line segment. The abscissa of the top left vertex Q1 of the horizontal rectangle 2401 is equal to the minimum of the abscissas of the endpoints a, B, C, D, E, and F, i.e., equal to the abscissa of the point a. The ordinate of Q1 is equal to the minimum value of the ordinates of the endpoints A, B, C, D, E and F, i.e. equal to the ordinate of the F. It is to be understood that in fig. 24, the abscissa is gradually increased from left to right, and the ordinate is gradually increased from top to bottom. The abscissa of the lower right vertex Q3 of the horizontal rectangle 2401 is equal to the maximum of the abscissas of the endpoints a, B, C, D, E, and F, i.e., equal to the abscissa of the point F. The ordinate of Q3 is equal to the maximum ordinate of points A, B, C, D, E and F, i.e. equal to the ordinate of point E. After the electronics have determined the upper left vertex Q1 and the lower right vertex Q3 of the horizontal rectangle 2401, the lower left vertex Q2 and the upper right vertex F may be determined from Q1 and Q3. Thus, the electronic device can determine the horizontal rectangle 2401 from the four vertices Q1, Q2, Q3, and F.
The second direction folding line C5 in fig. 19 may be composed of a target line segment GH, a target line segment HI, a target line segment IJ, a target line segment JK, a target line segment KM, and a target line segment MN. The electronic device can acquire coordinates of a target line segment endpoint H point, a target line segment endpoint I point, a target line segment endpoint J point, a target line segment endpoint K point, a target line segment endpoint M point and a target line segment endpoint N point. The abscissa of the upper left vertex Q4 of the vertical rectangle 2402 is equal to the minimum of the abscissas of the end points H, I, J, K, M, and N, i.e., equal to the abscissa of point H. The ordinate of Q4 is equal to the minimum value of the ordinates of the endpoints H, I, J, K, M, N, i.e. the ordinate of point G. The bottom right vertex of the vertical rectangle 2402 is N, and the abscissa of the N point is the maximum of the abscissas among the endpoints H, I, J, K, M, and N. The ordinate of the N point is the maximum value of the ordinate of the end points H, I, J, K, M and N. The electronic device may determine the coordinates of the lower left vertex Q6 and the upper right vertex Q5 of the vertical rectangle 2402 based on the coordinates of the upper left vertex Q4 and the lower right vertex N. In this way, the electronic device can determine the vertical rectangle 2402 from the four vertex coordinates.
In fig. 19, points P1, P2, P3 and P4 are the four vertices of the intersecting rectangle of the horizontal rectangle 2401 and the vertical rectangle 2402. The electronic equipment determines an intersecting rectangle P1P2P3P4, then respectively uses a first direction target line segment CD and a second direction target line segment IJ according to intersecting target line segments in a first direction folding line L3 and a second direction folding line C5 in the intersecting rectangle, and finally determines the coordinates of an intersection point P according to the first direction target line segment CD and the second direction target line segment IJ. Because the coordinates of the two end points of the first-direction target line segment CD are known, a first linear equation of the straight line where the first-direction target line segment CD is located can be obtained according to the coordinates of the two end points. Similarly, the coordinates of the two end points of the second direction target line segment IJ are known, and a second line equation of the line where the second direction target line segment is located can be obtained according to the coordinates of the two end points. The electronic device solves the first linear equation and the second linear equation to obtain the coordinate of the intersection point P. Thus, the electronic device can sequentially determine the intersections of all the first-direction folding lines and the second-direction folding lines shown in fig. 23 in the above-described manner.
With reference to the first aspect, in a possible implementation manner, the electronic device determines the position information of the first lattice according to intersection points of the first folding line and the second folding line and intersection points of the third folding line and the fourth folding line, and specifically includes: the electronic equipment determines the coordinates of a first intersection point of the first folding line and the third folding line; the electronic equipment determines the coordinates of a second intersection point of the first fold line and the fourth fold line; the electronic equipment determines coordinates of a third intersection point of the second fold line and the third fold line; the electronic equipment determines coordinates of a fourth intersection point of the second fold line and the fourth fold line; wherein the first intersection point, the second intersection point, the third intersection point and the fourth intersection point are four vertexes of the first lattice.
With reference to the first aspect, in a possible implementation manner, the determining, by the electronic device, coordinates of a first intersection point of the first folding line and the third folding line specifically includes: the electronic equipment converts the first folding line into a first rectangle, and converts the third folding line into a second rectangle; the electronic device determines an intersecting rectangle of the first rectangle and the second rectangle; the electronic device determines one or more first coordinate points on the first fold line and the third fold line within the intersecting rectangle; the electronic device determines coordinates of a first intersection point of the first fold line and the third fold line according to the one or more first coordinate points.
The horizontal coordinate of the upper left vertex of the first horizontal rectangle is the minimum value of the horizontal coordinates of all points on the first folding line, and the vertical coordinate of the upper left vertex of the first horizontal rectangle is the minimum value of the vertical coordinates of all points on the first folding line; the coordinate of the right lower vertex of the first horizontal rectangle is the maximum of the abscissa of all points on the first folding line, and the ordinate of the right lower vertex of the first horizontal rectangle is the maximum of the ordinate of all points on the first folding line; the horizontal coordinate of the upper left vertex of the first vertical rectangle is the minimum value of the horizontal coordinates of all points on the second fold line, and the vertical coordinate of the upper left vertex of the first vertical rectangle is the minimum value of the vertical coordinates of all points on the second fold line; the abscissa of the lower right vertex of the first vertical rectangle is the maximum of the abscissas of all the points on the second fold line, and the ordinate of the lower right vertex of the first vertical rectangle is the maximum of the ordinates of all the points on the second fold line. Here, the horizontal coordinate axis is directed rightward, and the vertical coordinate axis is directed downward.
The electronic device determines four intersection points of all the intersection points to determine a two-dimensional code grid. As shown in fig. 20, a lattice 2501 in fig. 20 is defined by four intersections. The electronic device can determine the position and size of the grid 2501 in the two-dimensional code. The electronic device may crop with lattice 2501 at the same location in the first two-dimensional code pattern. When the proportion of the black pixel value in the lattice 2501 is 50% or more, the encoded information of the lattice 2501 is 0. Namely, the position of the grid 2501 in the two-dimensional code reconstructed by the electronic device is a black pixel block.
The two-dimensional code image reconstructed by the electronic device can be as shown in fig. 21. The two-dimensional code image shown in fig. 21 has flatness.
S106, the electronic equipment decodes the reconstructed two-dimensional code and displays a decoding result.
And the electronic equipment decodes the reconstructed two-dimensional code. The electronic equipment can read the coded information of each grid in the two-dimensional code. And finally, the electronic equipment obtains a decoding result according to the coding information of each grid. Reference may be made to the prior art, and details are not repeated here.
Exemplarily, the decoding result of the two-dimensional code by the electronic device may be as shown in fig. 22. Fig. 22 shows a schematic diagram of the decoding result of the electronic device. As shown in FIG. 22, FIG. 22 illustrates a user interface 300 presenting the results of the electronic device decoding. Control 301 may be included in user interface 300. Control 301 is used to return to the previous level of interface. The text prompt 302 is used to prompt the user about the content of the current interface display (for example, "code scanning result" indicates that the current interface displays the result of decoding the two-dimensional code after the electronic device scans the code). The decoding result 303 is used to show a specific decoding result, e.g. the website "http:// xxx.
Therefore, when the two-dimensional code image scanned by the electronic equipment has distortion, bending, wrinkling and other distortions, the electronic equipment cannot directly identify the two-dimensional code to obtain a decoding result. The embodiment of the application provides a two-dimensional code identification method. The electronic device divides the two-dimensional code into a plurality of grids by the grid map and acquires the topological relation between each grid (i.e., the positional relation of one grid to the other grids, for example, the adjacency). The electronic equipment reconstructs the lattices into a two-dimensional code with straightness according to the acquired topological relation of the lattices, and then decodes the two-dimensional code. Thus, the electronic device can accurately decode the two-dimensional code with distortion such as deformation, bending, and wrinkling. Thereby improving the user experience.
In one scenario, a two-dimensional code image acquired by an electronic device is curved. Fig. 23 exemplarily shows a reconstruction process of a curved two-dimensional code by an electronic device. As shown in fig. 23, the two-dimensional code image (i.e., the original image shown in the figure) acquired by the electronic device is curved and has no straightness. The two-dimensional code recognition process shown in fig. 23 may specifically include: the method comprises the steps that the electronic equipment obtains an image to be recognized, wherein the image to be recognized comprises an uneven first two-dimensional code image; the first two-dimensional code is formed by n × m lattices; the electronic equipment detects edge line segments in the first two-dimensional code image; the edge line segments comprise a first edge line segment in a first direction and a second edge line segment in a second direction, and the first direction is vertical to the second direction; the electronic equipment constructs (n +1) first direction broken lines according to the first edge line segments, and constructs (m +1) second direction broken lines according to the second edge line segments; the electronic equipment determines the position information and the coding information of n × m lattices forming the first two-dimensional code image according to the (n +1) first direction folding lines and the (m +1) second direction folding lines; the electronic equipment constructs a two-dimensional code image according to the position information of the n-by-m grids and the coding information, wherein the two-dimensional code image is a two-dimensional code image with straightness; the electronic equipment decodes the two-dimensional code image and displays the decoding result. Specifically, reference may be made to the description of step S101 to step S106, which is not described herein again.
In another scenario, the two-dimensional code image acquired by the electronic device is wrinkled. Fig. 24 exemplarily shows a reconstruction process of a two-dimensional code of a wrinkle by an electronic device. As shown in fig. 24, the two-dimensional code image acquired by the electronic device (i.e., the original image shown in the figure) is wrinkled and has no straightness. The two-dimensional code recognition process shown in fig. 24 may specifically include: the method comprises the steps that the electronic equipment obtains an image to be recognized, wherein the image to be recognized comprises an uneven first two-dimensional code image; the first two-dimensional code is formed by n × m lattices; the electronic equipment detects edge line segments in the first two-dimensional code image; the edge line segments comprise a first edge line segment in a first direction and a second edge line segment in a second direction, and the first direction is vertical to the second direction; the electronic equipment constructs (n +1) first direction broken lines according to the first edge line segments, and constructs (m +1) second direction broken lines according to the second edge line segments; the electronic equipment determines the position information and the coding information of n × m lattices forming the first two-dimensional code image according to the (n +1) first direction folding lines and the (m +1) second direction folding lines; the electronic equipment constructs a two-dimensional code image according to the position information of the n-by-m grids and the coding information, wherein the two-dimensional code image is a two-dimensional code image with straightness; the electronic equipment decodes the two-dimensional code image and displays the decoding result. Specifically, reference may be made to the description of step S101 to step S106, which is not described herein again.
Fig. 25 shows a schematic structural diagram of the electronic device 100.
The following describes an embodiment specifically by taking the electronic device 100 as an example. It should be understood that the electronic device 100 shown in fig. 25 is merely an example, and that the electronic device 100 may have more or fewer components than shown in fig. 25, may combine two or more components, or may have a different configuration of components. The various components shown in the figures may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
The electronic device 100 may include: the mobile terminal includes a processor 110, an external memory interface 120, an internal memory 121, a Universal Serial Bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, a Subscriber Identity Module (SIM) card interface 195, and the like. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
It is to be understood that the illustrated structure of the embodiment of the present invention does not specifically limit the electronic device 100. In other embodiments of the present application, electronic device 100 may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Processor 110 may include one or more processing units, such as: the processor 110 may include an Application Processor (AP), a modem processor, a Graphics Processing Unit (GPU), an Image Signal Processor (ISP), a controller, a memory, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), etc. The different processing units may be separate devices or may be integrated into one or more processors.
The controller may be, among other things, a neural center and a command center of the electronic device 100. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and instruction execution.
A memory may also be provided in processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that have just been used or recycled by the processor 110. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Avoiding repeated accesses reduces the latency of the processor 110, thereby increasing the efficiency of the system.
In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (I2C) interface, an integrated circuit built-in audio (I2S) interface, a Pulse Code Modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a general-purpose input/output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and/or a Universal Serial Bus (USB) interface, etc.
The I2C interface is a bi-directional synchronous serial bus that includes a serial data line (SDA) and a Serial Clock Line (SCL). The I2S interface may be used for audio communication. The PCM interface may also be used for audio communication, sampling, quantizing and encoding analog signals. The UART interface is a universal serial data bus used for asynchronous communications. MIPI interfaces may be used to connect processor 110 with peripheral devices such as display screen 194, camera 193, and the like. The MIPI interface includes a Camera Serial Interface (CSI), a Display Serial Interface (DSI), and the like. In some embodiments, processor 110 and camera 193 communicate through a CSI interface to implement the capture functionality of electronic device 100. The processor 110 and the display screen 194 communicate through the DSI interface to implement the display function of the electronic device 100.
In a possible implementation manner, in this embodiment of the application, the image to be recognized including the two-dimensional code captured by the camera 193 may be transmitted to the processor 110 through the CSI interface. The processor 110 processes the image to be recognized and transmits the processed image to the display screen 194 through the DSI interface. In this way, the user can see the image to be recognized on the display screen 194.
In a possible implementation manner, the processor 110 decodes the two-dimensional code in the image to be recognized, and obtains a decoding result. The decoded result is transmitted to the display screen 194 through the DSI interface. Thus, the user can see the decoding result of the two-dimensional code (e.g., web address, personal business card, price of goods, etc.) on the display screen 194.
The GPIO interface may be configured by software. The GPIO interface may be configured as a control signal and may also be configured as a data signal. The USB interface 130 is an interface conforming to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, or the like. The USB interface 130 may be used to connect a charger to charge the electronic device 100, and may also be used to transmit data between the electronic device 100 and a peripheral device. And the earphone can also be used for connecting an earphone and playing audio through the earphone. The interface may also be used to connect other electronic devices, such as AR devices and the like.
It should be understood that the connection relationship between the modules according to the embodiment of the present invention is only illustrative, and is not limited to the structure of the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection manners or a combination of multiple interface connection manners in the above embodiments.
The charging management module 140 is configured to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive a wireless charging input through a wireless charging coil of the electronic device 100. The charging management module 140 may also supply power to the electronic device through the power management module 141 while charging the battery 142.
The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charge management module 140 and provides power to the processor 110, the internal memory 121, the external memory, the display 194, the camera 193, the wireless communication module 160, and the like. The power management module 141 may also be used to monitor parameters such as battery capacity, battery cycle count, battery state of health (leakage, impedance), etc. In some other embodiments, the power management module 141 may also be disposed in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may be disposed in the same device.
The wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, a modem processor, a baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the electronic device 100 may be used to cover a single or multiple communication bands. Different antennas can also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed as a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 150 may provide a solution including 2G/3G/4G/5G wireless communication applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a Low Noise Amplifier (LNA), and the like. The mobile communication module 150 may receive the electromagnetic wave from the antenna 1, filter, amplify, etc. the received electromagnetic wave, and transmit the electromagnetic wave to the modem processor for demodulation. The mobile communication module 150 may also amplify the signal modulated by the modem processor, and convert the signal into electromagnetic wave through the antenna 1 to radiate the electromagnetic wave.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating a low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then passes the demodulated low frequency baseband signal to a baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be provided in the same device as the mobile communication module 150 or other functional modules, independent of the processor 110.
The wireless communication module 160 may provide a solution for wireless communication applied to the electronic device 100, including Wireless Local Area Networks (WLANs) (e.g., wireless fidelity (Wi-Fi) networks), bluetooth (bluetooth, BT), Global Navigation Satellite System (GNSS), Frequency Modulation (FM), Near Field Communication (NFC), Infrared (IR), and the like. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 may also receive a signal to be transmitted from the processor 110, perform frequency modulation and amplification on the signal, and convert the signal into electromagnetic waves through the antenna 2 to radiate the electromagnetic waves.
The electronic device 100 implements display functions via the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and an application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
The display screen 194 is used to display images, video, and the like. The display screen 194 includes a display panel. The display panel may adopt a Liquid Crystal Display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (active-matrix organic light-emitting diode, AMOLED), a flexible light-emitting diode (FLED), a miniature, a Micro-oeld, a quantum dot light-emitting diode (QLED), and the like. In some embodiments, the electronic device 100 may include 1 or N display screens 194, with N being a positive integer greater than 1. In the embodiment of the present application, the display screen 194 may display an image to be recognized including a two-dimensional code and display a decoding result of the two-dimensional code in the image to be recognized.
The electronic device 100 may implement a shooting function through the ISP, the camera 193, the video codec, the GPU, the display 194, the application processor, and the like.
The ISP is used to process the data fed back by the camera 193. For example, when a photo is taken, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, the optical signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converting into an image (for example, an image to be recognized including a two-dimensional code) visible to the naked eye. The ISP can also carry out algorithm optimization on the noise, brightness and skin color of the image. The ISP can also optimize parameters such as exposure, color temperature and the like of a shooting scene. In some embodiments, the ISP may be provided in camera 193. In this embodiment of the application, the ISP may perform preprocessing on the image to be recognized, and the preprocessing process may refer to the description above, which is not described herein again.
The camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects the optical image to the photosensitive element. The photosensitive element may be a Charge Coupled Device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The light sensing element converts the optical signal into an electrical signal, which is then passed to the ISP where it is converted into a digital image signal. And the ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into image signal in standard RGB, YUV and other formats. In some embodiments, the electronic device 100 may include 1 or N cameras 193, N being a positive integer greater than 1. In the embodiment of the present application, the camera 193 may be used to capture an image to be recognized including a two-dimensional code.
The digital signal processor is used for processing digital signals, and can process digital image signals and other digital signals. For example, when the electronic device 100 selects a frequency bin, the digital signal processor is used to perform fourier transform or the like on the frequency bin energy.
Video codecs are used to compress or decompress digital video. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 may play or record video in a variety of encoding formats, such as: moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, and the like.
The NPU is a neural-network (NN) computing processor that processes input information quickly by using a biological neural network structure, for example, by using a transfer mode between neurons of a human brain, and can also learn by itself continuously. Applications such as intelligent recognition of the electronic device 100 can be realized through the NPU, for example: image recognition, face recognition, speech recognition, text understanding, and the like.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to extend the memory capability of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music, video, etc. are saved in an external memory card.
The internal memory 121 may be used to store computer-executable program code, which includes instructions. The processor 110 executes various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. The storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required by at least one function, and the like. The storage data area may store data (such as audio data, phone book, etc.) created during use of the electronic device 100, and the like. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (UFS), and the like.
The electronic device 100 may implement audio functions via the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playing, recording, etc.
The audio module 170 is used to convert digital audio information into an analog audio signal output and also to convert an analog audio input into a digital audio signal. The audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be disposed in the processor 110, or some functional modules of the audio module 170 may be disposed in the processor 110.
The speaker 170A, also called a "horn", is used to convert the audio electrical signal into an acoustic signal. The electronic apparatus 100 can listen to music through the speaker 170A or listen to a handsfree call.
The receiver 170B, also called "earpiece", is used to convert the electrical audio signal into an acoustic signal. When the electronic apparatus 100 receives a call or voice information, it can receive voice by placing the receiver 170B close to the ear of the person.
The microphone 170C, also referred to as a "microphone," is used to convert sound signals into electrical signals. When making a call or transmitting voice information, the user can input a voice signal to the microphone 170C by speaking the user's mouth near the microphone 170C. The electronic device 100 may be provided with at least one microphone 170C. The headphone interface 170D is used to connect a wired headphone. The headset interface 170D may be the USB interface 130, or may be a 3.5mm open mobile electronic device platform (OMTP) standard interface, a cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
The pressure sensor 180A is used for sensing a pressure signal, and converting the pressure signal into an electrical signal. The gyro sensor 180B may be used to determine the motion attitude of the electronic device 100. The air pressure sensor 180C is used to measure air pressure. The magnetic sensor 180D includes a hall sensor. The electronic device 100 may detect the opening and closing of the flip holster using the magnetic sensor 180D. The acceleration sensor 180E may detect the magnitude of acceleration of the electronic device 100 in various directions (typically three axes). The magnitude and direction of gravity can be detected when the electronic device 100 is stationary. The method can also be used for recognizing the posture of the electronic equipment, and is applied to horizontal and vertical screen switching, pedometers and other applications.
A distance sensor 180F for measuring a distance. The electronic device 100 may measure the distance by infrared or laser. The proximity light sensor 180G may include, for example, a Light Emitting Diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light to the outside through the light emitting diode. The electronic device 100 detects infrared reflected light from nearby objects using a photodiode. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 may determine that there are no objects near the electronic device 100. The electronic device 100 can utilize the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear for talking, so as to automatically turn off the screen to achieve the purpose of saving power. The proximity light sensor 180G may also be used in a holster mode, a pocket mode automatically unlocks and locks the screen.
The ambient light sensor 180L is used to sense the ambient light level. Electronic device 100 may adaptively adjust the brightness of display screen 194 based on the perceived ambient light level. The ambient light sensor 180L may also be used to automatically adjust the white balance when taking a picture. The ambient light sensor 180L may also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
The fingerprint sensor 180H is used to collect a fingerprint. The electronic device 100 can utilize the collected fingerprint characteristics to unlock the fingerprint, access the application lock, photograph the fingerprint, answer an incoming call with the fingerprint, and so on.
The temperature sensor 180J is used to detect temperature. The touch sensor 180K is also referred to as a "touch panel". The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is used to detect a touch operation applied thereto or nearby. The touch sensor can communicate the detected touch operation to the application processor to determine the touch event type. Visual output associated with the touch operation may be provided through the display screen 194. In other embodiments, the touch sensor 180K may be disposed on a surface of the electronic device 100, different from the position of the display screen 194.
The bone conduction sensor 180M may acquire a vibration signal. The keys 190 include a power-on key, a volume key, and the like. The keys 190 may be mechanical keys. Or may be touch keys. The electronic apparatus 100 may receive a key input, and generate a key signal input related to user setting and function control of the electronic apparatus 100.
The motor 191 may generate a vibration cue. The motor 191 may be used for incoming call vibration cues, as well as for touch vibration feedback. For example, touch operations applied to different applications (e.g., photographing, audio playing, etc.) may correspond to different vibration feedback effects. The motor 191 may also respond to different vibration feedback effects for touch operations applied to different areas of the display screen 194. Different application scenes (such as time reminding, receiving information, alarm clock, game and the like) can also correspond to different vibration feedback effects. The touch vibration feedback effect may also support customization.
Indicator 192 may be an indicator light that may be used to indicate a state of charge, a change in charge, or a message, missed call, notification, etc.
The SIM card interface 195 is used to connect a SIM card. The SIM card can be brought into and out of contact with the electronic apparatus 100 by being inserted into the SIM card interface 195 or being pulled out of the SIM card interface 195. The electronic device 100 may support 1 or N SIM card interfaces, N being a positive integer greater than 1. The SIM card interface 195 may support a Nano SIM card, a Micro SIM card, a SIM card, etc. The same SIM card interface 195 can be inserted with multiple cards at the same time. The types of the plurality of cards may be the same or different. The SIM card interface 195 may also be compatible with different types of SIM cards. The SIM card interface 195 may also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as communication and data communication. In some embodiments, the electronic device 100 employs esims, namely: an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
Through the above description of the embodiments, it is clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device may be divided into different functional modules to complete all or part of the above described functions. For the specific working processes of the system, the apparatus and the unit described above, reference may be made to the corresponding processes in the foregoing method embodiments, and details are not described here again.
Each functional unit in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially implemented or make a contribution to the prior art, or all or part of the technical solutions may be implemented in the form of a software product stored in a storage medium and including several instructions for causing a computer device (which may be a personal computer, a server, or a network device) or a processor to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: flash memory, removable hard drive, read only memory, random access memory, magnetic or optical disk, and the like.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (18)

1. A two-dimensional code recognition method is characterized by comprising the following steps:
the electronic equipment acquires an uneven first two-dimensional code image; the first isTwo-dimension code composed of n*m lattices;
the electronic equipment detects an edge line segment in the first two-dimensional code image; the edge line segments comprise a first edge line segment in a first direction and a second edge line segment in a second direction, and the first direction is vertical to the second direction;
the electronic equipment constructs (n +1) first direction broken lines according to the first edge line segments, and constructs (m +1) second direction broken lines according to the second edge line segments;
the electronic equipment determines n forming the first two-dimensional code image according to the (n +1) first direction fold lines and the (m +1) second direction fold lines*Position information and coding information of the m lattices;
the electronic equipment is according to the n*The position information and the coding information of the m grids construct a second two-dimensional code image, and the second two-dimensional code image is a two-dimensional code image with straightness;
and the electronic equipment decodes the second two-dimensional code image and displays a decoding result.
2. The method according to claim 1, wherein the first two-dimensional code image is a deformed, bent, or wrinkled two-dimensional code image.
3. The method according to any one of claims 1 or 2, wherein the electronic device constructs (n +1) first direction polylines from the first edge line segment and (m +1) second direction polylines from the second edge line segment, and specifically comprises:
the electronic equipment takes the first edge line segment with the slope smaller than a first preset threshold value as a first direction target line segment; taking the second edge line segment with the slope smaller than a second preset threshold value as a second direction target line segment;
and the electronic equipment constructs the (n +1) first direction broken lines according to the first direction target line segment and constructs the (m +1) second direction broken lines according to the second direction target line segment.
4. The method according to claim 3, wherein the electronic device constructs the (n +1) first-direction polylines from the first-direction target line segments and the (m +1) second-direction polylines from the second-direction target line segments, specifically including:
the electronic equipment divides the first two-dimensional code image into R first intervals and L second intervals; said R, L is a positive integer, said R is less than said n, said L is less than said m;
the electronic equipment constructs one or more first direction broken lines according to the first direction target line segments in each first interval, and the sum of the number of the first direction broken lines in the R first intervals is (n + 1); and constructing one or more second direction broken lines according to the second direction target line segments in each second interval, wherein the sum of the number of the second direction broken lines in the L second intervals is (m + 1).
5. The method of claim 4, wherein the electronic device constructs one or more first direction polylines from the first direction target line segments in each of the first intervals; the method specifically comprises the following steps:
the electronic equipment constructs the first direction broken line by using two or more first direction target line segments with first projection distances smaller than a first preset distance in the first interval; the first projection distance is the projection of a connecting line of central points of two adjacent first-direction target line segments in the first interval on a first vector, and the first vector is a normal vector of a first unit vector; the first unit vector is determined according to the length and the inclination angle of the line segment of the first-direction target line segment in the first interval;
the electronic device constructs one or more second direction broken lines according to the second direction target line segments in each second interval, and specifically includes:
the electronic equipment constructs the second direction broken line by using two or more second direction target line segments with second projection distances smaller than second preset distances in the second interval; the second projection distance is a projection of a connecting line of central points of two adjacent second-direction target line segments in the second interval on a second vector, and the second vector is a normal vector of a second unit vector; and the second unit vector is determined according to the length and the inclination angle of the second-direction target line segment in the first and second intervals.
6. The method of any of claims 1-5, wherein after the electronic device constructs (n +1) first direction polylines from the first edge line segment and (m +1) second direction polylines from the second edge line segment, the method further comprises:
the electronic equipment determines a first error broken line and a second error broken line which do not meet preset conditions in the first direction broken line and the second direction broken line;
the electronic equipment constructs a second target line segment into the first direction broken line according to the first average inclination angle of the first target line segment, and constructs a fourth target line segment into the second direction broken line according to the second average inclination angle of the third target line segment;
the first target line segment is the first direction target line segment for constructing a first broken line, the first broken line is the first direction broken line adjacent to the first error broken line, and the second target line segment comprises a plurality of first edge line segments in the first interval where the first error broken line is located;
the third target line segment is the second direction target line segment for constructing a second broken line, the second broken line is the second direction broken line adjacent to the second error broken line, and the fourth target line segment is the second edge line segments for constructing the second interval including the second error broken line.
7. The method according to claim 6, wherein the preset conditions include: the distance between the adjacent first direction folding lines is in a first distance interval, and the distance between the adjacent second direction folding lines is in a second distance interval.
8. The method of claim 7, wherein the first distance interval is determined by a median of distances of all adjacent first direction polylines; the second distance interval is determined by the median of the distances of all adjacent second direction broken lines.
9. The method according to any one of claims 6 to 8, wherein the electronic device constructs a second target line segment as the first directional polyline according to the first average tilt angle of the first target line segment, and specifically comprises:
the electronic equipment performs coordinate transformation on the first coordinate of the central point on the second target line segment according to the first average inclination angle to obtain a second coordinate;
the electronic equipment constructs two or more second target line segments of which the vertical coordinate difference values of the second coordinates belong to the first distance interval into the first direction broken line;
the constructing, by the electronic device, a fourth target line segment into the second direction broken line according to the second average inclination angle of the third target line segment specifically includes:
the electronic equipment performs coordinate transformation on the third coordinate of the central point on the fourth target line segment according to the second average angle to obtain a fourth coordinate;
and the electronic equipment constructs two or more fourth target line segments of which the vertical coordinate difference values of the fourth coordinates belong to the second distance interval into the second direction broken line.
10. The method of claim 1, wherein n is*The m lattices include a first lattice; the position information and the code information of the first lattice are determined as follows:
the electronic equipment determines position information of the first grid according to intersection points of the first fold line and the second fold line with the third fold line and the fourth fold line respectively; the first direction fold line comprises the first fold line and the second fold line, and the first fold line and the second fold line are adjacent; the second direction fold line comprises the third fold line and the fourth fold line; the third fold line and the fourth fold line are adjacent;
the electronic device determining the encoding information of the first lattice according to a proportion of pixels in the first lattice; the pixels in the first lattice are pixels in a range determined in the first two-dimensional code image according to the position information of the first lattice.
11. The method according to claim 10, wherein the electronic device determines the position information of the first lattice according to intersections of the first folding line and the second folding line with a third folding line and a fourth folding line, respectively, and specifically includes:
the electronic device determining coordinates of a first intersection of the first fold line and the third fold line;
the electronic equipment determines coordinates of a second intersection point of the first fold line and the fourth fold line;
the electronic device determining coordinates of a third intersection point of the second fold line and the third fold line;
the electronic equipment determines coordinates of a fourth intersection point of the second fold line and the fourth fold line;
wherein the first intersection, the second intersection, the third intersection, and the fourth intersection are four vertices of the first lattice.
12. The method of claim 11, wherein the electronic device determines coordinates of a first intersection of the first fold line and the third fold line, in particular comprising:
the electronic equipment converts the first folding line into a first rectangle, and converts the third folding line into a second rectangle;
the electronic device determining an intersecting rectangle of the first rectangle and the second rectangle;
the electronic device determining one or more first coordinate points on the first fold line and on the third fold line within the intersecting rectangle;
the electronic equipment determines intersection point coordinates of the first fold line and the third fold line according to the one or more first coordinate points.
13. The method according to claim 10, wherein the electronic device determines the coding information of the first grid according to a proportion of pixels in the first grid, and specifically comprises:
if the proportion of the pixels in the first grid is larger than or equal to a preset proportion, the electronic equipment determines that the coding information of the first grid is a first preset number;
if the first pixel proportion in the first grid is smaller than a preset proportion, the electronic equipment determines that the coding information of the first grid is a second preset number.
14. The method according to claim 13, wherein the preset proportion is 50%.
15. The method of any one of claims 10-14, wherein the pixels are black pixels.
16. An electronic device, comprising: one or more processors, one or more memories; the one or more memories are respectively coupled with the one or more processors; the one or more memories are for storing computer program code comprising computer instructions; the computer instructions, when executed on the processor, cause the electronic device to perform the two-dimensional code recognition method of any of claims 1-15.
17. A computer-readable storage medium comprising computer instructions that, when executed on an electronic device, cause the electronic device to perform the two-dimensional code recognition method of any one of claims 1-15.
18. A computer program product, which, when run on a computer, causes the computer to perform the two-dimensional code recognition method according to any one of claims 1 to 15.
CN202010830616.7A 2020-07-15 2020-08-18 Two-dimensional code identification method and electronic equipment Active CN113947097B (en)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN2020106824373 2020-07-15
CN202010682437 2020-07-15
CN2020107619573 2020-07-31
CN202010761957 2020-07-31

Publications (2)

Publication Number Publication Date
CN113947097A true CN113947097A (en) 2022-01-18
CN113947097B CN113947097B (en) 2024-04-09

Family

ID=79327154

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010830616.7A Active CN113947097B (en) 2020-07-15 2020-08-18 Two-dimensional code identification method and electronic equipment

Country Status (1)

Country Link
CN (1) CN113947097B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI814550B (en) * 2022-08-25 2023-09-01 華碩電腦股份有限公司 Reading method and reading device for two-dimensional code

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020051573A1 (en) * 2000-04-18 2002-05-02 Kenichiro Sakai Two-dimensional code extracting method
JP2007026428A (en) * 2005-06-13 2007-02-01 Yutaka Kiuchi Two-dimensional code generation method and reading method, and executable program
JP2011070477A (en) * 2009-09-28 2011-04-07 Npo Japan Association For The Visually-Impaired Information Support Two-dimensional code reading method, two-dimensional code to be read by two-dimensional code reading method, and recording medium with the two-dimensional code reading method recorded thereon
CN104657700A (en) * 2015-03-25 2015-05-27 广州宽度信息技术有限公司 Two-dimensional code anti-damaging decoding method
CN105701434A (en) * 2015-12-30 2016-06-22 广州卓德信息科技有限公司 Image correction method for two-dimensional code distorted image
CN106485183A (en) * 2016-07-14 2017-03-08 深圳市华汉伟业科技有限公司 A kind of Quick Response Code localization method and system
CN107742089A (en) * 2017-09-05 2018-02-27 广东职业技术学院 A kind of method that Quick Response Code automatic identification is realized using electrical form
CN108438417A (en) * 2018-05-23 2018-08-24 李晓明 A kind of express delivery carton that can be recycled and its application method
CN108985419A (en) * 2018-07-10 2018-12-11 广州多米诺区块链技术有限公司 Two-dimensional code generation method, device and two dimensional code
CN109211251A (en) * 2018-09-21 2019-01-15 北京理工大学 A kind of instant positioning and map constructing method based on laser and two dimensional code fusion

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020051573A1 (en) * 2000-04-18 2002-05-02 Kenichiro Sakai Two-dimensional code extracting method
JP2007026428A (en) * 2005-06-13 2007-02-01 Yutaka Kiuchi Two-dimensional code generation method and reading method, and executable program
JP2011070477A (en) * 2009-09-28 2011-04-07 Npo Japan Association For The Visually-Impaired Information Support Two-dimensional code reading method, two-dimensional code to be read by two-dimensional code reading method, and recording medium with the two-dimensional code reading method recorded thereon
CN104657700A (en) * 2015-03-25 2015-05-27 广州宽度信息技术有限公司 Two-dimensional code anti-damaging decoding method
CN105701434A (en) * 2015-12-30 2016-06-22 广州卓德信息科技有限公司 Image correction method for two-dimensional code distorted image
CN106485183A (en) * 2016-07-14 2017-03-08 深圳市华汉伟业科技有限公司 A kind of Quick Response Code localization method and system
CN107742089A (en) * 2017-09-05 2018-02-27 广东职业技术学院 A kind of method that Quick Response Code automatic identification is realized using electrical form
CN108438417A (en) * 2018-05-23 2018-08-24 李晓明 A kind of express delivery carton that can be recycled and its application method
CN108985419A (en) * 2018-07-10 2018-12-11 广州多米诺区块链技术有限公司 Two-dimensional code generation method, device and two dimensional code
CN109211251A (en) * 2018-09-21 2019-01-15 北京理工大学 A kind of instant positioning and map constructing method based on laser and two dimensional code fusion

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI814550B (en) * 2022-08-25 2023-09-01 華碩電腦股份有限公司 Reading method and reading device for two-dimensional code

Also Published As

Publication number Publication date
CN113947097B (en) 2024-04-09

Similar Documents

Publication Publication Date Title
CN108681729B (en) Text image correction method, device, storage medium and equipment
CN109409161B (en) Graphic code identification method, device, terminal and storage medium
CN114119758B (en) Method for acquiring vehicle pose, electronic device and computer-readable storage medium
CN108830186B (en) Text image content extraction method, device, equipment and storage medium
WO2021078001A1 (en) Image enhancement method and apparatus
WO2009038876A1 (en) Techniques for decoding images of barcodes
WO2023284715A1 (en) Object reconstruction method and related device
CN111741284A (en) Image processing apparatus and method
CN115526983B (en) Three-dimensional reconstruction method and related equipment
CN114365482A (en) Large aperture blurring method based on Dual Camera + TOF
CN113723136A (en) Bar code correction method, device, equipment and storage medium
CN111612723A (en) Image restoration method and device
CN113947097B (en) Two-dimensional code identification method and electronic equipment
CN113051950A (en) Multi-code identification method and related equipment
CN114840164A (en) Screen display method and related device
CN115358937B (en) Image anti-reflection method, medium and electronic equipment
CN114283195B (en) Method for generating dynamic image, electronic device and readable storage medium
CN115735226B (en) Image processing method and chip
JP4312185B2 (en) Game mat, card game system, image analysis apparatus, and image analysis method
CN114827442A (en) Method and electronic device for generating image
CN114970576A (en) Identification code identification method, related electronic equipment and computer readable storage medium
CN112528760A (en) Image processing method, image processing apparatus, computer device, and medium
JP2007080108A (en) Card
CN113538226A (en) Image texture enhancement method, device, equipment and computer readable storage medium
CN116343247B (en) Form image correction method, device and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20220510

Address after: 523799 Room 101, building 4, No. 15, Huanhu Road, Songshanhu Park, Dongguan City, Guangdong Province

Applicant after: Petal cloud Technology Co.,Ltd.

Address before: 523808 Southern Factory Building (Phase I) Project B2 Production Plant-5, New Town Avenue, Songshan Lake High-tech Industrial Development Zone, Dongguan City, Guangdong Province

Applicant before: HUAWEI DEVICE Co.,Ltd.

Effective date of registration: 20220510

Address after: 523808 Southern Factory Building (Phase I) Project B2 Production Plant-5, New Town Avenue, Songshan Lake High-tech Industrial Development Zone, Dongguan City, Guangdong Province

Applicant after: HUAWEI DEVICE Co.,Ltd.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Applicant before: HUAWEI TECHNOLOGIES Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant