CN109255417A - Method and apparatus for generating two dimensional code - Google Patents

Method and apparatus for generating two dimensional code Download PDF

Info

Publication number
CN109255417A
CN109255417A CN201811151568.8A CN201811151568A CN109255417A CN 109255417 A CN109255417 A CN 109255417A CN 201811151568 A CN201811151568 A CN 201811151568A CN 109255417 A CN109255417 A CN 109255417A
Authority
CN
China
Prior art keywords
mask
dimensional code
fish body
region
point
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
CN201811151568.8A
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.)
Lianshang Xinchang Network Technology Co Ltd
Original Assignee
Lianshang Xinchang Network Technology 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 Lianshang Xinchang Network Technology Co Ltd filed Critical Lianshang Xinchang Network Technology Co Ltd
Priority to CN201811151568.8A priority Critical patent/CN109255417A/en
Publication of CN109255417A publication Critical patent/CN109255417A/en
Pending legal-status Critical Current

Links

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
    • G06K19/06103Constructional details the marking being embedded in a human recognizable image, e.g. a company logo with an embedded two-dimensional code

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

The embodiment of the present application discloses the method and apparatus for generating two dimensional code.One specific embodiment of the method for generating two dimensional code includes: acquisition character string;Character string is encoded, binary array corresponding with character string is generated;Binary number in binary array is sequentially stored in the first predetermined sequence in the coding region of the Diagram of the Supreme Ultimate, two dimensional code corresponding with character string is generated, wherein the first predetermined sequence includes at least two presets.The embodiment can generate the two dimensional code of Diagram of the Supreme Ultimate pattern, to enrich the pattern of two dimensional code.

Description

Method and apparatus for generating two dimensional code
Technical field
The invention relates to field of computer technology, and in particular to the method and apparatus for generating two dimensional code.
Background technique
It is universal with smart machine, two dimensional code using more and more extensive.Two dimensional code is also known as two-dimensional bar code, and common two Dimension code is QRCode, QR full name QuickResponse, is with certain specific geometric figure according to certain rules in plane (two dimension On direction) distribution chequered with black and white shorthand numerical information figure.It is dexterously calculated using composition in code compilation The concept of " 0 " on machine internal logic basis, " 1 " bit stream, is indicated using several geometrical bodies corresponding with binary system Text numerical information.By image input device or photoelectric scanning device, the automatic reading and identification of two dimensional code may be implemented, from Hold and realizes automatic processing of information function.
However, the two dimensional code of the existing generally rectangular pattern of two dimensional code, pattern are more single.
Summary of the invention
The embodiment of the present application proposes the method and apparatus for generating two dimensional code.
In a first aspect, the embodiment of the present application provides a kind of method for generating two dimensional code, comprising: obtain character string; Character string is encoded, binary array corresponding with character string is generated;Binary number in binary array is successively deposited It stores up in the first predetermined sequence in the coding region of the Diagram of the Supreme Ultimate, generates two dimensional code corresponding with character string, wherein first is default Sequence includes at least two presets.
In some embodiments, it is encoded to character string, after generating binary array corresponding with character string, also Include: to analyze binary array, determines version corresponding with binary array and mask;Version and mask are stored in In the second predetermined sequence in coding region, wherein the second predetermined sequence includes at least two presets, and the second predetermined sequence Including preset be not overlapped with the preset that the first predetermined sequence includes.
In some embodiments, binary array is analyzed, determines version corresponding with binary array and mask, It include: to generate preset number mask in the way of recycling core;For a mask in preset number mask, one is utilized A mask carries out mask operation to binary array, obtains the corresponding mask operation of a mask as a result, a mask is corresponding Mask operation result store into two dimensional code, and count in the two dimensional code of the corresponding mask operation result of one mask of storage The number of heterochromatic point;The number of heterochromatic point in two dimensional code based on the corresponding mask operation result of storage preset number mask Mesh determines mask corresponding with binary array from preset number mask.
In some embodiments, in the coding region that the binary number in binary array is sequentially stored in the Diagram of the Supreme Ultimate The first predetermined sequence in front of, further includes: using mask corresponding with binary array to binary array carry out mask fortune It calculates;Binary number in binary array is sequentially stored in the first predetermined sequence in the coding region of the Diagram of the Supreme Ultimate, comprising: First that binary number in binary array Jing Guo mask operation is sequentially stored in the coding region of the Diagram of the Supreme Ultimate is preset In sequence.
In some embodiments, the coding region of the Diagram of the Supreme Ultimate includes fish body region, and fish body region is assembled by multiple points, The multiple points for being gathered into fish body region include preset, and preset is evenly distributed on the inside in fish body region and mutually non-conterminous.
In some embodiments, fish body region includes positive fish body region and negative fish body region, and is gathered into positive fish body region The closeness of point be lower than the closeness for being gathered into the point in negative fish body region so that the color in positive fish body region and negative fish body region Distribution has differences.
In some embodiments, the Diagram of the Supreme Ultimate further includes flake region, and flake region includes positive flake region and negative fish-eye area Domain, the closeness that flake region is assembled by multiple points, and is gathered into the point in positive flake region, which is higher than, is gathered into Yang Yutiqu The closeness of the point in domain, the closeness for being gathered into the point in negative flake region are lower than the closeness for being gathered into the point in negative fish body region.
In some embodiments, Diagram of the Supreme Ultimate box made of multiple point aggregations surrounds, wherein the four of the four edges of box A intersection point is the anchor point of two dimensional code corresponding with character string.
In some embodiments, box is square, and the multiple points for being gathered into box include anchor point.
In some embodiments, box is rounded square, and the multiple points for being gathered into box do not include anchor point, positioning Point is to carry out four intersection points after both ends extend to intersection to the four edges of box.
In some embodiments, in the coding region that the binary number in binary array is sequentially stored in the Diagram of the Supreme Ultimate The first predetermined sequence in front of, further includes: error correcting code is added in binary array.
Second aspect, the embodiment of the present application provide a kind of for generating the device of two dimensional code, comprising: acquiring unit, quilt Configuration obtains character string;Coding unit is configured to encode character string, generates binary number corresponding with character string Group;Generation unit is configured to for the binary number in binary array being sequentially stored in the coding region of the Diagram of the Supreme Ultimate In one predetermined sequence, two dimensional code corresponding with character string is generated, wherein the first predetermined sequence includes at least two presets.
The third aspect, the embodiment of the present application provide a kind of network equipment, which includes: one or more processing Device;Storage device stores one or more programs thereon;When one or more programs are executed by one or more processors, make Obtain method of the one or more processors realization as described in implementation any in first aspect.
Fourth aspect, the embodiment of the present application provide a kind of computer-readable medium, are stored thereon with computer program, should The method as described in implementation any in first aspect is realized when computer program is executed by processor.
Method and apparatus provided by the embodiments of the present application for generating two dimensional code, by being encoded to character string, from And obtain binary array corresponding with character string.By the way that the binary number in binary array is sequentially stored in the Diagram of the Supreme Ultimate In the first predetermined sequence in coding region, to generate two dimensional code corresponding with character string.The embodiment can generate too The two dimensional code of pole figure pattern, to enrich the pattern of two dimensional code.
Detailed description of the invention
By reading a detailed description of non-restrictive embodiments in the light of the attached drawings below, the application's is other Feature, purpose and high point will become more apparent upon:
Fig. 1 is that this application can be applied to exemplary system architecture figures therein;
Fig. 2 is the flow chart according to one embodiment of the method for generating two dimensional code of the application;
Fig. 3 is the flow chart according to another embodiment of the method for generating two dimensional code of the application;
Fig. 4 A is the schematic diagram for the two dimensional code that box provided by the embodiments of the present application is square;
Fig. 4 B is the schematic diagram for the two dimensional code that box provided by the embodiments of the present application is rounded square;
Fig. 5 is adapted for the structural schematic diagram for the computer system for realizing the network equipment of the embodiment of the present application.
Specific embodiment
The application is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched The specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that in order to Convenient for description, part relevant to related invention is illustrated only in attached drawing.
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phase Mutually combination.The application is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 is shown can be using the exemplary system architecture 100 of the method for generating two dimensional code of the application.
As shown in Figure 1, system architecture 100 may include the network equipment 101, network 102 and the network equipment 103.Network 102 To provide the medium of communication link between the network equipment 101 and the network equipment 103.Network 102 may include various connections Type, such as wired, wireless communication link or fiber optic cables etc..
The network equipment 101,103 can be support network connection to provide the hardware device or soft of various network services Part.When the network equipment is hardware, it can be the various electronic equipments for supporting two dimensional code to generate, including but not limited to intelligent hand Machine, tablet computer, pocket computer on knee, desktop computer and server etc..It at this moment, can be with as hardware device It is implemented as the distributed network equipment group of multiple network equipment compositions, single network equipment also may be implemented into.Work as the network equipment When for software, it may be mounted in above-mentioned cited electronic equipment.At this moment, as software, may be implemented into for example for The multiple softwares or software module of Distributed Services are provided, single software or software module also may be implemented into.It does not do and has herein Body limits.
In practice, the network equipment can be provided corresponding by installing corresponding client application or server-side application Network service.The network equipment can be presented as client after being mounted with client application in network communications.Accordingly Ground can be presented as server-side after being mounted with server-side application in network communications.
As an example, the network equipment 103 is presented as server-side, and the network equipment 101 is presented as client in Fig. 1.Tool Body, the network equipment 101, which can be, is equipped with the client that two dimensional code generates software, and it is raw that the network equipment 103 can be two dimensional code At the background server of software.The client that the background server that two dimensional code generates software can generate software from two dimensional code obtains The character string of user's input analyze etc. processing to character string, generation processing result (such as two dimension corresponding with character string Code), and processing result is fed back into the client that two dimensional code generates software.It is understood that two dimensional code generates software Client can also locally generate two dimensional code.The character string that the client that two dimensional code generates software can input user is divided The processing such as analysis, generates processing result (such as two dimensional code corresponding with character string), and shown on its screen.
It should be noted that can be by the network equipment for generating the method for two dimensional code provided by the embodiment of the present application 103 execute, and can also be executed by the network equipment 101.In the case where being executed by the network equipment 101, system architecture 100 can not The network equipment 103 is set.
It should be understood that the number of network and the network equipment in Fig. 1 is only schematical.It, can be with according to needs are realized With any number of network and the network equipment.
With continued reference to Fig. 2, it illustrates the streams according to one embodiment of the method for generating two dimensional code of the application Journey 200.This be used for generate two dimensional code method the following steps are included:
Step 201, character string is obtained.
In the present embodiment, for generating executing subject (such as the network equipment shown in FIG. 1 101 of the method for two dimensional code Or the network equipment 103) available character string.Wherein, character string can be the text being made of letter, number, symbol, Chinese character etc. This information, including but not limited to network address, address, card information, merchandise news, Transaction Information, Wi-Fi (WIreless- Fidelity, Wireless Fidelity) password etc..
In practice, when above-mentioned executing subject is hardware, server can be.At this point, server can lead to from it The terminal device of letter connection obtains the character string of user's input.In addition, above-mentioned executing subject is also possible to terminal device.At this point, The character string that the available user of terminal device inputs in the information input frame that two dimensional code generates software.
Step 202, character string is encoded, obtains binary array corresponding with character string.
In the present embodiment, above-mentioned executing subject can use binary coding mode and character string be converted to corresponding two System array.Wherein, binary array may include at least one binary number.One character string corresponds to only one binary system Array.
Step 203, the binary number in binary array is sequentially stored in the coding region of the Diagram of the Supreme Ultimate first pre- If in sequence, generating two dimensional code corresponding with character string.
In the present embodiment, above-mentioned executing subject can be by the corresponding particular geometric figure of binary number in binary array Shape is successively plotted on the first predetermined sequence in the coding region of the Diagram of the Supreme Ultimate, to generate two dimensional code corresponding with character string. Wherein, the Diagram of the Supreme Ultimate is also known as the female and male fish Diagram of the Supreme Ultimate, and it may include positive fish region, yin that shape such as two fish of yin-yang, which is mutually entangled together, Fish region etc..Positive fish region can also include positive fish body region and positive flake region.Negative fish region can also include negative fish body area Domain and negative flake region.The coding region of the Diagram of the Supreme Ultimate may include the arbitrary region of the Diagram of the Supreme Ultimate.For example, the coding region of the Diagram of the Supreme Ultimate It can include but is not limited to the positive fish body region of the Diagram of the Supreme Ultimate and the negative fish body region of the Diagram of the Supreme Ultimate etc..Wherein, the above-mentioned first default sequence Column may include at least two presets in coding region.
Here, particular geometric figure corresponding with binary number can be matched with the shape of preset, size.In general, Particular geometric figure is usually pure color figure.For example, dark circles can be drawn on the preset in the coding region of the Diagram of the Supreme Ultimate Dot represents binary number 1, draws white dot to represent binary number 0.
In some optional implementations of the present embodiment, the coding region of the Diagram of the Supreme Ultimate may include fish body region.Fish Body region can be assembled by multiple points.The multiple points for being gathered into fish body region may include preset.For example, first is default The preset that sequence includes can be the partial dot for selecting and from the point for being gathered into fish body region.For the ease of to generation Two dimensional code is identified that the preset that the first predetermined sequence includes is typically at the point of the inside in fish body region, rather than locates In the point on the edge in fish body region.In order to keep the two dimensional code of the Diagram of the Supreme Ultimate pattern generated more beautiful, the first predetermined sequence packet The preset included can be evenly distributed on the inside in fish body region.In order to avoid consecutive points store identical data and are drawn homochromy Dot and link together to two dimensional code identification impact, can be selected from the point of the inside in fish body region mutually it is non-conterminous Point as preset generate the first predetermined sequence.
It include positive fish body region and negative fish body region in fish body region in some optional implementations of the present embodiment In the case where, the closeness for being gathered into the point in positive fish body region is usually less than the closeness for being gathered into the point in negative fish body region, with Have differences positive fish body region and the distribution of color in negative fish body region.In general, not stored data information or non-storing data The point of information is black dot.Since the closeness for being gathered into the point in positive fish body region is lower, in this way, just making positive fish body region Distribution of color is mainly rendered as white.Since the closeness for being gathered into the point in negative fish body region is higher, in this way, with regard to Shi Yin fish body area The distribution of color in domain is mainly rendered as black.In this way, the distribution of color in positive fish body region and negative fish body region has differences, right When the two dimensional code of generation is identified, two dimensional code can be determined according to the distribution of color in positive fish body region and negative fish body region Direction.
It further include flake region in the Diagram of the Supreme Ultimate, flake region includes in some optional implementations of the present embodiment In the case where positive flake region and negative flake region, flake region can be assembled by multiple points.Also, it is gathered into positive flake The closeness of the point in region is higher than the closeness for being gathered into the point in positive fish body region, in this way, convenient for distinguishing positive flake region and sun Fish body region.The closeness for being gathered into the point in negative flake region is lower than the closeness for being gathered into the point in negative fish body region, in this way, just In the negative flake region of differentiation and negative fish body region.In general, the point for being gathered into flake region is not used in storing data information.
In some optional implementations of the present embodiment, the Diagram of the Supreme Ultimate can the box packet made of multiple point aggregations It encloses.Wherein, four intersection points of the four edges of box can be the anchor point of two dimensional code corresponding with character string.For example, box can To be square, at this point, the multiple points for being gathered into box include anchor point, anchor point is the vertex at four angles of box.Example again Such as, in order to keep the two dimensional code generated more beautiful, box is also possible to rounded square, at this point, being gathered into multiple points of box It does not include anchor point, anchor point is to carry out four intersection points after both ends extend to intersection to the four edges of box.To generation When two dimensional code is identified, the size and location of two dimensional code can be determined according to anchor point.
Method provided by the embodiments of the present application for generating two dimensional code, by being encoded to character string, to obtain Binary array corresponding with character string.By the code area that the binary number in binary array is sequentially stored in the Diagram of the Supreme Ultimate In the first predetermined sequence in domain, to generate two dimensional code corresponding with character string.The embodiment can generate Tai Ji pattern The two dimensional code of formula, to enrich the pattern of two dimensional code.
With further reference to Fig. 3, it illustrates another embodiments according to the method for generating two dimensional code of the application Process 300.It wherein, can be with reference in relation to the detailed of Fig. 2 with the same or similar content of method shown in Fig. 2 in method shown in Fig. 3 It is thin to introduce, it is subsequent to repeat no more.This be used for generate two dimensional code method the following steps are included:
Step 301, character string is obtained.
Step 302, character string is encoded, generates binary array corresponding with character string.
In the present embodiment, the behaviour of the concrete operations of step 301-302 and step 201-202 in embodiment shown in Fig. 2 Make it is essentially identical, can be with reference to the detailed description in relation to step 201-202 in Fig. 2, details are not described herein.
Step 303, binary array is analyzed, determines version corresponding with binary array and mask.
In the present embodiment, above-mentioned executing subject can analyze the quantity of the binary number of binary array, from And determine version corresponding with binary array.Meanwhile above-mentioned executing subject can analyze the content of binary array, So that it is determined that mask corresponding with binary array.
In practice, two dimensional code provided by the embodiments of the present application includes multiple versions.The two dimensional code of different editions corresponding two The quantity of system number is different.Therefore, the information capacity of the two dimensional code of different editions is also different.In general, version is higher, first is default The quantity for the preset that sequence includes is more, and the information that two dimensional code can accommodate is also just corresponding more.
In some optional implementations of the present embodiment, above-mentioned executing subject can determine and two as follows The corresponding mask of system array:
Firstly, generating preset number mask in the way of recycling core.
Wherein, it is exactly to pass through recursive traversal n (n is positive integer) bit that mask is generated in the way of recycling core All situations, and remove full 0 and it is complete 1 the case where, obtain the binary array of remaining situation.Here it is possible to from the 1st to n-th A array element sets 0 respectively and sets 1, then after the array element all from 1 to n all sets 0 or set 1, can be obtained n The all situations of binary number.For example, generating the binary array that digit is 3,4,5,6 first with traversal mode.Wherein, position Number is 8 for the number of 3 binary array, and the number for the binary array that digit is 4 is 16, the binary system that digit is 5 The number of array is 32, and the number for the binary array that digit is 6 is 64.Then the binary array of full 0 and complete 1 is removed Afterwards, 112 masks can be obtained.
Later, for a mask in preset number mask, mask is carried out to binary array using a mask Operation obtains the corresponding mask operation result of a mask.
Typically for any one mask in preset number mask, it is performed both by this step.Wherein, mask operation is Position and operation are carried out using mask pair binary array corresponding with character string.
Then, by the corresponding mask operation result storage of a mask into two dimensional code, and one mask pair of storage is counted The number of heterochromatic point in the two dimensional code for the mask operation result answered.
Here, the white dot in the black dot in positive fish body region and negative fish body region is heterochromatic in two dimensional code Point.Here, if the quantity of heterochromatic point is more, illustrate after carrying out mask operation to binary array using this mask, presentation The uniformity of the distribution of color of two dimensional code is bad.If the quantity of heterochromatic point is fewer, illustrate using this mask to binary array After carrying out mask operation, the uniformity of the distribution of color of the two dimensional code of presentation is better.
Finally, the number of the heterochromatic point in the two dimensional code based on the corresponding mask operation result of storage preset number mask Mesh determines mask corresponding with binary array from preset number mask.
In general, the least mask of the number that heterochromatic point can be selected from preset number mask as with two into The corresponding mask of array processed.
Step 304, version and mask are stored in the second predetermined sequence in coding region.
In the present embodiment, above-mentioned executing subject can be by the corresponding particular geometric figure of binary number in version and mask Shape is successively plotted in the second predetermined sequence in the coding region of the Diagram of the Supreme Ultimate.Wherein, the second predetermined sequence may include coding At least two presets in region.The preset that second predetermined sequence includes can be to be selected from the point for being gathered into fish body region The partial dot taken out.In general, the preset that the second predetermined sequence includes is not overlapped with the preset that the first predetermined sequence includes. For the ease of identifying to the two dimensional code of generation, the preset that the second predetermined sequence includes is typically at the interior of fish body region The point in portion, rather than the point on the edge in fish body region.In order to keep the two dimensional code of the Diagram of the Supreme Ultimate pattern generated more beautiful, The preset that second predetermined sequence includes can be evenly distributed on the inside in fish body region.In order to avoid consecutive points store identical number According to and be drawn homochromy dot and link together to two dimensional code identification impact, can be from the point of the inside in fish body region Selecting mutually non-conterminous point is used as preset to generate the second predetermined sequence.
Step 305, error correcting code is added in binary array.
In the present embodiment, for the ease of error correction, what is stored in the coding region of two dimensional code is usually to be added to error correcting code Binary array.Wherein, error correcting code can be the code for occurring voluntarily to find or correct after mistake in decoding process.To make A kind of code has error correcting capability, must increase true form word extra symbol, to expand the difference between code word, i.e., true form word be pressed Certain rule becomes the code word for having certain redundancy, and makes have certain relationship between the code of each code word.Code word reaches receiving end Afterwards, whether can be met according to coding rule to determine whether mistake.When not being able to satisfy, by where the determining mistake of certain rule It is simultaneously corrected position.Here the error correcting code added is usually RS error correcting code.
Step 306, mask operation is carried out to binary array using mask corresponding with binary array.
In the present embodiment, above-mentioned executing subject can use the corresponding mask of binary array to being added to error correcting code Binary array carries out position and operation, to obtain the binary array after mask operation.Using mask to binary array into Row mask operation, storing to the binary array after mask operation can make the distribution of color of two dimensional code more uniform.
Step 307, the binary number in the binary array Jing Guo mask operation is sequentially stored in the coding of the Diagram of the Supreme Ultimate In the first predetermined sequence in region, two dimensional code corresponding with character string is generated.
In the present embodiment, above-mentioned executing subject can be by the binary number pair in the binary array Jing Guo mask operation The particular geometric figure answered successively is plotted in the first predetermined sequence in the coding region of the Diagram of the Supreme Ultimate, thus generation and character string Corresponding two dimensional code.
From figure 3, it can be seen that the side for being used to generate two dimensional code compared with the corresponding embodiment of Fig. 2, in the present embodiment The step of process 300 of method increases storage version and mask and the step that error correcting code and mask operation are added to binary array Suddenly.The scheme of the present embodiment description can entangle binary array according to error correcting code when carrying out two dimensional code identification as a result, Mistake, in order to improve recognition accuracy.Meanwhile two dimensional code is handled using mask, the distribution of color of two dimensional code can be made more equal It is even.
For the scheme for further illustrating the embodiment of the present application, refers to Fig. 4 A and Fig. 4 B, Fig. 4 A and show the application implementation The schematic diagram for the two dimensional code that the box that example provides is square.Fig. 4 B show box provided by the embodiments of the present application be fillet just The schematic diagram of rectangular two dimensional code.In Fig. 4 A and Fig. 4 B, two dimensional code is by depositing binary array corresponding with character string Storage is generated in the coding region of the Diagram of the Supreme Ultimate.The resolution ratio of two dimensional code is 1600 × 1600, be can be by multiple point aggregations Made of, wherein the pixel for being gathered into each point of two dimensional code is 20 × 20.Two dimensional code may include the Diagram of the Supreme Ultimate and encirclement Tai Ji The box of figure.If the x-axis of rectangular coordinate system and a line of box are parallel by taking the rectangular coordinate system in Fig. 4 A and Fig. 4 B as an example, And the distance between this edge and x-axis are 1.The y-axis of rectangular coordinate system is parallel with the another a line of box, and this edge and x-axis The distance between be 1.By Fig. 4 A and Fig. 4 B it is found that box, the edge in negative fish body region, positive fish body region edge can be by Multiple continuous points are assembled.In Figure 4 A, the multiple points for being gathered into box include anchor point, and anchor point is four of box The vertex at angle.In figure 4b, the multiple points for being gathered into box do not include anchor point, and anchor point is to carry out two to the four edges of box End extends to four intersection points after intersection.By Fig. 4 A and Fig. 4 B it is found that negative flake region can be assembled by multiple points, and this A little points are usually concentrated in the edge in negative flake region.Positive flake region can also be assembled by multiple points, and these points are usual It is evenly distributed in the whole region of positive flake.The above point is generally not used for storing data information.In Fig. 4 A and Fig. 4 B In, the point of the inside in fish body region can be used for storing data information.In general, can be chosen from the point of the inside in fish body region Mutually non-conterminous point carrys out storing data information out.For example, can be from the point of negative fish body region and the inside in positive fish body region minute A mutually non-conterminous point of the first preset number (such as 20) is not selected, is generated the second predetermined sequence and is come storage version and mask.Its In, the first preset number point in negative fish body region can be with the first preset number point in positive fish body region about Tai Ji The center point symmetry of figure, can also be asymmetric.Here it is possible to be drawn on these aspects according to the binary number of version and mask Black dot or white dot.In general, black dot can be drawn to represent binary number 1, white dot is drawn to represent two System number 0.The inside in the inside in negative fish body region and positive fish body region can be assembled by multiple points, and usually uniform point Cloth is in the whole region of negative fish body and positive fish body.Meanwhile the closeness of the point of the inside in negative fish body region is higher than Yang Yutiqu The closeness of the point of the inside in domain.In this way, the distribution of color in negative fish body region is just made mainly to be rendered as black, positive fish body region Distribution of color is mainly rendered as white.For example, the second preset number can be selected from the point of the inside in negative fish body region Mutual non-conterminous point selects third preset number mutually non-conterminous point from the point of the inside in positive fish body region, generates the One predetermined sequence stores binary array.Wherein, the second preset number can be equal with third preset number, can not also phase Deng.When the second preset number is equal with third preset number, the second preset number point in negative fish body region can be with sun Center point symmetry of the third preset number point about the Diagram of the Supreme Ultimate in fish body region, can also be asymmetric.Here it is possible to according to The binary number of binary array draws black dot or white dot on these aspects.In general, black dot can be drawn Binary number 1 is represented, draws white dot to represent binary number 0.
The two dimension of the pattern of the Diagram of the Supreme Ultimate can be generated according to the method provided by the embodiments of the present application for generating two dimensional code Code.Wherein, Fig. 4 A and Fig. 4 B shows the schematic diagram of the two dimensional code of the pattern of two kinds of Diagram of the Supreme Ultimates.By Fig. 4 A and Fig. 4 B it is found that two Dimension code includes the Diagram of the Supreme Ultimate and the box for surrounding the Diagram of the Supreme Ultimate.The Diagram of the Supreme Ultimate is assembled by multiple points, the closeness of the point of different zones Difference, consequently facilitating different regions is distinguished, so that two dimensional code shows the pattern of the Diagram of the Supreme Ultimate.Only with the part in the Diagram of the Supreme Ultimate Point storing data, and the point of storing data is more random, improves the safety of two dimensional code.The point of storing data is mutually non-conterminous, Two dimensional code will not be identified and be impacted.Box is assembled by multiple points.In Figure 4 A, box is square, the side of being gathered into Multiple points of frame include anchor point, and anchor point is the vertex at four angles of box, when identifying to two dimensional code, convenient for searching To anchor point.In figure 4b, box is rounded square, camber is designed at four angles of box, to make two dimensional code more It is beautiful.
Below with reference to Fig. 5, it is (such as shown in FIG. 1 that it illustrates the network equipments for being suitable for being used to realize the embodiment of the present application The network equipment 101 or the network equipment 103) computer system 500 structural schematic diagram.The network equipment shown in Fig. 5 is only One example, should not function to the embodiment of the present application and use scope bring any restrictions.
As shown in figure 5, computer system 500 includes central processing unit (CPU) 501, it can be read-only according to being stored in Program in memory (ROM) 502 or be loaded into the program in random access storage device (RAM) 503 from storage section 508 and Execute various movements appropriate and processing.In RAM503, also it is stored with system 500 and operates required various programs and data. CPU501, ROM502 and RAM503 are connected with each other by bus 504.Input/output (I/O) interface 505 is also connected to bus 504。
I/O interface 505 is connected to lower component: the importation 506 including keyboard, mouse etc.;It is penetrated including such as cathode The output par, c 507 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 508 including hard disk etc.; And the communications portion 509 of the network interface card including LAN card, modem etc..Communications portion 509 via such as because The network of spy's net executes communication process.Driver 510 is also connected to I/O interface 505 as needed.Detachable media 511, such as Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 510, in order to read from thereon Computer program be mounted into storage section 508 as needed.
Particularly, in accordance with an embodiment of the present disclosure, it may be implemented as computer above with reference to the process of flow chart description Software program.For example, embodiment of the disclosure includes a kind of computer program product comprising be carried on computer-readable medium On computer program, which includes the program code for method shown in execution flow chart.In such reality It applies in example, which can be downloaded and installed from network by communications portion 509, and/or from detachable media 511 are mounted.When the computer program is executed by central processing unit (CPU) 701, limited in execution the present processes Above-mentioned function.It should be noted that computer-readable medium described herein can be computer-readable signal media or Computer-readable medium either the two any combination.Computer-readable medium for example can be --- but it is unlimited In system, device or the device of --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor, or any above combination.It calculates The more specific example of machine readable medium can include but is not limited to: electrical connection, portable meter with one or more conducting wires Calculation machine disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device or The above-mentioned any appropriate combination of person.In this application, computer-readable medium, which can be, any includes or storage program has Shape medium, the program can be commanded execution system, device or device use or in connection.And in the application In, computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal, wherein Carry computer-readable program code.The data-signal of this propagation can take various forms, including but not limited to electric Magnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be computer-readable Jie Any computer-readable medium other than matter, the computer-readable medium can be sent, propagated or transmitted for being held by instruction Row system, device or device use or program in connection.The program code for including on computer-readable medium It can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc. or above-mentioned any conjunction Suitable combination.
The calculating of the operation for executing the application can be write with one or more programming languages or combinations thereof Machine program code, described program design language include object-oriented programming language-such as Java, Smalltalk, C+ +, further include conventional procedural programming language-such as " C " language or similar programming language.Program code can Fully to execute, partly execute on the user computer on the user computer, be executed as an independent software package, Part executes on the remote computer or executes on a remote computer or server completely on the user computer for part. In situations involving remote computers, remote computer can pass through the network of any kind --- including local area network (LAN) Or wide area network (WAN)-is connected to subscriber computer, or, it may be connected to outer computer (such as utilize Internet service Provider is connected by internet).
Flow chart and block diagram in attached drawing are illustrated according to the system of the various embodiments of the application, method and computer journey The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation A part of one module, program segment or code of table, a part of the module, program segment or code include one or more use The executable instruction of the logic function as defined in realizing.It should also be noted that in some implementations as replacements, being marked in box The function of note can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are actually It can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it to infuse Meaning, the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart can be with holding The dedicated hardware based system of functions or operations as defined in row is realized, or can use specialized hardware and computer instruction Combination realize.
Being described in unit involved in the embodiment of the present application can be realized by way of software, can also be by hard The mode of part is realized.Described unit also can be set in the processor, for example, can be described as: a kind of processor packet Include acquiring unit, coding unit and generation unit.Wherein, the title of these units is not constituted under certain conditions to the unit The restriction of itself, for example, acquiring unit is also described as " obtaining the unit of character string ".
As on the other hand, present invention also provides a kind of computer-readable medium, which be can be Included in the network equipment described in above-described embodiment;It is also possible to individualism, and without in the supplying network equipment. Above-mentioned computer-readable medium carries one or more program, when said one or multiple programs are held by the network equipment When row, so that the network equipment: obtaining character string;Character string is encoded, binary array corresponding with character string is generated; Binary number in binary array is sequentially stored in the first predetermined sequence in the coding region of the Diagram of the Supreme Ultimate, generation and word The corresponding two dimensional code of symbol string, wherein the first predetermined sequence includes at least two presets.Further, when said one or When multiple programs are executed by the network equipment, so that hereinbefore each method and step can also be performed in the network equipment, tool Body may refer to above, be not repeated herein.
Above description is only the preferred embodiment of the application and the explanation to institute's application technology principle.Those skilled in the art Member is it should be appreciated that invention scope involved in the application, however it is not limited to technology made of the specific combination of above-mentioned technical characteristic Scheme, while should also cover in the case where not departing from foregoing invention design, it is carried out by above-mentioned technical characteristic or its equivalent feature Any combination and the other technical solutions formed.Such as features described above has similar function with (but being not limited to) disclosed herein Can technical characteristic replaced mutually and the technical solution that is formed.

Claims (13)

1. a kind of method for generating two dimensional code characterized by comprising
Obtain character string;
The character string is encoded, binary array corresponding with the character string is generated;
Binary number in the binary array is sequentially stored in the first predetermined sequence in the coding region of the Diagram of the Supreme Ultimate, Generate two dimensional code corresponding with the character string, wherein first predetermined sequence includes at least two presets.
2. the method according to claim 1, wherein being encoded described to the character string, generation and institute After stating the corresponding binary array of character string, further includes:
The binary array is analyzed, determines version corresponding with the binary array and mask;
The version and the mask are stored in the second predetermined sequence in the coding region, wherein described second is pre- If sequence includes at least two presets, and the preset that second predetermined sequence includes includes with first predetermined sequence Preset be not overlapped.
3. according to the method described in claim 2, it is characterized in that, described analyze the binary array, determine with The corresponding version of the binary array and mask, comprising:
Preset number mask is generated in the way of recycling core;
For a mask in the preset number mask, the binary array is covered using one mask Code operation, obtains the corresponding mask operation of one mask as a result, the corresponding mask operation result of one mask is deposited It stores up in two dimensional code, and counts the number of the heterochromatic point in the two dimensional code for storing the corresponding mask operation result of one mask Mesh;
Based on the number of the heterochromatic point in the two dimensional code for storing the corresponding mask operation result of the preset number mask, from institute It states and determines mask corresponding with the binary array in preset number mask.
4. according to the method described in claim 3, it is characterized in that, the binary number by the binary array according to Before in secondary the first predetermined sequence being stored in the coding region of the Diagram of the Supreme Ultimate, further includes:
Mask operation is carried out to the binary array using mask corresponding with the binary array;
The first default sequence that the binary number by the binary array is sequentially stored in the coding region of the Diagram of the Supreme Ultimate In column, comprising:
Binary number in the binary array Jing Guo mask operation is sequentially stored in the coding of the Diagram of the Supreme Ultimate In first predetermined sequence in region.
5. the method according to one of claim 2-4, which is characterized in that the coding region of the Diagram of the Supreme Ultimate includes fish Body region, the fish body region are assembled by multiple points, and the multiple points for being gathered into the fish body region include the preset, And the preset be evenly distributed on the fish body region inside and mutually it is non-conterminous.
6. according to the method described in claim 5, it is characterized in that, the fish body region includes positive fish body region and negative fish body area Domain, and the closeness for being gathered into the point in the positive fish body region is lower than the closeness for being gathered into the point in the negative fish body region, with Have differences the positive fish body region and the distribution of color in the negative fish body region.
7. according to the method described in claim 6, it is characterized in that, the Diagram of the Supreme Ultimate further includes flake region, the fish-eye area Domain includes positive flake region and negative flake region, and the flake region is assembled by multiple points, and is gathered into the positive flake The closeness of the point in region is higher than the closeness for being gathered into the point in the positive fish body region, is gathered into the point in the negative flake region Closeness be lower than the closeness for being gathered into the point in the negative fish body region.
8. method described in one of -7 according to claim 1, which is characterized in that Diagram of the Supreme Ultimate side made of multiple point aggregations Frame surrounds, wherein four intersection points of the four edges of the box are the anchor points of two dimensional code corresponding with the character string.
9. according to the method described in claim 8, and being gathered into the box it is characterized in that, the box is square Multiple points include the anchor point.
10. according to the method described in claim 8, it is characterized in that, the box is rounded square, and being gathered into the side Multiple points of frame do not include the anchor point, and the anchor point is after the four edges progress both ends to the box extend to intersection Four intersection points.
11. method described in one of -10 according to claim 1, which is characterized in that in two by the binary array Before system number is sequentially stored in the first predetermined sequence in the coding region of the Diagram of the Supreme Ultimate, further includes:
Error correcting code is added in the binary array.
12. a kind of network equipment, comprising:
One or more processors;
Storage device stores one or more programs thereon;
When one or more of programs are executed by one or more of processors, so that one or more of processors are real The now method as described in any in claim 1-11.
13. a kind of computer readable storage medium, is stored thereon with computer program, the computer program is executed by processor Method of the Shi Shixian as described in any in claim 1-11.
CN201811151568.8A 2018-09-29 2018-09-29 Method and apparatus for generating two dimensional code Pending CN109255417A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811151568.8A CN109255417A (en) 2018-09-29 2018-09-29 Method and apparatus for generating two dimensional code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811151568.8A CN109255417A (en) 2018-09-29 2018-09-29 Method and apparatus for generating two dimensional code

Publications (1)

Publication Number Publication Date
CN109255417A true CN109255417A (en) 2019-01-22

Family

ID=65044817

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811151568.8A Pending CN109255417A (en) 2018-09-29 2018-09-29 Method and apparatus for generating two dimensional code

Country Status (1)

Country Link
CN (1) CN109255417A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109800843A (en) * 2019-02-20 2019-05-24 连尚(新昌)网络科技有限公司 It is a kind of for generating the method and apparatus of two dimensional code
CN113222585A (en) * 2021-05-27 2021-08-06 福建博思软件股份有限公司 Offline payment method, digital currency round code generation method and terminal

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104143109A (en) * 2014-01-28 2014-11-12 深圳市雁联计算系统有限公司 Two-dimensional code coding method, two-dimensional code decoding method and two-dimensional code print
CN106529633A (en) * 2015-09-10 2017-03-22 阿里巴巴集团控股有限公司 Two-dimensional code generation method and decoding method and device
CN106815544A (en) * 2017-01-16 2017-06-09 武汉大学 A kind of information concealing method based on Quick Response Code
CN107169395A (en) * 2017-06-20 2017-09-15 重庆大学 A kind of safer QR codes generation and read method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104143109A (en) * 2014-01-28 2014-11-12 深圳市雁联计算系统有限公司 Two-dimensional code coding method, two-dimensional code decoding method and two-dimensional code print
CN106529633A (en) * 2015-09-10 2017-03-22 阿里巴巴集团控股有限公司 Two-dimensional code generation method and decoding method and device
CN106815544A (en) * 2017-01-16 2017-06-09 武汉大学 A kind of information concealing method based on Quick Response Code
CN107169395A (en) * 2017-06-20 2017-09-15 重庆大学 A kind of safer QR codes generation and read method

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109800843A (en) * 2019-02-20 2019-05-24 连尚(新昌)网络科技有限公司 It is a kind of for generating the method and apparatus of two dimensional code
CN113222585A (en) * 2021-05-27 2021-08-06 福建博思软件股份有限公司 Offline payment method, digital currency round code generation method and terminal
CN113222585B (en) * 2021-05-27 2022-07-12 福建博思软件股份有限公司 Offline payment method, digital currency round code generation method and terminal

Similar Documents

Publication Publication Date Title
CN108446698A (en) Method, apparatus, medium and the electronic equipment of text are detected in the picture
CN108509915A (en) The generation method and device of human face recognition model
CN110288049A (en) Method and apparatus for generating image recognition model
CN106910210A (en) Method and apparatus for generating image information
CN109165573A (en) Method and apparatus for extracting video feature vector
US20200126315A1 (en) Method and apparatus for generating information
CN108629823A (en) The generation method and device of multi-view image
CN109948762A (en) Method and apparatus for generating two dimensional code
CN109118456A (en) Image processing method and device
CN109255417A (en) Method and apparatus for generating two dimensional code
CN109711922A (en) Part method, apparatus, system and storage medium are posted in customization
CN109241934A (en) Method and apparatus for generating information
CN111783142A (en) Data protection method, device, server and medium
CN113031946A (en) Method and device for rendering page component
CN109377508A (en) Image processing method and device
CN108491812A (en) The generation method and device of human face recognition model
CN113537153A (en) Meter image identification method and device, electronic equipment and computer readable medium
CN108898604A (en) Method and apparatus for handling image
CN109271826A (en) The method and apparatus of two dimensional code for identification
CN109871890A (en) Image processing method and device
CN114332809A (en) Image identification method and device, electronic equipment and storage medium
CN108875444A (en) The method and apparatus of two dimensional code for identification
CN109165361A (en) The method, apparatus and equipment/terminal/server of page presentation in a kind of information flow
CN108376177B (en) For handling the method and distributed system of information
CN110764685A (en) Method and device for identifying two-dimensional code

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