CN114676805A - Two-dimensional code generation method and device - Google Patents

Two-dimensional code generation method and device Download PDF

Info

Publication number
CN114676805A
CN114676805A CN202210262628.3A CN202210262628A CN114676805A CN 114676805 A CN114676805 A CN 114676805A CN 202210262628 A CN202210262628 A CN 202210262628A CN 114676805 A CN114676805 A CN 114676805A
Authority
CN
China
Prior art keywords
sub
dimensional code
lattices
filling
outer frame
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.)
Pending
Application number
CN202210262628.3A
Other languages
Chinese (zh)
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202210262628.3A priority Critical patent/CN114676805A/en
Publication of CN114676805A publication Critical patent/CN114676805A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06037Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking multi-dimensional coding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06046Constructional details

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The application relates to the field of information security, and provides a method and a device for generating a two-dimensional code. The two-dimensional code is provided with a five-pointed star outer frame, and a plurality of circumferences are formed by taking the central point of the five-pointed star outer frame as the center of a circle and adopting different radiuses; sub-grid segmentation is carried out on the plurality of circumferences, and a plurality of sub-grids are obtained in the pentagram outer frame; taking every four circumferences as a group in the direction from the outer ring to the inner ring in the pentagram outer frame, determining sub lattices in the ring formed by the innermost two circumferences as separating sub lattices, and determining sub lattices in the two rings formed by the outermost three circumferences as information filling sub lattices; and filling data in the information filling sub-lattices to obtain the two-dimensional code. By the adoption of the method and the device, the applicability of the two-dimensional code can be improved.

Description

Two-dimensional code generation method and device
Technical Field
The present application relates to the field of information security, and in particular, to a method and an apparatus for generating a two-dimensional code.
Background
At present, the mainstream two-dimensional code is a square two-dimensional code, and is already applied to various scenes.
However, the form of the square two-dimensional code is fixed and single, and when the square two-dimensional code is used, a square area needs to be used, so that the square two-dimensional code is difficult to use in a scene where the square area cannot be provided. For example: in the seal, a square two-dimensional code cannot be used in a five-pointed star area of the seal. Therefore, the use scene of the square two-dimensional code is limited.
Disclosure of Invention
Based on this, the application provides a method and a device for generating a two-dimensional code, so that the application scene range of the two-dimensional code is wider, and the applicability of the two-dimensional code is improved.
In a first aspect, the present application provides a method for generating a two-dimensional code, where the two-dimensional code has a five-pointed star outer frame, and the method includes:
taking the central point of the pentagram outer frame as a circle center, and adopting different radiuses to make a plurality of circumferences;
sub-lattice segmentation is carried out on the plurality of circumferences, and a plurality of sub-lattices are obtained in the pentagram outer frame;
taking every four circumferences as a group in the direction from the outer ring to the inner ring in the pentagram outer frame, determining sub lattices in a ring formed by the two innermost circumferences as separating sub lattices, and determining sub lattices in the two rings formed by the three outermost circumferences as information filling sub lattices;
and performing data filling in the information filling sub-lattice to obtain the two-dimensional code.
In one embodiment, the dividing the plurality of circles into a plurality of sub-lattices in the five-pointed star outer frame includes:
Aiming at any corner of the five-pointed star outer frame, carrying out sub-lattice segmentation on the first circumference based on a plurality of first line segments which are parallel and have equal intervals to obtain a plurality of sub lattices, wherein the starting point of one of the first line segments is the central point of a first circular arc, the end point is the intersection point of a second line segment and the first circumference with the smallest radius, the second line segment is the line segment formed by the central point of the first circular arc and the circle center, and the first circular arc corresponds to the first circumference with the largest inner radius of the corner;
and performing sub-grid segmentation on the second circumference based on a plurality of third line segments to obtain a plurality of sub-grids, wherein the starting point of each third line segment is the end point of each first line segment, the end point of each third line segment is the intersection point of each fourth line segment and the second circumference with the minimum radius, and each fourth line segment is the line segment formed by the end point of each first line segment and the circle center.
In an embodiment, the performing data filling in the information filling sub-lattice to obtain the two-dimensional code includes:
coding the two-dimension code information to be filled to obtain a binary sequence;
taking every four information filling sub lattices in the field character lattices as an information storage unit, and sequentially filling all binary digits in the binary sequence into the information storage unit to obtain a temporary code;
And carrying out mask processing on the temporary code to obtain the two-dimensional code.
In one embodiment, the method for generating a two-dimensional code further includes:
and aiming at three adjacent angles of the pentagram outer frame, respectively determining a first circle center on a connecting line between the vertex of the angle and the central point of the pentagram outer frame, respectively adopting a first radius as a third circle, and performing color filling on each third circle to obtain a positioning mark.
In one embodiment, the sequentially filling each binary digit in the binary sequence into the information storage unit to obtain a temporal code includes:
determining a start information storage unit filled by the binary sequence based on the positioning mark;
filling binary digits in the binary sequence into the information storage unit in sequence from the initial information storage unit;
in the process of filling the binary digits in the binary sequence into the information storage unit, when the binary digits are 1, the information storage unit is filled with a first color, and when the binary digits are 0, the information storage unit is filled with a second color, so that a temporary code is obtained.
In one embodiment, the two-dimensional code includes an avatar placement area, the method further comprising:
and taking the area in the circle with the smallest radius in the plurality of circles as the head portrait placing area.
In a second aspect, the present application further provides a device for generating a two-dimensional code, where the two-dimensional code has a five-pointed star frame, and the device includes: the circumference dividing module is used for making a plurality of circumferences by taking the central point of the pentagram outer frame as a circle center and adopting different radiuses; the cutting module is used for cutting the sub lattices of the plurality of circumferences to obtain a plurality of sub lattices in the pentagram outer frame, taking every four circumferences as a group in the direction from an outer ring to an inner ring in the pentagram outer frame, determining the sub lattices in the ring formed by the two innermost circumferences as separating sub lattices, and determining the sub lattices in the two rings formed by the three outermost circumferences as information filling sub lattices; and the data processing module is used for carrying out data filling in the information filling sub-lattice to obtain the two-dimensional code.
In one embodiment, the plurality of circles includes a first circle and a second circle, the first circle having a radius greater than a radius of the second circle, the slicing module further to:
Aiming at any corner of the pentagram outer frame, carrying out sub-lattice segmentation on the first circumference based on a plurality of first line segments which are parallel and have equal intervals to obtain a plurality of sub lattices, wherein the starting point of one of the first line segments is the central point of a first circular arc, the end point is the intersection point of a second line segment and the first circumference with the smallest radius, the second line segment is the line segment formed by the central point of the first circular arc and the circle center, and the first circular arc corresponds to the first circumference with the largest radius in the corner;
and performing sub-lattice segmentation on the second circumference based on a plurality of third line segments to obtain a plurality of sub-lattices, wherein the starting point of each third line segment is the end point of each first line segment, the end point of each third line segment is the intersection point of each fourth line segment and the second circumference with the smallest radius, and each fourth line segment is the line segment formed by the end point of each first line segment and the circle center.
In one embodiment, the data processing module is further configured to:
coding two-dimensional code information to be filled to obtain a binary sequence;
taking every four information filling sub lattices in the field character lattices as an information storage unit, and sequentially filling all binary digits in the binary sequence into the information storage unit to obtain a temporary code;
And carrying out mask processing on the temporary code to obtain the two-dimensional code.
In one embodiment, the apparatus for generating a two-dimensional code further includes a positioning mark setting module, where the positioning mark setting module is configured to:
and aiming at three adjacent angles of the pentagram outer frame, respectively determining a first circle center on a connecting line between the vertex of the angle and the central point of the pentagram outer frame, respectively adopting a first radius as a third circle, and performing color filling on each third circle to obtain a positioning mark.
In one embodiment, the data processing module is further configured to:
determining a starting information storage unit filled by the binary sequence based on the positioning mark;
filling binary digits in the binary sequence into the information storage unit in sequence from the initial information storage unit;
in the process of filling the binary digits in the binary sequence into the information storage unit, when the binary digits are 1, the information storage unit is filled with a first color, and when the binary digits are 0, the information storage unit is filled with a second color, so that a temporary code is obtained.
In one embodiment, the two-dimensional code includes an avatar placement area, the apparatus for generating a two-dimensional code further includes an avatar placement area setting module, and the avatar placement area setting module is configured to:
And taking the area in the circle with the smallest radius in the plurality of circles as the head portrait placing area.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing the following steps when executing the computer program:
taking the central point of the pentagram outer frame as a circle center, and making a plurality of circles by adopting different radiuses;
sub-lattice segmentation is carried out on the plurality of circumferences, and a plurality of sub-lattices are obtained in the pentagram outer frame;
taking every four circumferences as a group in the direction from the outer ring to the inner ring in the pentagram outer frame, determining sub lattices in a ring formed by the two innermost circumferences as separating sub lattices, and determining sub lattices in the two rings formed by the three outermost circumferences as information filling sub lattices;
and performing data filling in the information filling sub-lattice to obtain the two-dimensional code.
In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
taking the central point of the pentagram outer frame as a circle center, and making a plurality of circles by adopting different radiuses;
Sub-grid segmentation is carried out on the plurality of circumferences, and a plurality of sub-grids are obtained in the five-pointed star outer frame;
taking every four circumferences as a group in the direction from the outer ring to the inner ring in the pentagram outer frame, determining sub lattices in a ring formed by the two innermost circumferences as separating sub lattices, and determining sub lattices in the two rings formed by the three outermost circumferences as information filling sub lattices;
and filling data in the information filling sub-lattices to obtain the two-dimensional code.
In a fifth aspect, the present application further provides a computer program product. The computer program product comprising a computer program which when executed by a processor performs the steps of:
taking the central point of the pentagram outer frame as a circle center, and making a plurality of circles by adopting different radiuses;
sub-lattice segmentation is carried out on the plurality of circumferences, and a plurality of sub-lattices are obtained in the pentagram outer frame;
taking every four circumferences as a group in the direction from the outer ring to the inner ring in the pentagram outer frame, determining sub lattices in a ring formed by the two innermost circumferences as separating sub lattices, and determining sub lattices in the two rings formed by the three outermost circumferences as information filling sub lattices;
and performing data filling in the information filling sub-lattice to obtain the two-dimensional code.
According to the method and the device for generating the two-dimensional code, the two-dimensional code is provided with a five-pointed star outer frame, and a plurality of circumferences are formed by taking a central point of the five-pointed star outer frame as a circle center and adopting different radiuses; sub-grid segmentation is carried out on the plurality of circumferences, and a plurality of sub-grids are obtained in the pentagram outer frame; taking every four circumferences as a group in the direction from the outer ring to the inner ring in the pentagram outer frame, determining sub lattices in a ring consisting of the innermost two circumferences as separating sub lattices, and determining sub lattices in two rings consisting of the outermost three circumferences as information filling sub lattices; and filling data in the information filling sub-lattices to obtain the two-dimensional code. The application provides a method and a device for generating a two-dimensional code, which can generate a pentagram-shaped two-dimensional code, enriches the generation mode of the two-dimensional code and the pattern of the two-dimensional code, and can be applied to the scene in which the square two-dimensional code is applied and the scene in which the square two-dimensional code cannot be applied, for example: the method is suitable for scenes of five-pointed star areas in the seal, so that the application scene range is wider, and the applicability of the two-dimensional code is improved.
Drawings
Fig. 1 is a schematic flowchart of a method for generating a two-dimensional code in an embodiment of the present application.
FIG. 2 is a schematic diagram of a plurality of circles within the pentagram outer frame in an embodiment of the present application.
Fig. 3 is a schematic flow chart of step 102 in an embodiment of the present application.
Fig. 4 is a schematic diagram of a method for generating a two-dimensional code in an embodiment of the present application.
Fig. 5 is a schematic flow chart of step 106 in an embodiment of the present application.
Fig. 6 is a schematic diagram of a template code when a mask process is performed according to an embodiment of the present application.
Fig. 7 is a schematic diagram of a two-dimensional code according to an embodiment of the present application.
Fig. 8 is a schematic diagram of a method for generating a two-dimensional code in an embodiment of the present application.
Fig. 9 is a flowchart illustrating step 502 according to an embodiment of the present application.
Fig. 10 is a schematic diagram of a two-dimensional code according to an embodiment of the present application.
Fig. 11 is a schematic diagram of a two-dimensional code generation apparatus according to an embodiment of the present application.
Fig. 12 is an internal structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
In one embodiment, as shown in fig. 1, a method for generating a two-dimensional code is provided, where the two-dimensional code has a five-pointed star outer frame. The embodiment is illustrated by applying the method to a terminal, and it can be understood that the method can also be applied to a server, and can also be applied to a system comprising the terminal and the server, and is implemented by interaction between the terminal and the server. In this embodiment, the method includes the steps of:
And step 100, taking the central point of the pentagram outer frame as a circle center, and adopting different radiuses to make a plurality of circles.
For example, the sides of the five-pointed star frame are equal, and the degrees of each corner are equal. The radii of the plurality of circles decrease at a fixed unit distance in a direction from the outer ring to the inner ring within the pentagram outer frame.
Illustratively, referring to fig. 2, the center point O of the pentagram frame is the center of the circle, and the difference between the radii of the circumscribed circle a and the inscribed circle b of the pentagram frame is d. That is, the distance between the vertex of each corner of the pentagram outer frame and the point where the connection between the vertex of the corner and the center of the circle intersects the inscribed circle, that is, the length of the line segment CD in fig. 2 is d. A point P is selected on the segment CD, the length of the segment CP is 0.4d, and the length of the segment PD is 0.6 d. The length of the line segment PD is divided into 14 parts on average, and the fixed unit distance w is 0.6 d/14. And taking the central point O of the pentagram outer frame as the center of a circle and the length of the line segment PO as the radius to form a circumference, thereby obtaining the circumference with the largest inner radius of the angle. Taking the adjacent corner of the corner where the point C is located in fig. 2 as an example, the intersection point of the circle with the largest radius in the corner and the two sides of any one corner of the outer frame of the pentagram is A, B, and the length of the circular arc AB is 0.4 tan18 ° (0.4 tan18 ° (14/0.6) × w) (6 w). And (3) sequentially decreasing the radius from the length of the line segment PO by a fixed unit distance w by taking the point O as a circle center, making a plurality of circles until the circles coincide with the inscribed circle b, and then sequentially decreasing the radius from the radius of the inscribed circle b by a fixed unit distance w by taking the point O as a circle center to make three circles. There are 17 circles in the five-pointed star frame.
And 102, carrying out sub-lattice segmentation on the plurality of circumferences to obtain a plurality of sub-lattices in the pentagram outer frame.
The sub-lattices can be cut by using line segments in the five-pointed star outer frame to divide the plurality of circumferences into a plurality of small lattices, so that a plurality of sub-lattices are obtained. After obtaining a plurality of sub-lattices in the pentagram outer frame, the parts of the plurality of circumferences outside the pentagram outer frame can be deleted.
And step 104, taking every four circles as a group in the direction from the outer ring to the inner ring in the pentagram outer frame, determining sub lattices in the ring formed by the innermost two circles as separating sub lattices, and determining sub lattices in the two rings formed by the outermost three circles as information filling sub lattices.
The direction from the outer ring to the inner ring in the pentagram outer frame is the direction from the circumscribed circle a to the inscribed circle b in fig. 2. Taking four circles starting from the circle with the largest radius in the corner (i.e., the circle where the point P is located) as an example, the sub-lattices in the two rings formed by the outermost three circles including the circle where the point P is located are information filling sub-lattices, and the sub-lattices in the ring formed by the innermost two circles are separating sub-lattices. The padding subgrid is an area that can be used to pad the two-dimensional code information. The separator sub-lattice is not used to fill the two-dimensional code information.
And 106, filling data in the information filling sub-lattices to obtain the two-dimensional code.
And the data filled in the information filling sub-lattice is a two-dimensional code sequence obtained after the two-dimensional code information to be filled into the two-dimensional code is coded. Each set of two-dimensional code sequences consists of 8 binary digits. And filling the sub-lattices according to different binary digit filling information to obtain the two-dimensional code.
According to the two-dimensional code generation method, the two-dimensional code is provided with a pentagram outer frame, and a plurality of circumferences are made by taking a central point of the pentagram outer frame as a circle center and adopting different radiuses; carrying out sub-lattice segmentation on the plurality of circumferences to obtain a plurality of sub-lattices in the pentagram outer frame; taking every four circumferences as a group in the direction from the outer ring to the inner ring in the pentagram outer frame, determining sub lattices in a ring formed by the innermost two circumferences as separating sub lattices, and determining sub lattices in two rings formed by the outermost three circumferences as information filling sub lattices; and filling data in the information filling sub-lattice to obtain the two-dimensional code. The generation method of the two-dimensional code provided in the embodiment of the application can generate the pentagram-shaped two-dimensional code, enriches the generation mode of the two-dimensional code and the pattern of the two-dimensional code, and is suitable for not only the scene in which the square two-dimensional code is applied but also the scene in which the square two-dimensional code cannot be applied, for example: the method is suitable for the scene of the five-pointed star region in the seal, so that the application scene range is wider, and the applicability of the two-dimensional code is improved.
In one embodiment, the plurality of circles includes a first circle and a second circle, the first circle having a radius greater than a radius of the second circle. In step 102, as shown in fig. 3, sub-grid segmentation is performed on the plurality of circumferences to obtain a plurality of sub-grids within the five-pointed star outer frame, including:
step 300, aiming at any corner of the pentagram outer frame, performing sub-lattice segmentation on the first circumference based on a plurality of parallel first line segments with equal intervals to obtain a plurality of sub lattices, wherein the starting point of one of the first line segments is the central point of the first circular arc, the end point is the intersection point of the second line segment and the first circumference with the minimum radius, the second line segment is the line segment formed by the central point of the first circular arc and the circle center, and the first circular arc corresponds to the first circumference with the maximum inner radius of the corner.
For example, referring to fig. 4, the first circle with the largest corner inner radius is the circle where the point P is located, the first arc is the arc AB, and the central point of the first arc is the point P. The second line segment is a line segment OP formed by the center point P and the circle center O of the first circular arc. The first circumference with the smallest radius is the second circumference in the direction from the inner ring to the outer ring in the pentagram outer frame. The intersection of the second line segment and the first circle of smallest radius is point E. The starting point of one of the first line segments is point P and the end point is point E. The line segment PE is a first line segment. And taking the fixed unit distance w as a distance, and making a plurality of line segments parallel to the line segment PE to obtain a plurality of first line segments. At any angle of the pentagram outer frame, a plurality of first line segments are intersected and cut with the first circumference, so that a plurality of sub lattices can be obtained.
And 302, performing sub-lattice segmentation on the second circumference based on a plurality of third line segments to obtain a plurality of sub-lattices, wherein the starting point of each third line segment is the end point of each first line segment, the end point of each third line segment is the intersection point of each fourth line segment and the second circumference with the smallest radius, and each fourth line segment is the line segment formed by the end point of each first line segment and the circle center.
Illustratively, referring to FIG. 4, the second circle of smallest radius is the first circle c in the pentagram outer frame in the direction from the inner ring to the outer ring. Taking the first line segment with the end point as the point E as an example, the fourth line segment with the end point of the first line segment as the start point is the line segment EO. The intersection F of the line segment EO and the circumference c is the end point of one of the third line segments, and the starting point of the third line segment is the point E, i.e. the line segment ED is one of the third line segments. The method of the other line segments in the third line segment is the same as the method of the line segment ED, and is not described herein again.
And the third line segments are used for carrying out sub-lattice segmentation on the second circumference to obtain a plurality of sub-lattices. The interval of the plurality of sub lattices is w. At this time, the first circumference is all the circumferences (including the circumference at the point P and the circumference at the point E) from the circumference at the point P to the circumference at the point E, and the second circumference is the circumference at the point F, and obviously, the radius of the first circumference is larger than that of the second circumference.
It should be noted that the second circumference may include 1, 2, or 3 circumferences in the direction from the inner ring to the outer ring in the pentagram outer frame, and the second circumference is not specifically limited in this embodiment of the application.
In one embodiment, as shown in fig. 5, in step 106, performing data filling in the information filling sub-lattice to obtain a two-dimensional code, including:
and 500, coding the two-dimension code information to be filled to obtain a binary sequence.
In the embodiment of the present disclosure, the two-dimension code information of the two-dimension code generated by the computer may be numbers, letters, symbols, binary information, and the like. And determining the coding format according to the data type of the two-dimensional code information to be filled. For example, if the two-dimensional Code Information is both numeric and alphabetical, the two-dimensional Code Information is coded by ASCII (American Standard Code for Information exchange) to obtain a binary sequence, and if the two-dimensional Code Information includes chinese characters, etc., the two-dimensional Code Information is coded by UTF8 (8-bit, Universal Character Set/Universal Transformation Format) to obtain a binary sequence. The coded binary sequence takes 8 binary digits as a group, and if the number of the binary digits is less than 8, 0 is complemented. The two-dimensional Code may be implemented by introducing a reed-solomon error correction algorithm, and the implementation scheme of the error correction Code is consistent with the error correction Code of the existing QR Code (Quick Response Code, fast Response matrix graph Code), which is not described in detail in this application. The binary sequence after the introduction of the error correction code cannot exceed 20 groups. After the two-dimensional code information is coded, at most 20 groups of binary sequences are obtained, and if the number of the binary sequences is less than 20, the following two bytes are repeated: 11101100 and 00010001, until the two-dimension code information is coded to obtain 20 groups of binary sequences.
And 502, taking every four information filling sub-lattices in the field-character lattice as an information storage unit, and sequentially filling all binary digits in the binary sequence into the information storage unit to obtain the temporary code.
Wherein one information storage unit is filled with one binary digit. Different color blocks are filled in the information storage unit according to the difference of the binary digits. Every four information filling sub-lattices in the field-shaped lattice form one information storage unit, and a row of separating sub-lattices can be arranged between every two rows of information storage units, so that the information in the generated two-dimensional code is easier to read. It can be understood that the pentagonal frame is filled with color blocks in a grid pattern, the upper and lower layers of color blocks are separated by a ring (i.e. a row of separating sub-grid is separated between every two rows of information storage units), and each corner of the pentagonal frame (from the vertex of the corner to the inscribed circle b) can be filled with five layers of color blocks, and the number of each layer of information storage units is 3, 4, 5, 6 and 7 in sequence. In the area inside the pentagram frame but below each corner (from the inscribed circle b to the circle with the smallest radius inside the pentagram frame), one layer of color blocks may be filled, 7 color blocks may be filled in each layer (that is, the number of information storage units in each layer is 7), and 160 color blocks may be filled in the pentagram frame in total.
And sequentially filling all binary digits in the binary sequence into the information storage unit to obtain the temporary code. The time code is a two-dimensional code obtained after the two-dimensional code information is filled in all the information storage units in sequence. Temporary codes may have large areas of connected color blocks or spaces.
And step 504, performing mask processing on the temporary code to obtain a two-dimensional code.
Wherein, the Masking (Masking) process is an exclusive or (XOR) process of the temporary code by using the template code. The template code is shown in fig. 6, and the two-dimensional code finally obtained after the mask processing is performed by using the template code is shown in fig. 7. Exclusive-or (XOR) processing is to compare information storage units at the same position in the template code and the temporary code, and if binary digits filled in the information storage units of the template code and the temporary code are the same, the binary digits are 0, and if the binary digits are different, the binary digits are 1. For example, if the binary number filled in one information storage unit in the temporary code is 0, and the color of the filling is white (i.e., the filling is not performed), and if the binary number filled in the information storage unit at the same position in the template code is 1, and the color of the filling is black, the binary number filled in the information storage unit of the finally obtained two-dimensional code is 1, and the color of the filling is black. Or, if the binary digits filled in the information storage units at the same position in the template code are 0 and the color of the filling is white, the binary digits filled in the information storage units of the finally obtained two-dimensional code are 0 and the color of the filling is white. And removing the sub lattices and the circumferential lines of the finally obtained image through the mask processing to obtain the two-dimensional code. The mask processing avoids the two-dimensional code from generating large-area connected color blocks or blanks.
In one embodiment, the method for generating a two-dimensional code further includes:
and aiming at three adjacent angles of the pentagram outer frame, respectively determining a first circle center on a connecting line between the vertex of the angle and the central point of the pentagram outer frame, respectively adopting a first radius as a third circumference, and filling colors in each third circumference to obtain the positioning mark.
For example, referring to fig. 8, in the middle angular position column, the line connecting the vertex of the corner and the center point of the pentagram outer frame is a line segment OC. A point G which is 0.3d away from the vertex C in the line segment OC is taken as a first circle center, and the first radius is 2 w. And taking the point G as the center of a circle, and making a circle with the radius of 2w as a third circle. Color filling each third circumference may result in a location mark.
The color of the third circumferential filling is not specifically limited, and the color of the third circumferential filling is different from the bottom color in the pentagram outer frame. The setting mode of the positioning marks in the other two corners of the adjacent three corners of the pentagram outer frame can be referred to the above mode, and details are not repeated in the embodiment of the application. The positioning marks in three adjacent corners of the pentagram outer frame can be used for positioning and marking the two-dimensional code.
In one embodiment, as shown in fig. 9, in step 502, sequentially filling each binary digit in the binary sequence into the information storage unit to obtain the time code, including:
step 900, based on the positioning mark, determining the start information storage unit filled by the binary sequence.
Wherein, three positioning marks are located in three adjacent corners of the five-pointed star outer frame, for example, as shown in fig. 8. And taking the middle corner as a starting corner and taking the information storage unit at the upper left corner in the starting corner as a starting information storage unit.
And step 902, filling the binary digits in the binary sequence into the information storage unit in sequence from the initial information storage unit.
Illustratively, referring to fig. 8, starting from the start information storage unit, information storage units in the row where the start information storage unit is located are filled with binary digits in a binary sequence from left to right. And after the filling of the information storage units in the row is finished, skipping the separation sub-lattices, sequentially filling from left to right from the leftmost information storage unit in the next row until all the information storage units in the corner where the initial information storage unit is located are filled, repeating the process in the second corner clockwise, and sequentially filling all the information storage units in the five corners of the five-pointed star outer frame.
Step 904, in the process of filling the binary digits in the binary sequence into the information storage unit, when the binary digit is 1, the information storage unit is filled with the first color, and when the binary digit is 0, the information storage unit is filled with the second color, so as to obtain the temporary code.
Illustratively, the bottom color inside the pentagram outer frame is white, the first color is black, the second color is white, and the positioning mark filling color is black. After the two-dimensional code information is coded, 20 groups of binary sequences are obtained, and the total number of the binary sequences is 160 binary digits. When the binary number filled in the information storage unit is 1, the information storage unit is filled with black, and when the binary number filled in the information storage unit is 0, the information storage unit is filled with white (or the information storage unit is not filled with the white), namely the information storage unit appears white). According to the filling sequence, filling is started from the initial information storage unit until all the information storage units in the pentagram outer frame are filled with 160 binary digits, and the time code is obtained. The two-dimensional code obtained by masking the temporary code is a pentagram-shaped starry two-dimensional code as shown in fig. 7.
The inner bottom color of the outer frame of the five-pointed star is red, the first color can also be white, the second color is red, and the filling color of the positioning mark is white. When the binary number filled in the information storage unit is 1, the information storage unit is filled with white, and when the binary number filled in the information storage unit is 0, the information storage unit is filled with red (or the information storage unit is not filled with red, namely the information storage unit is red). According to the filling sequence, filling is started from the initial information storage unit until all the information storage units in the pentagram outer frame are filled with 160 binary digits, and a time code is obtained. The two-dimensional code obtained by masking the temporary code is a pentagram-shaped yin two-dimensional code as shown in fig. 10. The yin-language two-dimensional code is more beautiful compared with the yang-language two-dimensional code.
The method for generating the two-dimensional code in the embodiment of the application can generate the pentagram-shaped two-dimensional code, so that the generation mode of the two-dimensional code and the pattern of the two-dimensional code are enriched, and the pentagram-shaped two-dimensional code can be suitable for not only a scene in which the square two-dimensional code is applied, but also a scene in which the square two-dimensional code cannot be applied, for example: the seal is suitable for scenes of five-pointed star areas in the seal, the seal can be combined, and in some certification business scenes, such as deposit certification, transaction certificates, contracts and other scenes, information related to the business scenes is added through the two-dimensional code on the premise of not influencing the overall attractiveness of the seal, so that the characteristic of being not falsifiable is improved. Therefore, the application scene range is wider, and the applicability of the two-dimensional code is improved.
It should be noted that, in the embodiment of the present application, the first color and the second color are not specifically limited, and all the methods that can generate the two-dimensional code of the present application are applicable to the embodiment of the present application.
Illustratively, the reading method of the two-dimensional code in the embodiment of the present application is an inverse operation of the two-dimensional code generation method. Firstly, reverse mask processing is carried out, namely, the two-dimensional code image is subjected to exclusive OR processing again, the two-dimensional code is restored into a temporary code, and a binary sequence in the information storage unit is obtained. And removing the complementary codes, namely removing the bytes supplemented by less than 20 groups of binary sequences after the original two-dimensional code information is coded and 0 supplemented by less than eight-bit binary digits in the binary sequences. And reading the information of the two-dimensional code, and verifying and correcting the information by combining with an error correcting code in the reading process to finally obtain a correct binary sequence of the two-dimensional code. And decoding the correct binary sequence of the two-dimension code to obtain the original information of the two-dimension code to be filled.
In one embodiment, the two-dimensional code includes an avatar placement area. The method for generating the two-dimensional code further comprises the following steps:
and taking the area in the circle with the smallest radius in the plurality of circles as an avatar placement area.
Wherein the area in the circle with the smallest radius does not contain the information filling sub-lattice and the separating sub-lattice. This area is a blank circular area as an avatar placement area. The avatar placement area may be used for placement of avatars, pictures or trademarks LOGO, etc.
The application also provides a two-dimensional code. The two-dimensional code comprises a pentagram outer frame. The five-pointed star outer frame comprises an information filling sub-lattice and a separating sub-lattice, and a row of separating sub-lattices is arranged between every two rows of the information filling sub-lattices. The information padding sub-lattice is used to pad data.
In the embodiment of the present application, the specific structure of the two-dimensional code may be obtained by referring to the related description of the foregoing embodiment, and details are not repeated in the embodiment of the present application.
The two-dimensional code that this application embodiment provided includes the pentagram frame. The five-pointed star outer frame comprises an information filling sub-lattice and a separating sub-lattice, and a row of separating sub-lattices is arranged between every two rows of the information filling sub-lattices. The information padding sub-lattice is used to pad data. The two-dimensional code that this application embodiment provided is the two-dimensional code of pentagram form, has richened the mode of generation of two-dimensional code and the pattern of two-dimensional code, because the scene that square two-dimensional code used not only can be applicable to the two-dimensional code of pentagram form, can also be applicable to the scene that square two-dimensional code can't be suitable for, for example: the method is suitable for the scene of the five-pointed star region in the seal, so that the application scene range is wider, and the applicability of the two-dimensional code is improved. Based on the same inventive concept, the application also provides a two-dimensional code generation device for realizing the two-dimensional code generation method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so specific limitations in one or more embodiments of the two-dimensional code generation device provided below can refer to the limitations in the above two-dimensional code generation method, and details are not described here.
In one embodiment, referring to fig. 11, a two-dimensional code generation apparatus 1100 is provided, the two-dimensional code having a five-pointed star outer frame. The two-dimensional code generation device 1100 includes: a circumference dividing module 1101, a cutting module 1102 and a data processing module 1103, wherein:
the circumference dividing module 1101 is configured to use a center point of the pentagram outer frame as a center of a circle and adopt different radii to form a plurality of circumferences.
The cutting module 1102 is configured to perform sub-lattice cutting on the multiple circumferences to obtain multiple sub-lattices in the pentagram outer frame, determine sub-lattices in a ring formed by the two innermost circumferences as separating sub-lattices in the pentagram outer frame in a direction from the outer ring to the inner ring, and determine sub-lattices in two rings formed by the three outermost circumferences as information filling sub-lattices.
And the data processing module 1103 is configured to perform data filling in the information filling sub-lattice to obtain the two-dimensional code.
In the two-dimensional code generation device, the circumference division module is used for making a plurality of circumferences with different radiuses by taking the central point of the pentagram outer frame as the center of a circle; the cutting module is used for carrying out sub-lattice cutting on the plurality of circumferences to obtain a plurality of sub-lattices in the pentagram outer frame; and the data processing module is used for carrying out data filling in the information filling sub-lattice to obtain the two-dimensional code. The generation device of two-dimensional code that this application embodiment provided can generate the two-dimensional code of pentagram form, has richened the mode of generation of two-dimensional code and the pattern of two-dimensional code, because the scene that square two-dimensional code used not only can be applicable to the two-dimensional code of pentagram form, can also be applicable to the scene that square two-dimensional code can't be suitable for, for example: the method is suitable for the scene of the five-pointed star region in the seal, so that the application scene range is wider, and the applicability of the two-dimensional code is improved.
In one embodiment, the plurality of circles includes a first circle and a second circle, the first circle having a radius greater than a radius of the second circle. The segmentation module 1102 is further configured to perform sub-lattice segmentation on a circumference based on a plurality of parallel first line segments with equal intervals for any angle of the pentagram outer frame to obtain a plurality of sub-lattices, where a starting point of one of the first line segments is a central point of the first arc, an end point is an intersection point of the second line segment and the first circumference with the smallest radius, the second line segment is a line segment formed by the central point of the first arc and a circle center, and the first arc corresponds to the first circumference with the largest inner radius of the angle. The segmentation module 1102 is further configured to perform sub-lattice segmentation on the second circumference based on a plurality of third line segments to obtain a plurality of sub-lattices, where a starting point of each third line segment is an end point of each first line segment, an end point of each third line segment is an intersection point of each fourth line segment and the second circumference with the smallest radius, and each fourth line segment is a line segment formed by the end point of each first line segment and the circle center.
In one embodiment, the data processing module 1103 is further configured to encode the two-dimensional code information to be padded to obtain a binary sequence; taking every four information filling sub lattices in the field character lattice as an information storage unit, and sequentially filling all binary digits in the binary sequence into the information storage unit to obtain a temporary code; and carrying out mask processing on the temporary code to obtain the two-dimensional code.
In one embodiment, the apparatus for generating a two-dimensional code further comprises a positioning mark setting module. The positioning mark setting module is used for determining a first circle center on a connecting line between the vertex of the corner and the central point of the pentagram outer frame aiming at three adjacent corners of the pentagram outer frame, respectively adopting a first radius as a third circle, and filling colors in each third circle to obtain the positioning mark.
In one embodiment, the data processing module 1103 is further configured to determine a start information storage unit filled with the binary sequence based on the positioning mark; filling binary digits in a binary sequence into the information storage units in sequence from the initial information storage unit; in the process of filling the binary digits in the binary sequence into the information storage unit, when the binary digit is 1, the information storage unit is filled with a first color, and when the binary digit is 0, the information storage unit is filled with a second color, so that the temporary code is obtained.
In one embodiment, the two-dimensional code comprises an avatar placement area, and the generation device of the two-dimensional code further comprises an avatar placement area setting module. The head portrait placement area setting module is used for taking an area in a circle with the smallest radius in the plurality of circles as a head portrait placement area.
All or part of the modules in the two-dimensional code generation device can be realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent of a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 12. The computer device comprises a processor, a memory, a communication interface, a display screen and an input device which are connected through a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a method of generating a two-dimensional code. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 12 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided. The computer device comprises a memory and a processor, the memory stores a computer program, and the processor realizes the following steps when executing the computer program:
taking the central point of the pentagram outer frame as the center of a circle and adopting different radiuses to make a plurality of circumferences;
carrying out sub-lattice segmentation on the plurality of circumferences to obtain a plurality of sub-lattices in the pentagram outer frame;
taking every four circumferences as a group in the direction from the outer ring to the inner ring in the pentagram outer frame, determining sub lattices in a ring formed by the innermost two circumferences as separating sub lattices, and determining sub lattices in two rings formed by the outermost three circumferences as information filling sub lattices;
and filling data in the information filling sub-lattice to obtain the two-dimensional code.
In one embodiment, the processor, when executing the computer program, further performs the steps of: the plurality of circles includes a first circle and a second circle, the first circle having a radius greater than a radius of the second circle. Aiming at any angle of the pentagram outer frame, carrying out sub-lattice segmentation on a first circumference based on a plurality of first line segments which are parallel and have equal intervals to obtain a plurality of sub lattices, wherein the starting point of one of the first line segments is the central point of a first circular arc, the end point is the intersection point of a second line segment and the first circumference with the smallest radius, the second line segment is the line segment formed by the central point of the first circular arc and the circle center, and the first circular arc corresponds to the first circumference with the largest inner radius of the angle; and performing sub-lattice segmentation on the second circumference based on a plurality of third line segments to obtain a plurality of sub-lattices, wherein the starting point of each third line segment is the end point of each first line segment, the end point of each third line segment is the intersection point of each fourth line segment and the second circumference with the smallest radius, and each fourth line segment is the line segment formed by the end point of each first line segment and the circle center.
In one embodiment, the processor, when executing the computer program, further performs the steps of: coding two-dimensional code information to be filled to obtain a binary sequence; taking every four information filling sub lattices in the field character lattice as an information storage unit, and sequentially filling all binary digits in the binary sequence into the information storage unit to obtain a temporary code; and carrying out mask processing on the temporary code to obtain the two-dimensional code.
In one embodiment, the processor, when executing the computer program, further performs the steps of: and aiming at three adjacent angles of the pentagram outer frame, respectively determining a first circle center on a connecting line between the vertex of the angle and the central point of the pentagram outer frame, respectively adopting a first radius as a third circle, and carrying out color filling on each third circle to obtain the positioning mark.
In one embodiment, the processor, when executing the computer program, further performs the steps of: determining a start information storage unit filled by the binary sequence based on the positioning mark; filling binary digits in a binary sequence into the information storage units in sequence from the initial information storage unit; in the process of filling the binary digits in the binary sequence into the information storage unit, when the binary digit is 1, the information storage unit is filled with a first color, and when the binary digit is 0, the information storage unit is filled with a second color, so that the temporary code is obtained.
In one embodiment, the processor when executing the computer program further performs the steps of: the two-dimensional code includes an avatar placement region, and a region in a circle with a smallest radius among the plurality of circles is used as the avatar placement region.
In one embodiment, a computer-readable storage medium is provided. A computer-readable storage medium on which a computer program is stored which, when executed by a processor, performs the steps of:
taking the central point of the pentagram outer frame as the center of a circle and adopting different radiuses to make a plurality of circumferences;
sub-grid segmentation is carried out on the plurality of circumferences, and a plurality of sub-grids are obtained in the pentagram outer frame;
taking every four circumferences as a group in the direction from the outer ring to the inner ring in the pentagram outer frame, determining sub lattices in a ring formed by the innermost two circumferences as separating sub lattices, and determining sub lattices in two rings formed by the outermost three circumferences as information filling sub lattices;
and filling data in the information filling sub-lattice to obtain the two-dimensional code.
In one embodiment, the computer program when executed by the processor further performs the steps of: the plurality of circles includes a first circle and a second circle, the first circle having a radius greater than a radius of the second circle. Aiming at any angle of the pentagram outer frame, carrying out sub-lattice segmentation on a first circumference based on a plurality of first line segments which are parallel and have equal intervals to obtain a plurality of sub lattices, wherein the starting point of one of the first line segments is the central point of a first circular arc, the end point is the intersection point of a second line segment and the first circumference with the smallest radius, the second line segment is the line segment formed by the central point of the first circular arc and the circle center, and the first circular arc corresponds to the first circumference with the largest inner radius of the angle; and performing sub-lattice segmentation on the second circumference based on a plurality of third line segments to obtain a plurality of sub-lattices, wherein the starting point of each third line segment is the end point of each first line segment, the end point of each third line segment is the intersection point of each fourth line segment and the second circumference with the smallest radius, and each fourth line segment is the line segment formed by the end point of each first line segment and the circle center.
In one embodiment, the computer program when executed by the processor further performs the steps of: coding the two-dimension code information to be filled to obtain a binary sequence; taking every four information filling sub lattices in the form of field character lattices as an information storage unit, and sequentially filling all binary digits in the binary sequence into the information storage unit to obtain a temporary code; and carrying out mask processing on the temporary code to obtain the two-dimensional code.
In one embodiment, the computer program when executed by the processor further performs the steps of: and aiming at three adjacent angles of the pentagram outer frame, respectively determining a first circle center on a connecting line between the vertex of the angle and the central point of the pentagram outer frame, respectively adopting a first radius as a third circle, and carrying out color filling on each third circle to obtain the positioning mark.
In one embodiment, the computer program when executed by the processor further performs the steps of: determining a start information storage unit filled by the binary sequence based on the positioning mark; filling binary digits in a binary sequence into the information storage units in sequence from the initial information storage unit; in the process of filling the binary digits in the binary sequence into the information storage unit, when the binary digit is 1, the information storage unit is filled with a first color, and when the binary digit is 0, the information storage unit is filled with a second color, so that the temporary code is obtained.
In one embodiment, the computer program when executed by the processor further performs the steps of: the two-dimensional code includes an avatar placement region, and a region in a circle with a smallest radius among the plurality of circles is used as the avatar placement region.
In one embodiment, a computer program product is provided. Computer program product comprising a computer program which when executed by a processor performs the steps of:
taking the central point of the pentagram outer frame as the center of a circle and adopting different radiuses to make a plurality of circumferences;
carrying out sub-lattice segmentation on the plurality of circumferences to obtain a plurality of sub-lattices in the pentagram outer frame;
taking every four circumferences as a group in the direction from the outer ring to the inner ring in the pentagram outer frame, determining sub lattices in a ring formed by the innermost two circumferences as separating sub lattices, and determining sub lattices in two rings formed by the outermost three circumferences as information filling sub lattices;
and filling data in the information filling sub-lattice to obtain the two-dimensional code.
In one embodiment, the computer program when executed by the processor further performs the steps of: the plurality of circles includes a first circle and a second circle, the first circle having a radius greater than a radius of the second circle. Aiming at any angle of the pentagram outer frame, carrying out sub-grid segmentation on a first circumference based on a plurality of parallel first line segments with equal intervals to obtain a plurality of sub-grids, wherein the starting point of one of the first line segments is the central point of a first circular arc, the end point is the intersection point of a second line segment and the first circumference with the smallest radius, the second line segment is the line segment formed by the central point of the first circular arc and the circle center, and the first circular arc corresponds to the first circumference with the largest radius in the angle; and performing sub-lattice segmentation on the second circumference based on a plurality of third line segments to obtain a plurality of sub-lattices, wherein the starting point of each third line segment is the end point of each first line segment, the end point of each third line segment is the intersection point of each fourth line segment and the second circumference with the smallest radius, and each fourth line segment is the line segment formed by the end point of each first line segment and the circle center.
In one embodiment, the computer program when executed by the processor further performs the steps of: coding two-dimensional code information to be filled to obtain a binary sequence; taking every four information filling sub lattices in the field character lattice as an information storage unit, and sequentially filling all binary digits in the binary sequence into the information storage unit to obtain a temporary code; and carrying out mask processing on the temporary code to obtain the two-dimensional code.
In one embodiment, the computer program when executed by the processor further performs the steps of: and aiming at three adjacent angles of the pentagram outer frame, respectively determining a first circle center on a connecting line between the vertex of the angle and the central point of the pentagram outer frame, respectively adopting a first radius as a third circle, and carrying out color filling on each third circle to obtain the positioning mark.
In one embodiment, the computer program when executed by the processor further performs the steps of: determining a start information storage unit filled by the binary sequence based on the positioning mark; filling binary digits in a binary sequence into the information storage units in sequence from the initial information storage unit; in the process of filling the binary digits in the binary sequence into the information storage unit, when the binary digit is 1, the information storage unit is filled with a first color, and when the binary digit is 0, the information storage unit is filled with a second color, so that the temporary code is obtained.
In one embodiment, the computer program when executed by the processor further performs the steps of: the two-dimensional code includes an avatar placement region, and a region within a circle having a smallest radius among the plurality of circles is used as the avatar placement region.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high-density embedded nonvolatile Memory, resistive Random Access Memory (ReRAM), Magnetic Random Access Memory (MRAM), Ferroelectric Random Access Memory (FRAM), Phase Change Memory (PCM), graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others. The databases referred to in various embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing based data processing logic devices, etc., without limitation.
All possible combinations of the technical features of the above embodiments may not be described for the sake of brevity, but should be considered as within the scope of the present disclosure as long as there is no contradiction between the combinations of the technical features.
The above-described examples merely represent several embodiments of the present application and are not to be construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, and these are all within the scope of protection of the present application. Therefore, the protection scope of the present patent application shall be subject to the appended claims.

Claims (10)

1. A method for generating a two-dimensional code is characterized in that the two-dimensional code has a five-pointed star outer frame, and the method comprises the following steps:
taking the central point of the pentagram outer frame as a circle center, and adopting different radiuses to make a plurality of circumferences;
sub-lattice segmentation is carried out on the plurality of circumferences, and a plurality of sub-lattices are obtained in the pentagram outer frame;
taking every four circumferences as a group in the direction from the outer ring to the inner ring in the pentagram outer frame, determining sub lattices in a ring formed by the two innermost circumferences as separating sub lattices, and determining sub lattices in the two rings formed by the three outermost circumferences as information filling sub lattices;
And performing data filling in the information filling sub-lattice to obtain the two-dimensional code.
2. The method for generating two-dimensional code according to claim 1, wherein the plurality of circles include a first circle and a second circle, a radius of the first circle is larger than a radius of the second circle, the sub-grid division is performed on the plurality of circles, and a plurality of sub-grids are obtained in the pentagram outer frame, including:
aiming at any corner of the five-pointed star outer frame, carrying out sub-lattice segmentation on the first circumference based on a plurality of first line segments which are parallel and have equal intervals to obtain a plurality of sub lattices, wherein the starting point of one of the first line segments is the central point of a first circular arc, the end point is the intersection point of a second line segment and the first circumference with the smallest radius, the second line segment is the line segment formed by the central point of the first circular arc and the circle center, and the first circular arc corresponds to the first circumference with the largest inner radius of the corner;
and performing sub-lattice segmentation on the second circumference based on a plurality of third line segments to obtain a plurality of sub-lattices, wherein the starting point of each third line segment is the end point of each first line segment, the end point of each third line segment is the intersection point of each fourth line segment and the second circumference with the smallest radius, and each fourth line segment is the line segment formed by the end point of each first line segment and the circle center.
3. The method for generating the two-dimensional code according to claim 1 or 2, wherein the performing data filling in the information filling sub-lattice to obtain the two-dimensional code includes:
coding two-dimensional code information to be filled to obtain a binary sequence;
taking every four information filling sub lattices in the field character lattices as an information storage unit, and sequentially filling all binary digits in the binary sequence into the information storage unit to obtain a temporary code;
and carrying out mask processing on the temporary code to obtain the two-dimensional code.
4. The method for generating a two-dimensional code according to claim 3, wherein the method further comprises:
and aiming at three adjacent angles of the pentagram outer frame, respectively determining a first circle center on a connecting line between the vertex of the angle and the central point of the pentagram outer frame, respectively adopting a first radius as a third circle, and performing color filling on each third circle to obtain a positioning mark.
5. The method for generating two-dimensional code according to claim 4, wherein said sequentially filling each binary digit in said binary sequence into said information storage unit to obtain a temporal code comprises:
Determining a start information storage unit filled by the binary sequence based on the positioning mark;
filling binary digits in the binary sequence into the information storage unit in sequence from the initial information storage unit;
in the process of filling the binary digits in the binary sequence into the information storage unit, when the binary digit is 1, the information storage unit is filled with a first color, and when the binary digit is 0, the information storage unit is filled with a second color, so that the temporary code is obtained.
6. The method for generating a two-dimensional code according to claim 1, wherein the two-dimensional code includes an avatar placement area, the method further comprising:
and taking the area in the circle with the smallest radius in the plurality of circles as the head portrait placement area.
7. The utility model provides a generating device of two-dimensional code, its characterized in that, the two-dimensional code has the pentagram frame, generating device includes:
the circumference dividing module is used for making a plurality of circumferences with different radiuses by taking the central point of the pentagram outer frame as a circle center;
the cutting module is used for cutting the sub lattices of the plurality of circumferences to obtain a plurality of sub lattices in the pentagram outer frame, taking every four circumferences as a group in the direction from an outer ring to an inner ring in the pentagram outer frame, determining the sub lattices in the ring formed by the two innermost circumferences as separating sub lattices, and determining the sub lattices in the two rings formed by the three outermost circumferences as information filling sub lattices;
And the data processing module is used for carrying out data filling in the information filling sub-lattices to obtain the two-dimensional code.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor realizes the steps of the method of any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, realizes the steps of the method of any one of claims 1 to 6.
CN202210262628.3A 2022-03-17 2022-03-17 Two-dimensional code generation method and device Pending CN114676805A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210262628.3A CN114676805A (en) 2022-03-17 2022-03-17 Two-dimensional code generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210262628.3A CN114676805A (en) 2022-03-17 2022-03-17 Two-dimensional code generation method and device

Publications (1)

Publication Number Publication Date
CN114676805A true CN114676805A (en) 2022-06-28

Family

ID=82074790

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210262628.3A Pending CN114676805A (en) 2022-03-17 2022-03-17 Two-dimensional code generation method and device

Country Status (1)

Country Link
CN (1) CN114676805A (en)

Similar Documents

Publication Publication Date Title
WO2018177127A1 (en) Information processing method and apparatus, and storage medium
CN107563475B (en) Two-dimensional code encoding method and device
CN103718194A (en) Design code pattern comprising information deciphered by digital device and operating system for same
CN112926715A (en) Two-dimensional code generating and decoding method, device and equipment
CN111666442B (en) Image retrieval method and device and computer equipment
CN113935354B (en) Anti-interference graph intersection point encoding and decoding method for commodity outer package
CN109614454B (en) Vector big data parallel space superposition analysis method based on MPI
WO2018210077A1 (en) Method and apparatus for generating identification code
CN112288617B (en) Information hiding and recovering method, equipment and medium based on mosaic jigsaw
CN114861847B (en) Dot matrix code construction method, dot matrix code generating and reading method, terminal and dot matrix code system
CN103927572A (en) Encoding graph block and method and device for forming lattice graph through encoding graph block
CN114676805A (en) Two-dimensional code generation method and device
CN112669418A (en) Model rendering method and device
CN113781287B (en) Watermark image processing method, watermark image processing device, electronic equipment and computer readable storage medium
CN117057385A (en) Anti-interference color lattice information encoding and decoding method for commodity outer package
CN115809469A (en) Annular two-dimensional code encoding method and decoding method
CN115001690A (en) Magic cube based encryption method, device, equipment and storage medium
CN113160028B (en) Information hiding and recovering method and equipment based on colorful character picture and storage medium
CN112418374B (en) Information code generation method
CN110287716B (en) Data storage method and device
CN103986476B (en) A kind of cascade error-correction coding method and device for D bar code
CN116842117B (en) Geous image output method based on geotools for repairing self-intersecting
CN106339975A (en) Digital image secret sharing method, restoration method and devices
CN110796136A (en) Mark and image processing method and related device
CN112183695A (en) Encoding method, encoding pattern reading method, and imaging device

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