CN111291846A - Two-dimensional code generation, decoding and identification method, device and equipment - Google Patents

Two-dimensional code generation, decoding and identification method, device and equipment Download PDF

Info

Publication number
CN111291846A
CN111291846A CN202010384112.7A CN202010384112A CN111291846A CN 111291846 A CN111291846 A CN 111291846A CN 202010384112 A CN202010384112 A CN 202010384112A CN 111291846 A CN111291846 A CN 111291846A
Authority
CN
China
Prior art keywords
dimensional code
image
positioning area
area
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010384112.7A
Other languages
Chinese (zh)
Other versions
CN111291846B (en
Inventor
陈超
周大江
赵雄心
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Information 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 Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202010384112.7A priority Critical patent/CN111291846B/en
Priority to CN202110799066.1A priority patent/CN113435557B/en
Publication of CN111291846A publication Critical patent/CN111291846A/en
Application granted granted Critical
Publication of CN111291846B publication Critical patent/CN111291846B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • 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

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Cash Registers Or Receiving Machines (AREA)
  • Image Analysis (AREA)

Abstract

The embodiment of the specification provides a two-dimensional code generating method, a two-dimensional code decoding device, a two-dimensional code identifying device and two-dimensional code identifying equipment. The scheme comprises the following steps: acquiring a binary sequence corresponding to commodity information of a two-dimensional code to be generated; determining the pixel value of each effective information bit in a generating area of the two-dimensional code according to the binary sequence; generating a two-dimensional code according to the pixel value of the effective information bit and the known pixel value of the positioning point; when the generated two-dimensional code is identified, acquiring an image to be identified containing the two-dimensional code, and detecting the image to be identified by adopting a detection model to obtain a two-dimensional code image; then, identifying image information of the two-dimensional code in the two-dimensional code image by adopting an identification model, and determining the pixel value of the effective information bit of the two-dimensional code from the image information of the two-dimensional code; generating a binary sequence from the pixel values; and decoding the binary sequence to obtain the commodity information stored in the effective information bits.

Description

Two-dimensional code generation, decoding and identification method, device and equipment
Technical Field
One or more embodiments of the present disclosure relate to the field of computer technologies, and in particular, to a method, an apparatus, and a device for generating, decoding, and identifying a two-dimensional code.
Background
At present, with the development of internet technology, two-dimensional codes become a popular encoding mode on mobile equipment. The application of two-dimensional codes is becoming more and more common in life, such as: the two-dimension code business card is pushed out, the two-dimension code is adopted for identity recognition, tracing or automatic selling is carried out on products through the two-dimension code, electronic ticketing, movie tickets, scenic spot tickets and the like are customized through the two-dimension code.
In practical application, the two-dimensional code can be attached to the outer package of the commodity, and a user can identify commodity information contained in the two-dimensional code by scanning the two-dimensional code. In order to identify and obtain the commodity information in the two-dimensional code, generally, the two-dimensional code is scanned first, the two-dimensional code obtained by scanning is decoded, then the commodity information included in the two-dimensional code is obtained, and the commodity can be sold and managed through the commodity information, for example: the selling condition of the commodity can be managed through the commodity information, and the commodity type, the commodity name, the production date and the like corresponding to the commodity can be known through the commodity information.
Therefore, it is desirable to provide a more reliable two-dimensional code generation, decoding, and identification scheme.
Disclosure of Invention
In view of this, one or more embodiments of the present disclosure provide a two-dimensional code generating method, a two-dimensional code decoding method, a two-dimensional code identifying device, and a two-dimensional code identifying apparatus, which are used to effectively solve the problems of an existing two-dimensional code that the size is too large and the identification accuracy is low.
In order to solve the above technical problem, the embodiments of the present specification are implemented as follows:
an embodiment of the present specification provides a two-dimensional code generation method, including:
acquiring a binary sequence corresponding to commodity information of a two-dimensional code to be generated;
determining the pixel value of each effective information bit in the generation area of the two-dimensional code according to the binary sequence; the generating area of the two-dimensional code also comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position;
and generating the two-dimensional code according to the pixel value of the effective information bit and the known pixel value of the positioning point.
The decoding method for the two-dimensional code provided by the embodiment of the specification comprises the following steps:
acquiring image information of a two-dimensional code to be identified, wherein an image area of the two-dimensional code to be identified comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position;
determining the pixel value of the effective information bit in the two-dimensional code to be identified from the image information;
generating a binary sequence according to the pixel value of the effective information bit;
and decoding the binary sequence to obtain the commodity information stored in the effective information bit.
The two-dimensional code identification method provided by the embodiment of the specification comprises the following steps:
acquiring an image to be identified;
detecting the image to be recognized by adopting a detection model, and determining a two-dimension code image containing a two-dimension code to be recognized in the image to be recognized;
identifying the two-dimension code image by adopting an identification model to obtain image information of a two-dimension code to be identified in the two-dimension code image, wherein the image area of the two-dimension code to be identified comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position.
An embodiment of this specification provides a two-dimensional code generating device, includes:
the binary sequence acquisition module is used for acquiring a binary sequence corresponding to the commodity information of the two-dimensional code to be generated;
the pixel value determining module of the effective information bits is used for determining the pixel value of each effective information bit in the generating area of the two-dimensional code according to the binary sequence; the generating area of the two-dimensional code also comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position;
and the two-dimensional code generating module is used for generating the two-dimensional code according to the pixel value of the effective information bit and the known pixel value of the positioning point.
An embodiment of this specification provides a decoding device of two-dimensional code, includes:
the two-dimensional code image information acquisition module is used for acquiring image information of a two-dimensional code to be identified, wherein an image area of the two-dimensional code to be identified comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position;
the effective information bit determining module is used for determining the pixel value of the effective information bit in the two-dimensional code to be identified from the image information;
a binary sequence generating module, configured to generate a binary sequence according to the pixel value of the significant information bit;
and the decoding module is used for decoding the binary sequence to obtain the commodity information stored in the effective information bit.
The two-dimensional code recognition device provided by the embodiment of the present specification includes:
the image to be recognized acquisition module is used for acquiring an image to be recognized;
the two-dimension code image detection module is used for detecting the image to be identified by adopting a detection model and determining a two-dimension code image containing the two-dimension code to be identified in the image to be identified;
the two-dimension code recognition module is used for recognizing the two-dimension code image by adopting a recognition model to obtain image information of a to-be-recognized two-dimension code in the two-dimension code image, wherein the image area of the to-be-recognized two-dimension code comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position.
An embodiment of the present specification provides a two-dimensional code generating device, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to:
acquiring a binary sequence corresponding to commodity information of a two-dimensional code to be generated;
determining the pixel value of each effective information bit in the generation area of the two-dimensional code according to the binary sequence; the generating area of the two-dimensional code also comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position;
and generating the two-dimensional code according to the pixel value of the effective information bit and the known pixel value of the positioning point.
An embodiment of this specification provides a two-dimensional code decoding device, includes:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to:
acquiring image information of a two-dimensional code to be identified, wherein an image area of the two-dimensional code to be identified comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position;
determining the pixel value of the effective information bit in the two-dimensional code to be identified from the image information;
generating a binary sequence according to the pixel value of the effective information bit;
and decoding the binary sequence to obtain the commodity information stored in the effective information bit.
The two-dimensional code identification device provided by the embodiment of the present specification includes:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to:
acquiring an image to be identified;
detecting the image to be recognized by adopting a detection model, and determining a two-dimension code image containing a two-dimension code to be recognized in the image to be recognized;
identifying the two-dimension code image by adopting an identification model to obtain image information of a two-dimension code to be identified in the two-dimension code image, wherein the image area of the two-dimension code to be identified comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position.
Embodiments of the present specification provide a computer readable medium, on which computer readable instructions are stored, the computer readable instructions being executable by a processor to implement a two-dimensional code generation method, a decoding method and an identification method.
One or more embodiments of the present disclosure can achieve the following advantageous effects: acquiring a binary sequence corresponding to commodity information of a two-dimensional code to be generated; determining the pixel value of each effective information bit in a generating area of the two-dimensional code according to the binary sequence; generating a two-dimensional code according to the pixel value of the effective information bit and the known pixel value of the positioning point; because the two-dimensional code that generates only includes location point position and effective information point position, and every location area in the first location area in the location point position respectively only occupies a point position, need not contain other functional area, make the two-dimensional code structure that generates still less, the point position that the location area occupied reduces, thereby make the effective information point position of storage commodity information increase, under the condition of the same commodity information of the two-dimensional code of needs storage and standard size, the scheme in this scheme can generate the less two-dimensional code of size, and can guarantee that the small-size code that generates also can contain required commodity information, thereby solve the too big problem of standard two-dimensional code size, in order to satisfy the scene demand of some small-size codes.
In addition, in other embodiments of the present description, a two-dimensional code image is recognized from an image to be recognized by using a detection model based on deep learning, and then a two-dimensional code is recognized from the two-dimensional code image by using a recognition model based on deep learning, so that each point in the two-dimensional code can be accurately recognized, and therefore, effective information included in the two-dimensional code is completely decoded even in a scene where a distorted image of the two-dimensional code is obtained by shooting with a camera, and high-precision detection and recognition of a small-sized two-dimensional code in a distorted scene is achieved.
Drawings
The accompanying drawings, which are included to provide a further understanding of one or more embodiments of the disclosure and are incorporated in and constitute a part of this specification, illustrate exemplary embodiments of the disclosure and together with the description serve to explain the embodiments of the disclosure and not to limit the embodiments of the disclosure. In the drawings:
fig. 1 is a schematic flowchart of a two-dimensional code generation method provided in an embodiment of the present specification;
fig. 2 is a schematic structural diagram of a two-dimensional code generated by a two-dimensional code generation method provided in an embodiment of the present specification;
fig. 3 is a schematic diagram illustrating determination of a pixel value of an effective information bit in a two-dimensional code generation method according to an embodiment of the present disclosure;
fig. 4 is a schematic flowchart of a two-dimensional code decoding method in an embodiment of the present disclosure;
fig. 5 is a schematic flowchart of a two-dimensional code recognition method in an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a two-dimensional code generating apparatus corresponding to fig. 1 provided in an embodiment of the present specification;
fig. 7 is a schematic structural diagram of a two-dimensional code decoding apparatus corresponding to fig. 4 provided in an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of a two-dimensional code recognition apparatus corresponding to fig. 5 provided in an embodiment of the present disclosure;
fig. 9 is a schematic structural diagram of the apparatus corresponding to fig. 1, fig. 4, and fig. 5 provided in an embodiment of this specification.
Detailed Description
To make the objects, technical solutions and advantages of one or more embodiments of the present disclosure more apparent, the technical solutions of one or more embodiments of the present disclosure will be described in detail and completely with reference to the specific embodiments of the present disclosure and the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present specification, and not all embodiments. All other embodiments that can be derived by a person skilled in the art from the embodiments given herein without making any creative effort fall within the scope of protection of one or more embodiments of the present specification.
The technical solutions provided by the embodiments of the present description are described in detail below with reference to the accompanying drawings.
The two-dimensional code can have QR code and dot matrix code, wherein, the QR code has mainly contained version information, format information, data and fault-tolerant information and data demand information etc. has the functional area of fixed shape, for example: the different areas of the square-back positioning area are also connected with black lines. There are 40 versions, the smallest version 1 having a pixel size of 21x21 and the largest version 40 being 177x 177. The size is too large to be suitable for many application scenarios with requirements on size. Such as: in the application scene of the intelligent container, the two-dimensional code is attached to the commodity in the intelligent container, if the size of the two-dimensional code is large, the two-dimensional code can block the information of the commodity or if the commodity is too small (such as chewing gum), the two-dimensional code can not be attached to the commodity, and the selling of the commodity is not facilitated.
In addition, the camera device for shooting the two-dimensional code in the intelligent container is a fisheye camera, the focal length of the fisheye camera is extremely short, and the visual angle is close to a 180-degree lens. The distortion at the center of the lens can be ignored to be zero, and the distortion is larger at the farther position away from the lens by taking the lens as the center. If the two-dimensional code attached to the commodity is too large in size, the image of the shot two-dimensional code is greatly distorted, and the subsequent identification accuracy of the two-dimensional code is reduced.
Therefore, the scheme aims to provide a more reliable two-dimensional code generation method and a more reliable two-dimensional code identification method so as to ensure that a two-dimensional code with a smaller size is generated and can be correctly detected and identified so as to acquire information in the two-dimensional code. Specifically, the following examples may be employed for detailed explanation:
example 1
Fig. 1 is a schematic flow chart of a two-dimensional code generation method in an embodiment of this specification. From the viewpoint of a program, the execution subject of the flow may be a program installed in an application server or an application client.
As shown in fig. 1, the process may include the following steps:
step 102: and acquiring a binary sequence corresponding to the commodity information of the two-dimensional code to be generated.
In an actual application scenario, the two-dimensional code may be a dot code, or a specific geometric figure is distributed in a two-dimensional direction according to an arrangement rule, and a dot matrix with black and white alternating is adopted to record data symbol information. The two-dimensional code can store information such as Chinese characters, numbers, pictures and the like.
In an actual application scenario, the two-dimensional code may store commodity information corresponding to a commodity, such as: name of the goods, manufacturer, date of manufacture, and introduction of the contents of the goods, etc. The binary sequence may be a sequence encoded according to commodity information. For computer recognition, the binary sequence can be composed by using the internal logic of the computer and using the numbers "0" and "1" as codes and several geometric shapes corresponding to the binary.
Step 104: determining the pixel value of each effective information bit in the generation area of the two-dimensional code according to the binary sequence; the generating area of the two-dimensional code also comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position.
The effective information bit can store commodity information. The scanning device can obtain the commodity information stored in the effective information bit by scanning the two-dimensional code.
The binary bits in the binary sequence may be used to represent the corresponding color of the code block. Such as: a binary "0" indicates that the code block is white and a binary "1" indicates that the code block is black, and the pixel value in each significant information bit can be determined from the binary sequence. Note that the pixel value here may refer to a color (black or white) of the code block corresponding to each effective information bit.
The generation area of the two-dimensional code may refer to an outline area of the two-dimensional code, such as: when a two-dimensional code of 5x5 needs to be generated, the outline area of the two-dimensional code is a square area of 5x 5.
The generating area comprises a first positioning area and a second positioning area, the first positioning area can be used for positioning the two-dimension code, the second positioning area can be a direction positioning area, and the direction positioning area is used for representing the direction of the two-dimension code. The direction location area may be at any one of the four corners of the generation area, such as: the direction positioning region may be at the lower right corner of the generation region, or may be at the upper left corner … … of the generation region, and the position of the first positioning region may be at any three of the four corners of the generation region, for example: if the direction positioning area is located at the lower right corner of the generation area, the first positioning area may be located at the upper left corner, the upper right corner, and the lower left corner of the generation area, respectively.
It should be noted that each of the left first positioning regions in the present embodiment occupies only one point, and these occupied points may be called positioning points. The direction positioning region may occupy four points, one of the positioning points is fixed to be white, and the other three points are fixed to be black, and of course, one black point and three white points or two white points and two black points may be provided. The direction positioning area only needs to meet the requirement of the direction of the two-dimensional code, the specific color of the point position is set, the point position can be set according to the actual situation, and the scheme is not specifically limited to this.
Step 106: and generating the two-dimensional code according to the pixel value of the effective information bit and the known pixel value of the positioning point.
The pixel value may indicate that the code block corresponding to the point bit is black or white, and the pixel value may be a specific symbol value corresponding to black or white. The color of the code block corresponding to the location point may be preset, for example: the code blocks corresponding to the positioning regions included in the first positioning region are all set to be black.
After the colors of the code blocks corresponding to the effective information bits are determined according to the pixel values of the effective information bits, the two-dimensional code can be generated. The camera can read out the information contained in the two-dimensional code according to the color of the code blocks in the effective information bits and the arrangement of the code blocks.
Next, the generated two-dimensional code can be explained in detail by using fig. 2:
fig. 2 is a schematic structural diagram of a two-dimensional code generated by a two-dimensional code generation method provided in an embodiment of this specification. As shown in fig. 2, a two-dimensional code with a size of 5x5 can be generated by using the two-dimensional code generation method provided in fig. 1, and the two-dimensional code can be firstly drawn according to the size of the two-dimensional code to be generated to obtain a generation area 201 of the two-dimensional code, where the generation area is a square area of 5x 5; in the generation area 201, a lower right corner area in the generation area is taken as a direction positioning area 209, and each positioning area in the first positioning area is located at an upper left corner, an upper right corner and a lower left corner of the generation area, and can be regarded as an upper left positioning area 203, an upper right positioning area 205 and a lower left positioning area 207, wherein the upper left positioning area 203, the upper right positioning area 20 and the lower left positioning area 207 all occupy one point, and are black points, and the lower right corner direction positioning area occupies four points, which are one black point and three white points, except for the upper left positioning area 203, the upper right positioning area 205, the lower left positioning area 207 and the direction positioning area (dotted line portion) 209, and the remaining points are valid information bits.
In the method in fig. 1, a binary sequence corresponding to commodity information of a two-dimensional code to be generated is obtained; determining the pixel value of each effective information bit in a generating area of the two-dimensional code according to the binary sequence; generating a two-dimensional code according to the pixel value of the effective information bit and the known pixel value of the positioning point; because the two-dimensional code that generates only includes location point position and effective information point position, and every location area in the first location area in the location point position respectively only occupies a point position, need not contain other functional area, make the two-dimensional code structure that generates still less, the point position that the location area occupied reduces, thereby make the effective information point position of storage commodity information increase, under the condition of the same commodity information of the two-dimensional code of needs storage and standard size, the scheme in this scheme can generate the less two-dimensional code of size, and can guarantee that the small-size code that generates also can contain required commodity information, thereby solve the too big problem of standard two-dimensional code size, in order to satisfy the scene demand of some small-size codes.
Based on the process of fig. 1, some specific embodiments of the process are also provided in the examples of this specification, which are described below.
Before the obtaining of the binary sequence corresponding to the commodity information of the two-dimensional code to be generated, the method may further include:
and coding the commodity information by adopting a coding algorithm to obtain a binary sequence corresponding to the commodity information.
It should be noted that the encoding algorithm may be an encoding algorithm with stronger error correction capability, such as: BCH algorithm, RS coding algorithm, etc.
The encoding algorithm is used for encoding the commodity information, and can be understood as a sequence for converting data corresponding to the commodity information into a binary system by using the encoding algorithm. Such as: characters corresponding to the commodity data may be grouped into groups of three digits, each group of data is converted into 10-bit binary data, and the remaining one or two digits are converted into 4-or 7-bit binary data.
Optionally, before determining the pixel value of each valid information bit in the generation area of the two-dimensional code according to the binary sequence, the method may further include:
acquiring size information of the two-dimensional code;
and determining the position information of each positioning point position and the position information of the effective information position in the two-dimensional code according to the size information.
It should be noted that, according to the present scheme, a two-dimensional code with a size specified by a user can be generated according to a requirement of the user, for example: the two-dimensional code generated by the tape is determined to be 5x5 pixels in size.
The position information of each positioning point and the position information of the effective information bit can be represented by coordinates or in a matrix form. When the two-dimensional code is expressed in a matrix form, each positioning point and effective information bit in the two-dimensional code can be correspondingly converted into corresponding elements in each row and each column in the matrix. Such as: and converting the positioning point position of the upper left positioning area in the two-dimensional code into an element corresponding to the first row and the first column in the matrix.
In the method steps in fig. 1, the determining a pixel value of each valid information bit in the generation area of the two-dimensional code according to the binary sequence may specifically include:
for each bin in the binary sequence, determining the order of the bin in the binary sequence;
determining the positions of the corresponding effective information bits in the two-dimensional code generation area according to the sequence;
the pixel value of the significant information bit of the position is determined from the value of the binary bit.
It should be noted that the pixel value here may represent a code block color corresponding to a point in the two-dimensional code, such as: black or white.
Fig. 3 is a schematic diagram illustrating determination of a pixel value of an effective information bit in a two-dimensional code generation method according to an embodiment of the present disclosure.
As shown in fig. 3, for convenience of explaining the determination process of the pixel value of the effective information bit, the position of the effective information bit in the two-dimensional code may be labeled with a serial number, and it should be noted that fig. 3 is only used for explaining the determination process of the code block pixel in the effective information bit, and the figure does not set any limit to the technical solution of the present application.
It should be noted that each binary bit in a binary sequence has an order in the binary sequence. Such as: a binary sequence is 010110101, and starting from left to right, the first binary digit in the binary sequence is 0, the second binary digit is 1, and the third binary digit is 0 … …, and the ninth binary digit is 1. Corresponding the first binary digit in the binary sequence to the point position of the serial number '1' in the effective information bit in the two-dimensional code, corresponding the second binary digit in the binary sequence to the point position of the serial number '2' in the effective information bit in the two-dimensional code, and repeating the steps, … …, and corresponding the ninth binary digit in the binary sequence to the point position of the serial number '9' in the effective information bit in the two-dimensional code.
Assuming that "0" in binary represents a white code block and "1" represents a black code block, the code block color corresponding to each valid information point may be determined according to the binary sequence 010110101, such as: the first binary digit in the binary sequence is 0, it can be determined that the color of the code block of the point location corresponding to the sequence number "1" in the effective information bits is black, the second binary digit in the binary sequence is 1, it can be determined that the color of the code block of the point location corresponding to the sequence number "2" in the effective information bits is white … …, the ninth binary digit in the binary sequence is 1, and it can be determined that the color of the code block of the point location corresponding to the sequence number "9" in the effective information bits is black. Optionally, one two-dimensional code may include a location point location and an effective information bit, where the code block in which the location point location of the first location area is located may store mask information, and certainly, the mask information may also be stored in other code blocks except the code block in which the location point location is located, and how many code blocks are specifically required to store the mask information may be determined according to the size of the generated two-dimensional code.
Before the obtaining of the binary sequence corresponding to the commodity information of the two-dimensional code to be generated, the method may further include:
and carrying out mask processing on the binary sequence corresponding to the commodity information according to the mask information to obtain the binary sequence after the mask processing.
It should be noted that the region where the valid information bits are located may be regarded as a digital region, and the region where the location point is located may be regarded as a functional region. The masking process is only used for masking the digital area where the effective information bit is located, and the functional area where the positioning point is located is not affected. After the commodity data is encoded, in order to avoid large-area blank or black blocks in the code blocks in the effective information bits, which causes difficulty in scanning and identification, the effective information bits may be masked.
The mask may thus be used to arrange dark and light modules, in addition to which it is possible to avoid as far as possible the occurrence of points corresponding to the location points in other areas of the symbol. In a specific use process, the better the mask effect is, the more uniform the distribution of the black and white blocks is, so that the accuracy of two-dimensional code identification can be improved. And the quality of the mask is determined by the mask. Wherein the mask may refer to a strategy of changing the value of the symbol within the two-dimensional code region according to a certain rule. The mask is used for adjusting the display of each code block in the two-dimensional code. If a code block within a two-dimensional code is masked, it can be understood that: if the code block is a white symbol before being subjected to the masking process, the code block may become a black code block after being subjected to the masking process. In other words, the mask may be understood as modifying the pixel values of the code block in the two-dimensional code.
The method in the above example 1 can be described in conjunction with the following specific implementation:
1) firstly, determining the size of the two-dimensional code, drawing a frame area, and determining the size of the two-dimensional code, such as: a 4x4 two-dimensional code needs to be generated.
2) Determining the format and position of the anchor point in the two-dimensional code frame region, such as: the square grid is used as a positioning point, the points at the upper left, the upper right and the lower left are used as a first positioning area, and the color of the code block is fixed to be black and used as the positioning point of the first positioning area.
3) Four point locations at the lower right corner are used for marking the direction, the direction positioning point locations are fixed to be white, and the peripheral frame is also white, so that in order to avoid the appearance of a large homochromy area, the point locations at the upper left of the point locations are fixed to be black.
4) Determining the number of the remaining point locations, and selecting a coding algorithm with strong error correction capability (such as: BCH encoding algorithm, RS algorithm) encodes the commodity information.
And after the coding is finished, processing the generated two-dimensional code by using a mask so that black and white color blocks are uniformly distributed to obtain the color of the code block corresponding to the effective information bits, and generating the 4x4 two-dimensional code.
By the method, the small-size code can be generated, the minimum size of the existing two-dimensional code is 21x21 pixels, the size is overlarge, reasonable positioning points and code word information distribution in the scheme and selection of a coding and decoding algorithm can enable the minimum size of the generated two-dimensional code to reach 4x4, the minimum size of the generated two-dimensional code can reach about 1/16 of the standard two-dimensional code, the problem that the size of the standard two-dimensional code is overlarge can be effectively solved, when the generated two-dimensional code is attached to the surface of a commodity, the concealed commodity appearance information is very little, almost no influence is caused on the commodity surface information, and the requirement of an intelligent container scene on the size of the two-dimensional code is met.
Example 2
Fig. 4 is a flowchart illustrating a two-dimensional code decoding method in an embodiment of this specification. From the viewpoint of a program, the execution subject of the flow may be a program installed in an application server or an application client.
It should be noted that the decoding process in embodiment 2 corresponds to the encoding process in embodiment 1, for example: the encoding algorithm in embodiment 1 should correspond to the decoding algorithm in embodiment 2, and assuming that the BCH algorithm is used to encode the commodity information to obtain the binary sequence, the BCH algorithm should also be used to decode the binary sequence to obtain the commodity information during decoding.
As shown in fig. 4, the process may include the following steps:
step 402: acquiring image information of a two-dimensional code to be identified, wherein an image area of the two-dimensional code to be identified comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position.
It should be noted that the image information of the two-dimensional code mentioned above may represent information of the two-dimensional code itself that is not limited by the two-dimensional code carrier, such as: and (4) information of the two-dimensional code drawn on the computer. For example: size information of the two-dimensional code, position information of each positioning point, position information of effective information bits, code block colors corresponding to each point in the two-dimensional code, and the like.
Step 404: and determining the pixel value of the effective information bit in the two-dimensional code to be identified from the image information.
Since the position information of each positioning area can be determined from the image information of the two-dimensional code, the remaining point positions except for each positioning area are effective information bits.
The effective information bit can store commodity information. The scanning device can obtain the commodity information stored in the effective information bit by scanning the two-dimensional code.
Step 406: and generating a binary sequence according to the pixel value of the effective information bit.
Here, the pixel value may indicate that the code block corresponding to the point is black or white, and the pixel value may be a value of a specific pixel corresponding to black or white. The color of the code block corresponding to each effective information bit can be seen from the image information of the two-dimensional code, and the binary bits in the binary sequence can be determined according to the color of the code block. Such as: black is the binary digit "1" and white is the binary digit "0". The step of generating the binary sequence according to the pixel value of the significant information bit in this step may refer to the process of determining the pixel value of the significant information bit according to the binary sequence in embodiment 1, and the process of determining the pixel value of the significant information bit according to the binary sequence in embodiment 1 is reversely derived, so as to obtain a specific implementation step of generating the binary sequence according to the pixel value of the significant information bit, which is not described herein again.
Step 408: and decoding the binary sequence to obtain the commodity information stored in the effective information bit.
And decoding the binary sequence by adopting a decoding algorithm corresponding to the coding algorithm to obtain the commodity information stored in the effective information bit.
One two-dimensional code includes location points and valid information bits, and mask information is stored in part of the location points, so before decoding the binary sequence, the method may further include:
and removing the mask of the binary sequence according to mask information stored in any point position of the first positioning area to obtain the binary sequence after the mask is removed.
The manner of removing the mask in this step may correspond to the manner of performing the mask process on the binary sequence, and the mask information based on which the mask of the binary sequence is removed should be kept identical to the mask information based on which the mask process is performed on the binary sequence.
Based on the method of fig. 4, the present specification also provides some specific embodiments of the method, which are described below.
Before decoding the two-dimensional code, the two-dimensional code image needs to be obtained by detecting the two-dimensional code image from the image to be detected containing the two-dimensional code image, and then the two-dimensional code needs to be obtained by identifying the two-dimensional code image. Specifically, a detection model may be used to detect a two-dimensional code image from an image to be detected including the two-dimensional code image, an identification model may be used to identify image information of a two-dimensional code from the two-dimensional code image detected by the detection model, and the following implementation scheme may be specifically adopted to implement:
before the obtaining of the image information of the two-dimensional code to be recognized, the method may further include:
acquiring a two-dimensional code image containing a two-dimensional code to be identified;
and identifying the two-dimension code image by adopting an identification model to obtain the image information of the two-dimension code to be identified.
Before decoding the two-dimensional code, image information of the two-dimensional code needs to be acquired, and the two-dimensional code can be identified from the two-dimensional code image by the image information of the two-dimensional code.
It should be noted that the two-dimensional code image mentioned in the above steps may refer to an image containing a two-dimensional code.
The identification model is used for identifying the two-dimensional code from the two-dimensional code image, and can be understood as keying out the two-dimensional code from an image containing the two-dimensional code. The recognition model belongs to a deep learning model and can be supervised learning. The deep learning is a branch of machine learning, is an algorithm for performing characterization learning on data by taking an artificial neural network as a framework, and is an algorithm for performing characterization learning on data in the machine learning. The observations can be represented in a number of ways, such as a vector of intensity values for each pixel, or more abstractly as a series of edges, a specially shaped region, and so forth.
Before the obtaining of the two-dimensional code image including the two-dimensional code to be recognized, the method may further include:
acquiring an image to be identified, wherein the image to be identified comprises the two-dimensional code image;
and detecting the image to be recognized by adopting a detection model, and determining a two-dimension code image containing the two-dimension code to be recognized in the image to be recognized.
It should be noted that, the image to be recognized herein may refer to an image including a background and a two-dimensional code, such as: a two-dimensional code is pasted on a commodity in a market, an image acquisition device is adopted to shoot a picture, the picture comprises the commodity and the two-dimensional code pasted on the commodity, and the shot picture can be represented by an image to be identified in the scheme.
The detection model mentioned above may be a deep learning model. The method is used for determining the two-dimension code image containing the two-dimension code to be identified from the image to be identified.
The above method corresponds to the two-dimensional code generation method in embodiment 1, and the generated two-dimensional code may be decoded according to the two-dimensional code generation method.
In the prior art, when a two-dimensional code is identified, detection and identification are performed by using an algorithm based on a traditional image, each area of the two-dimensional code is found mainly by using line detection, and then codeword information is identified by using a complex coding and decoding algorithm. The method has high requirements on image quality, high requirements on illumination intensity, picture resolution, shooting angle and the like, and the two-dimensional code cannot be identified by slight deviation.
Based on this, the two-dimensional code recognition method proposed in this embodiment may be a detection and recognition algorithm based on deep learning, and the two-dimensional code recognition method proposed in this embodiment may be a method for recognizing the two-dimensional code generated in embodiment 1. In the specific detection and identification process, a detection model is mainly adopted to detect a two-dimensional code image in an image from an image shot by an image acquisition device; and then, identifying the specific two-dimensional code in the two-dimensional code image by using the identification model identification detection model. The following examples may be used to illustrate:
example 3
Fig. 5 is a schematic flowchart of a two-dimensional code identification method in an embodiment of this specification. From the viewpoint of a program, the execution subject of the flow may be a program installed in an application server or an application client.
As shown in fig. 1, the process may include the following steps:
step 502: and acquiring an image to be identified.
The image to be recognized may be an image including a two-dimensional code and a background, such as: in the scene of the intelligent container, an image shot by a fisheye camera in the intelligent container can be used as an image to be identified, and the image to be identified can contain the two-dimensional code, a carrier attached with the two-dimensional code, environmental information around the carrier and the like.
Step 504: and detecting the image to be recognized by adopting a detection model, and determining a two-dimension code image containing the two-dimension code to be recognized in the image to be recognized.
Step 506: identifying the two-dimension code image by adopting an identification model to obtain image information of a two-dimension code to be identified in the two-dimension code image, wherein the image area of the two-dimension code to be identified comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position.
By the method, each point position in the two-dimensional code can be accurately identified by adopting a detection and identification algorithm based on deep learning, so that effective information contained in the code is completely decoded in a scene where a distorted image of the two-dimensional code is shot by a camera, and high-precision detection and identification of the small-size two-dimensional code in the distorted scene are realized. Based on the method of fig. 5, the present specification also provides some specific embodiments of the method, which are described below.
Optionally, the direction positioning area occupies four point locations, and before the identifying the two-dimensional code image by using the identification model, the method may further include:
acquiring first position information corresponding to a preset direction positioning area in an image area of a standard two-dimensional code;
acquiring second position information of a direction positioning area in the image area of the two-dimensional code to be identified;
and carrying out transformation correction on the two-dimensional code to be recognized according to the second position information and the first position information to obtain a corrected two-dimensional code image.
It should be noted that the direction positioning area may be located at any position of four corners in the two-dimensional code area, for example, may be located at a lower right corner in the two-dimensional code area, and of course, the two-dimensional code area herein refers to a corresponding area when the two-dimensional code is correctly placed. The direction location area may be used to represent a direction of the two-dimensional code, wherein the direction location area may occupy four points.
Before the two-dimensional code is recognized, the direction of the two-dimensional code image may be corrected in order to improve the recognition efficiency.
Specifically, when the two-dimensional code is subjected to rotation transformation, the direction of the two-dimensional code image may be corrected by adopting a perspective transformation method, or may be corrected by adopting another method, and the embodiments of the present specification are not particularly limited. Specifically, first position information corresponding to a preset direction positioning area in an image area of the standard two-dimensional code may be acquired, and then second position information of the direction positioning area in the image area of the two-dimensional code to be recognized may be acquired. At this time, the two-dimensional code to be recognized may be transformed and corrected according to the second position information and the first position information, so as to obtain a corrected two-dimensional code image. Such as: the preset direction positioning area in the image area of the standard two-dimensional code is located at the lower right corner of the area, the acquired direction positioning area in the image area of the two-dimensional code to be recognized is located at the upper left corner of the area, and at the moment, the two-dimensional code to be recognized can be rotated by 180 degrees according to the second position information and the first position information, so that a two-dimensional code image after being rotated by 180 degrees is obtained.
It should be noted that the step of correcting the direction of the two-dimensional code image may be completed in the detection model, and specifically, after the detection model detects the two-dimensional code image from the image to be recognized, the two-dimensional code image is transformed and corrected to obtain a corrected two-dimensional code image, and then the corrected two-dimensional code image is input into the recognition model for recognition.
The step of correcting the direction of the two-dimensional code image may also be completed in the recognition model, specifically, after the detection model detects the two-dimensional code image from the image to be recognized, the two-dimensional code image is input into the recognition model, the recognition model firstly performs conversion correction on the input two-dimensional code image to obtain a corrected two-dimensional code image, and then recognizes the corrected two-dimensional code image.
The step of correcting the direction of the two-dimensional code image can also be independently executed by other equipment, specifically, after the two-dimensional code image is detected from the image to be recognized by the detection model, the two-dimensional code image is sent to the other equipment, the two-dimensional code image is converted and corrected by the other equipment, and after the corrected two-dimensional code image is obtained, the corrected two-dimensional code image is input into the recognition model for recognition.
In an actual application scenario, in order to improve the recognition accuracy and recognition efficiency when recognizing the two-dimensional code, the acquired image may be preprocessed in advance, and specifically, the following method may be adopted:
before the image to be recognized is acquired, the method may further include:
acquiring a commodity image containing a two-dimensional code and shot by image acquisition equipment;
and preprocessing the commodity image to obtain an image to be identified.
The pre-processing may include pixel value normalization, picture resizing and/or distortion correction, among other operations.
Before the detection model is adopted to detect and determine the two-dimensional code image from the image to be recognized, the detection model needs to be trained firstly, and the specific training process can adopt the following method:
before the detecting the image to be recognized by using the detection model and determining the two-dimensional code image containing the two-dimensional code to be recognized in the image to be recognized, the method may further include:
acquiring a sample picture containing a two-dimensional code image, wherein a partial area in the sample picture comprises a two-dimensional code;
training a detection model by using the sample picture until the first accuracy of the detection model meets a first preset threshold value to obtain the trained detection model; the first accuracy rate represents the similarity degree between the two-dimensional code image obtained by the detection of the detection model and the known two-dimensional code image.
In the above step, the first accuracy may be directly proportional to the degree of similarity between the two-dimensional code image obtained by detection of the detection model and the known two-dimensional code image, that is, the higher the first accuracy is, the more similar the two-dimensional code image output by the detection model and the known two-dimensional code image may be represented.
When the detection model is trained, the detection accuracy of the trained detection model should meet preset conditions, such as: the detection accuracy of the detection model should be set to be greater than or equal to 95%. The accuracy can be measured by calculating and comparing the similarity between the two-dimensional code image output by the detection model and the known two-dimensional code image, the accuracy here can be directly represented by the similarity between the output two-dimensional code image and the known two-dimensional code image, the accuracy of the detection model can also be calculated according to the similarity, the determination method of the accuracy can be limited according to the actual situation, and the embodiment of the specification does not limit the accuracy.
It should be noted that the sample picture in the above steps may be a real picture obtained by shooting, for example: the two-dimensional code is pasted on a cup, a picture of the cup pasted with the two-dimensional code is shot by a camera, and the picture comprises the whole two-dimensional code and the cup. Certainly, when the deep learning algorithm is applied in this scheme, a large amount of picture data is needed for training the detection model, and when the real picture data in the real scene cannot meet the training requirement of the detection model, the sample picture may also be a synthesized sample picture containing a two-dimensional code image, for example: and acquiring some background pictures from the network, and synthesizing the two-dimensional code and the background pictures by a synthesis technology to obtain a sample picture.
When the sample picture is a synthesized picture, the two-dimensional code and the background may have a disagreement condition, which results in a large difference between the synthesized picture and the real picture, and further affects the training effect of the training detection model. In order to solve the technical problem, the synthesized sample picture can be optimized, so that the synthesized sample picture is closer to a real picture, the training effect of the detection model is ensured, and the detection precision of the subsequent detection model is improved. The method for optimizing a synthesized sample picture may specifically comprise the steps of:
and inputting the synthetic picture to be optimized into a generation model in a generation type countermeasure network to obtain a picture output by the generation model, and taking the generated and output picture as an optimized picture sample.
The synthetic picture is optimized through the generative confrontation network, and specifically, the optimized picture can be obtained by adopting a generative model in the generative confrontation network.
Before the step of inputting the synthetic picture to be optimized into the generative model in the generative confrontation network and obtaining the picture output by the generative model, the method may further include:
acquiring a synthesized sample picture containing a two-dimensional code;
inputting the synthesized sample picture into a generation model in a generation type countermeasure network to obtain a synthesized picture output by the generation model;
inputting the synthesized picture output by the sample into a discrimination model in a generative countermeasure network to obtain a discrimination result of the discrimination model, wherein the discrimination result represents the similarity between the synthesized picture output by the generative model and a real picture containing a two-dimensional code;
and when the similarity is smaller than a preset threshold value, optimizing the generation model in the generation type confrontation network until the similarity between the synthetic picture output by the generation model and the real picture containing the two-dimensional code is larger than or equal to the preset threshold value, and obtaining the generation model of the generation type confrontation network after training.
It should be noted that a Generative Adaptive Networks (GANs) includes two models, one is a Generative model G, and the other is a discriminant model D, and the Generative model G functions as: by continuously learning the probability distribution of the real data in the training set, the goal is to generate pictures close to the real pictures. The role of the discriminant model D is: and judging whether the picture generated by the generated model is a real picture or not, wherein the aim is to distinguish a 'false' picture generated by the generated model G from a 'true' picture in a training set. Due to the existence of the discrimination model D, the G can well learn to approach to real data on the premise of no large amount of prior knowledge and prior distribution, and finally the data generated by the generated model achieves the effect of being spurious.
Therefore, the generated model is optimized according to the judgment result of the judgment model, and the picture generated by the optimized generated model can be used as a picture sample.
By the method, the sample picture which can be synthesized is closer to a real picture, so that the training effect of the detection model is ensured, and the detection precision of the subsequent detection model is improved.
Before the identification model is adopted to identify the two-dimension code image and the image information of the two-dimension code to be identified in the two-dimension code image is obtained, the identification model needs to be trained, and the specific training process can adopt the following method:
acquiring a two-dimensional code image sample, wherein the two-dimensional code image sample contains known image information of a two-dimensional code;
training a recognition model by adopting the two-dimensional code image sample until a second accuracy of an output result of the recognition model meets a second preset threshold value to obtain a trained recognition model; the second accuracy rate represents a degree of similarity between an output result of the recognition model and image information known by the two-dimensional code.
In the above method steps, the two-dimensional code image sample may include known image information of the two-dimensional code, and the image information may refer to the explanations in embodiment 1 and embodiment 2, which are not described herein again.
It should be noted that before the two-dimensional code image sample is used to train the recognition model, the countermeasure generation network may also be used to optimize the two-dimensional code image sample, and a method for optimizing a synthesized sample picture used to train the detection model may be referred to in the specific optimization process, which is not described herein again.
The method in example 3 can be illustrated using the following example:
for example: in an application scene of the intelligent container, a commodity picture shot by the fisheye camera is used as a real shot image to be identified, and the real shot image can contain commodities, two-dimensional codes attached to the commodities, surrounding environment information and the like. The specific steps of identifying the two-dimensional code in the real shot image may include:
1) and carrying out preprocessing such as pixel value normalization, picture size adjustment, distortion correction and the like on the real image to be identified to obtain the image to be identified.
2) After the image to be recognized is obtained, the image to be recognized is detected by adopting a detection model, the image of the two-dimensional code in the image to be recognized is determined, and the outline of the two-dimensional code, the position of each positioning point, the position of each effective information bit and the code block color of all the points can be seen from the two-dimensional code image.
3) And after the two-dimensional code image is obtained through detection, the two-dimensional code image is subjected to conversion correction according to the position information of the direction positioning area, and the two-dimensional code image is converted into a two-dimensional code image in a standard direction.
4) And identifying the converted two-dimensional code image by adopting an identification model to obtain the image information of the two-dimensional code, wherein the image information comprises the information of each positioning point position in the two-dimensional code and the information of an effective information bit, such as: mask information contained in the location points, binary sequences corresponding to the valid information bits, a coding algorithm, and the like.
5) And removing the mask according to the mask information.
6) And generating a binary sequence according to the pixel values of the effective information bits of the de-mask.
7) And decoding the binary sequence according to a decoding algorithm to obtain the commodity information stored in the effective information bit.
By the methods in the foregoing embodiment 1, embodiment 2, and embodiment 3, the technical effects that can be achieved in this scheme may include:
1) the existing two-dimensional code includes a positioning feature area, an alignment feature area, a time sequence area, a format information area, a data area, and the like, and each area has a fixed position, for example: the positioning codes in the three corners are in a shape like a Chinese character 'hui', and each area has a very complicated checking process. However, according to the scheme, only three positioning areas in the first positioning area are used for positioning the two-dimensional code, any point location in the first positioning area is used as an information bit of the mask, the direction positioning area is used for positioning the direction of the two-dimensional code, the rest information bits are all information bits, the structure in the two-dimensional code is less than that of the existing two-dimensional code, and each positioning area in the first positioning area only occupies one point location, so that effective information point locations for storing commodity information are increased, the generated small-size code can also contain corresponding commodity information, and the problem that the size of the standard two-dimensional code is overlarge is solved. In addition, under the condition that the two-dimensional code generated by the existing two-dimensional code and the two-dimensional code generated by the scheme need to store the same commodity information, the scheme in the scheme can generate the two-dimensional code with a smaller size, so that certain scene requirements for the small-size code are met.
2) Different from the traditional two-dimensional code and other two-dimensional code types, reasonable positioning points, effective information bit information distribution and selection of coding and decoding algorithms enable the size of the two-dimensional code to be as small as 4x4, the size of the actually produced code is smaller than 1cm x 1cm, when the code is attached to the surface of a commodity, the concealed commodity appearance information is very little, the commodity with the size larger than 2cm can be basically attached, almost no influence is caused on the commodity surface information, and the requirement of an intelligent container scene on the size of the two-dimensional code is met.
3) Detection and identification technology of two-dimensional codes: the traditional method based on image detection and identification is abandoned, and each point position in the two-dimensional code can be accurately identified by adopting a detection and identification algorithm based on deep learning, so that effective information contained in the code is completely decoded under the scene of a distorted image of the two-dimensional code shot by a camera, and high-precision detection and identification of the small-size two-dimensional code in the distorted scene are realized.
Based on the same idea, the embodiments of the present specification further provide an apparatus corresponding to the method in the foregoing embodiments. Fig. 6 is a schematic structural diagram of a two-dimensional code generating apparatus corresponding to fig. 1 provided in an embodiment of this specification. As shown in fig. 6, the apparatus may include:
a binary sequence obtaining module 602, configured to obtain a binary sequence corresponding to the commodity information of the two-dimensional code to be generated;
a pixel value determining module 604 of the valid information bits, configured to determine a pixel value of each valid information bit in a generation area of the two-dimensional code according to the binary sequence; the generating area of the two-dimensional code also comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position;
a two-dimensional code generating module 606, configured to generate the two-dimensional code according to the pixel value of the effective information bit and the known pixel value of the location point.
Optionally, the apparatus may further include:
and the coding module is used for coding the commodity information by adopting a coding algorithm to obtain a binary sequence corresponding to the commodity information.
Optionally, the apparatus may further include:
the two-dimension code size acquisition module is used for acquiring the size information of the two-dimension code;
and the point location information determining module is used for determining the location information of each positioning point location and the location information of the effective information bit in the two-dimensional code according to the size information.
Optionally, the module 604 for determining the pixel value of the valid information bit may specifically include:
a binary bit order determining unit for determining, for each binary bit in the binary sequence, an order of the binary bit in the binary sequence;
a position determination unit of effective information bits for determining positions of corresponding effective information bits in the two-dimensional code generation area in the order;
a pixel value determination unit of the significant information bits for determining the pixel value of the significant information bits of said position according to the value of the binary bit.
Optionally, mask information may be stored in a point of any one of the first positioning areas;
the apparatus may further include:
and the mask module is used for performing mask processing on the binary sequence corresponding to the commodity information according to the mask information to obtain the masked binary sequence.
Fig. 7 is a schematic structural diagram of a two-dimensional code decoding apparatus corresponding to fig. 4 according to an embodiment of the present disclosure. As shown in fig. 7, the apparatus may include:
a two-dimensional code image information obtaining module 702, configured to obtain image information of a two-dimensional code to be identified, where an image area of the two-dimensional code to be identified includes a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position;
a valid information bit determining module 704, configured to determine, from the image information, a pixel value of a valid information bit in the two-dimensional code to be identified;
a binary sequence generating module 706, configured to generate a binary sequence according to the pixel values of the significant information bits;
a decoding module 708, configured to decode the binary sequence to obtain the commodity information stored in the valid information bits.
Optionally, the apparatus may further include:
the two-dimensional code image acquisition module is used for acquiring a two-dimensional code image containing a two-dimensional code to be identified;
and the two-dimension code identification module is used for identifying the two-dimension code image by adopting an identification model to obtain the image information of the two-dimension code to be identified.
Optionally, the apparatus may further include:
the to-be-identified image acquisition module is used for acquiring an image to be identified, wherein the image to be identified comprises the two-dimensional code image;
and the two-dimension code image detection module is used for detecting the image to be identified by adopting a detection model and determining the two-dimension code image containing the two-dimension code to be identified in the image to be identified.
Optionally, the apparatus may further include:
and the mask removing module is used for removing the mask of the binary sequence according to the mask information stored in the point position of any one of the first positioning areas to obtain the binary sequence after the mask is removed.
Fig. 8 is a schematic structural diagram of a two-dimensional code recognition apparatus corresponding to fig. 5 provided in an embodiment of this specification. As shown in fig. 8, the apparatus may include:
an image to be recognized acquisition module 802, configured to acquire an image to be recognized;
a two-dimensional code image detection module 804, configured to detect the image to be recognized by using a detection model, and determine a two-dimensional code image including a two-dimensional code to be recognized in the image to be recognized;
a two-dimension code recognition module 806, configured to recognize the two-dimension code image by using a recognition model, so as to obtain image information of a to-be-recognized two-dimension code in the two-dimension code image, where an image area of the to-be-recognized two-dimension code includes a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position.
Optionally, the direction positioning region may occupy four points, and the apparatus may be further configured to:
acquiring first position information corresponding to a preset direction positioning area in an image area of a standard two-dimensional code;
acquiring second position information of a direction positioning area in the image area of the two-dimensional code to be identified;
and carrying out transformation correction on the two-dimensional code to be recognized according to the second position information and the first position information to obtain a corrected two-dimensional code image.
Optionally, the apparatus may further include:
the commodity image acquisition module is used for acquiring a commodity image which is shot by the image acquisition equipment and contains the two-dimensional code;
the preprocessing module is used for preprocessing the commodity image to obtain an image to be identified; the pre-processing includes at least pixel value normalization, picture resizing and/or distortion correction.
Optionally, the apparatus may further include:
the system comprises a sample picture acquisition module, a two-dimension code acquisition module and a two-dimension code analysis module, wherein the sample picture acquisition module is used for acquiring a sample picture containing a two-dimension code image, and a partial area in the sample picture comprises a two-dimension code;
the detection model training module is used for training a detection model by adopting the sample picture until the first accuracy of the detection model meets a first preset threshold value, so as to obtain the trained detection model; the first accuracy rate represents the similarity degree between the two-dimensional code image obtained by the detection of the detection model and the known two-dimensional code image.
Optionally, the sample picture acquiring module may be specifically configured to:
and acquiring a synthesized sample picture containing the two-dimensional code image.
Optionally, the apparatus may further include:
and the sample picture optimization module is used for inputting the synthetic picture to be optimized into a generation model in the generation countermeasure network to obtain a picture output by the generation model, and taking the generated and output picture as an optimized picture sample.
Optionally, the apparatus may be further configured to:
acquiring a synthesized sample picture containing a two-dimensional code;
inputting the synthesized sample picture into a generation model in a generation type countermeasure network to obtain a synthesized picture output by the generation model;
inputting the synthesized picture output by the sample into a discrimination model in a generative countermeasure network to obtain a discrimination result of the discrimination model, wherein the discrimination result represents the similarity between the synthesized picture output by the generative model and a real picture containing a two-dimensional code;
and when the similarity is smaller than a preset threshold value, optimizing the generation model in the generation type confrontation network until the similarity between the synthetic picture output by the generation model and the real picture containing the two-dimensional code is larger than or equal to the preset threshold value, and obtaining the generation model of the generation type confrontation network after training.
Optionally, the apparatus may further include:
the two-dimensional code image sample acquisition module is used for acquiring a two-dimensional code image sample, and the two-dimensional code image sample contains known image information of a two-dimensional code;
the recognition model training module is used for training a recognition model by adopting the two-dimensional code image sample until the second accuracy of the output result of the recognition model meets a second preset threshold value, so as to obtain a trained recognition model; the second accuracy rate represents a degree of similarity between an output result of the recognition model and image information known by the two-dimensional code.
Based on the same idea, the embodiment of the present specification further provides a device corresponding to the above method. Fig. 9 is a schematic structural diagram of an apparatus corresponding to fig. 1, fig. 4 and fig. 5 provided in an embodiment of the present disclosure. As shown in fig. 9, the apparatus 900 may include:
at least one processor 910; and the number of the first and second groups,
a memory 930 communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory 930 stores instructions 920 that are executable by the at least one processor 910, the instructions being executed by the at least one processor 910.
In a two-dimensional code generating apparatus corresponding to embodiment 1, the instructions may enable the at least one processor 910 to:
acquiring a binary sequence corresponding to commodity information of a two-dimensional code to be generated;
determining the pixel value of each effective information bit in the generation area of the two-dimensional code according to the binary sequence; the generating area of the two-dimensional code also comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position;
and generating the two-dimensional code according to the pixel value of the effective information bit and the known pixel value of the positioning point.
Corresponding to embodiment 2, in a two-dimensional code decoding apparatus, the instructions may enable the at least one processor to:
acquiring image information of a two-dimensional code to be identified, wherein an image area of the two-dimensional code to be identified comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position;
determining the pixel value of the effective information bit in the two-dimensional code to be identified from the image information;
generating a binary sequence according to the pixel value of the effective information bit;
and decoding the binary sequence to obtain the commodity information stored in the effective information bit.
Corresponding to embodiment 3, in a two-dimensional code recognition device, the instructions may enable the at least one processor to:
acquiring an image to be identified;
detecting the image to be recognized by adopting a detection model, and determining a two-dimension code image containing a two-dimension code to be recognized in the image to be recognized;
identifying the two-dimension code image by adopting an identification model to obtain image information of a two-dimension code to be identified in the two-dimension code image, wherein the image area of the two-dimension code to be identified comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position.
Based on the same idea, embodiments of the present specification further provide a computer-readable medium corresponding to the method in embodiment 1. The computer readable medium has computer readable instructions stored thereon that are executable by a processor to implement the method of:
acquiring a binary sequence corresponding to commodity information of a two-dimensional code to be generated;
determining the pixel value of each effective information bit in the generation area of the two-dimensional code according to the binary sequence; the generating area of the two-dimensional code also comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position;
and generating the two-dimensional code according to the pixel value of the effective information bit and the known pixel value of the positioning point.
Based on the same idea, embodiments of the present specification further provide a computer-readable medium corresponding to the method in embodiment 2. The computer readable medium has computer readable instructions stored thereon that are executable by a processor to implement the method of:
acquiring image information of a two-dimensional code to be identified, wherein an image area of the two-dimensional code to be identified comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position;
determining the pixel value of the effective information bit in the two-dimensional code to be identified from the image information;
generating a binary sequence according to the pixel value of the effective information bit;
and decoding the binary sequence to obtain the commodity information stored in the effective information bit.
Based on the same idea, embodiments of the present specification further provide a computer-readable medium corresponding to the method in embodiment 3. The computer readable medium has computer readable instructions stored thereon that are executable by a processor to implement the method of:
acquiring an image to be identified;
detecting the image to be recognized by adopting a detection model, and determining a two-dimension code image containing a two-dimension code to be recognized in the image to be recognized;
identifying the two-dimension code image by adopting an identification model to obtain image information of a two-dimension code to be identified in the two-dimension code image, wherein the image area of the two-dimension code to be identified comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Language Description Language), traffic, pl (core unified Programming Language), HDCal, JHDL (Java Hardware Description Language), langue, Lola, HDL, laspam, hardsradware (Hardware Description Language), vhjhd (Hardware Description Language), and vhigh-Language, which are currently used in most common. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the various elements may be implemented in the same one or more software and/or hardware implementations in implementing one or more embodiments of the present description.
One skilled in the art will recognize that one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
One or more embodiments of the present description are described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to one or more embodiments of the description. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
One or more embodiments of the present description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. One or more embodiments of the specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is merely exemplary of the present disclosure and is not intended to limit one or more embodiments of the present disclosure. Various modifications and alterations to one or more embodiments described herein will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of the present specification should be included in the scope of claims of one or more embodiments of the present specification.

Claims (24)

1. A two-dimensional code generation method comprises the following steps:
acquiring a binary sequence corresponding to commodity information of a two-dimensional code to be generated;
determining the pixel value of each effective information bit in the generation area of the two-dimensional code according to the binary sequence; the generating area of the two-dimensional code also comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position;
and generating the two-dimensional code according to the pixel value of the effective information bit and the known pixel value of the positioning point.
2. The method according to claim 1, before the obtaining the binary sequence corresponding to the commodity information of the two-dimensional code to be generated, further comprising:
and coding the commodity information by adopting a coding algorithm to obtain a binary sequence corresponding to the commodity information.
3. The method of claim 1, before determining the pixel value of each significant information bit in the generation area of the two-dimensional code according to the binary sequence, further comprising:
acquiring size information of the two-dimensional code;
and determining the position information of each positioning point position and the position information of the effective information position in the two-dimensional code according to the size information.
4. The method according to claim 1, wherein the determining a pixel value of each significant information bit in a generation area of the two-dimensional code according to the binary sequence specifically includes:
for each binary digit in the binary sequence, determining the order of the binary digit in the binary sequence;
determining the positions of the corresponding effective information bits in the two-dimensional code generation area according to the sequence;
the pixel value of the significant information bit of the position is determined from the value of the binary bit.
5. The method of claim 1, wherein mask information is stored in a point of any one of the positioning regions in the first positioning region;
before the obtaining of the binary sequence corresponding to the commodity information of the two-dimensional code to be generated, the method further includes:
and carrying out mask processing on the binary sequence corresponding to the commodity information according to the mask information to obtain the binary sequence after the mask processing.
6. A decoding method of a two-dimensional code comprises the following steps:
acquiring image information of a two-dimensional code to be identified, wherein an image area of the two-dimensional code to be identified comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position;
determining the pixel value of the effective information bit in the two-dimensional code to be identified from the image information;
generating a binary sequence according to the pixel value of the effective information bit;
and decoding the binary sequence to obtain the commodity information stored in the effective information bit.
7. The method of claim 6, before the obtaining the image information of the two-dimensional code to be recognized, further comprising:
acquiring a two-dimensional code image containing a two-dimensional code to be identified;
and identifying the two-dimension code image by adopting an identification model to obtain the image information of the two-dimension code to be identified.
8. The method of claim 7, wherein before the obtaining the two-dimensional code image containing the two-dimensional code to be recognized, the method further comprises:
acquiring an image to be identified, wherein the image to be identified comprises the two-dimensional code image;
and detecting the image to be recognized by adopting a detection model, and determining a two-dimension code image containing the two-dimension code to be recognized in the image to be recognized.
9. The method of claim 6, prior to said decoding the binary sequence, further comprising:
and removing the mask of the binary sequence according to mask information stored in any point position of the first positioning area to obtain the binary sequence after the mask is removed.
10. A two-dimensional code identification method comprises the following steps:
acquiring an image to be identified;
detecting the image to be recognized by adopting a detection model, and determining a two-dimension code image containing a two-dimension code to be recognized in the image to be recognized;
identifying the two-dimension code image by adopting an identification model to obtain image information of a two-dimension code to be identified in the two-dimension code image, wherein the image area of the two-dimension code to be identified comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position.
11. The method of claim 10, wherein the direction-location area occupies four points, and before the identifying the two-dimensional code image by using the identification model, the method further comprises:
acquiring first position information corresponding to a preset direction positioning area in an image area of a standard two-dimensional code;
acquiring second position information of a direction positioning area in the image area of the two-dimensional code to be identified;
and carrying out transformation correction on the two-dimensional code to be recognized according to the second position information and the first position information to obtain a corrected two-dimensional code image.
12. The method of claim 10, prior to acquiring the image to be identified, further comprising:
acquiring a commodity image containing a two-dimensional code and shot by image acquisition equipment;
preprocessing the commodity image to obtain an image to be identified; the pre-processing includes at least pixel value normalization, picture resizing and/or distortion correction.
13. The method according to claim 10, wherein before the detecting the image to be recognized by using the detection model and determining the two-dimensional code image containing the two-dimensional code to be recognized in the image to be recognized, the method further comprises:
acquiring a sample picture containing a two-dimensional code image, wherein a partial area in the sample picture comprises a two-dimensional code;
training a detection model by using the sample picture until the first accuracy of the detection model meets a first preset threshold value to obtain the trained detection model; the first accuracy rate represents the similarity degree between the two-dimensional code image obtained by the detection of the detection model and the known two-dimensional code image.
14. The method according to claim 13, wherein the obtaining of the sample picture including the two-dimensional code image specifically includes:
and acquiring a synthesized sample picture containing the two-dimensional code image.
15. The method of claim 14, wherein before obtaining the picture sample containing the two-dimensional code image, the method further comprises:
and inputting the synthetic picture to be optimized into a generation model in a generation type countermeasure network to obtain a picture output by the generation model, and taking the generated and output picture as an optimized picture sample.
16. The method of claim 15, wherein before inputting the synthetic picture to be optimized into the generative model in the generative countermeasure network and obtaining the picture output by the generative model, the method further comprises:
acquiring a synthesized sample picture containing a two-dimensional code;
inputting the synthesized sample picture into a generation model in a generation type countermeasure network to obtain a synthesized picture output by the generation model;
inputting the synthesized picture output by the sample into a discrimination model in a generative countermeasure network to obtain a discrimination result of the discrimination model, wherein the discrimination result represents the similarity between the synthesized picture output by the generative model and a real picture containing a two-dimensional code;
and when the similarity is smaller than a preset threshold value, optimizing the generation model in the generation type confrontation network until the similarity between the synthetic picture output by the generation model and the real picture containing the two-dimensional code is larger than or equal to the preset threshold value, and obtaining the generation model of the generation type confrontation network after training.
17. The method according to claim 10, before the identifying the two-dimensional code image by using the identification model to obtain the image information of the two-dimensional code to be identified in the two-dimensional code image, further comprising:
acquiring a two-dimensional code image sample, wherein the two-dimensional code image sample contains known image information of a two-dimensional code;
training a recognition model by adopting the two-dimensional code image sample until a second accuracy of an output result of the recognition model meets a second preset threshold value to obtain a trained recognition model; the second accuracy rate represents a degree of similarity between an output result of the recognition model and image information known by the two-dimensional code.
18. A two-dimensional code generation device comprising:
the binary sequence acquisition module is used for acquiring a binary sequence corresponding to the commodity information of the two-dimensional code to be generated;
the pixel value determining module of the effective information bits is used for determining the pixel value of each effective information bit in the generating area of the two-dimensional code according to the binary sequence; the generating area of the two-dimensional code also comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position;
and the two-dimensional code generating module is used for generating the two-dimensional code according to the pixel value of the effective information bit and the known pixel value of the positioning point.
19. An apparatus for decoding a two-dimensional code, comprising:
the two-dimensional code image information acquisition module is used for acquiring image information of a two-dimensional code to be identified, wherein an image area of the two-dimensional code to be identified comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position;
the effective information bit determining module is used for determining the pixel value of the effective information bit in the two-dimensional code to be identified from the image information;
a binary sequence generating module, configured to generate a binary sequence according to the pixel value of the significant information bit;
and the decoding module is used for decoding the binary sequence to obtain the commodity information stored in the effective information bit.
20. A two-dimensional code recognition device includes:
the image to be recognized acquisition module is used for acquiring an image to be recognized;
the two-dimension code image detection module is used for detecting the image to be identified by adopting a detection model and determining a two-dimension code image containing the two-dimension code to be identified in the image to be identified;
the two-dimension code recognition module is used for recognizing the two-dimension code image by adopting a recognition model to obtain image information of a to-be-recognized two-dimension code in the two-dimension code image, wherein the image area of the to-be-recognized two-dimension code comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position.
21. A two-dimensional code generation device comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to:
acquiring a binary sequence corresponding to commodity information of a two-dimensional code to be generated;
determining the pixel value of each effective information bit in the generation area of the two-dimensional code according to the binary sequence; the generating area of the two-dimensional code also comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position;
and generating the two-dimensional code according to the pixel value of the effective information bit and the known pixel value of the positioning point.
22. A two-dimensional code decoding apparatus, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to:
acquiring image information of a two-dimensional code to be identified, wherein an image area of the two-dimensional code to be identified comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position;
determining the pixel value of the effective information bit in the two-dimensional code to be identified from the image information;
generating a binary sequence according to the pixel value of the effective information bit;
and decoding the binary sequence to obtain the commodity information stored in the effective information bit.
23. A two-dimensional code recognition device comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to:
acquiring an image to be identified;
detecting the image to be recognized by adopting a detection model, and determining a two-dimension code image containing a two-dimension code to be recognized in the image to be recognized;
identifying the two-dimension code image by adopting an identification model to obtain image information of a two-dimension code to be identified in the two-dimension code image, wherein the image area of the two-dimension code to be identified comprises a first positioning area and a second positioning area, and the second positioning area is a direction positioning area; the first positioning area comprises three positioning areas, and each positioning area occupies one point position.
24. A computer readable medium having computer readable instructions stored thereon which are executable by a processor to implement the method of any one of claims 1 to 17.
CN202010384112.7A 2020-05-09 2020-05-09 Two-dimensional code generation, decoding and identification method, device and equipment Active CN111291846B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010384112.7A CN111291846B (en) 2020-05-09 2020-05-09 Two-dimensional code generation, decoding and identification method, device and equipment
CN202110799066.1A CN113435557B (en) 2020-05-09 2020-05-09 Two-dimensional code generation, decoding and identification method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010384112.7A CN111291846B (en) 2020-05-09 2020-05-09 Two-dimensional code generation, decoding and identification method, device and equipment

Related Child Applications (1)

Application Number Title Priority Date Filing Date
CN202110799066.1A Division CN113435557B (en) 2020-05-09 2020-05-09 Two-dimensional code generation, decoding and identification method, device and equipment

Publications (2)

Publication Number Publication Date
CN111291846A true CN111291846A (en) 2020-06-16
CN111291846B CN111291846B (en) 2021-06-04

Family

ID=71023956

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202110799066.1A Active CN113435557B (en) 2020-05-09 2020-05-09 Two-dimensional code generation, decoding and identification method, device and equipment
CN202010384112.7A Active CN111291846B (en) 2020-05-09 2020-05-09 Two-dimensional code generation, decoding and identification method, device and equipment

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN202110799066.1A Active CN113435557B (en) 2020-05-09 2020-05-09 Two-dimensional code generation, decoding and identification method, device and equipment

Country Status (1)

Country Link
CN (2) CN113435557B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112464687A (en) * 2020-11-19 2021-03-09 苏州摩比信通智能系统有限公司 Graphic code processing method and device and terminal equipment
CN113392669A (en) * 2021-05-31 2021-09-14 苏州中科华影健康科技有限公司 Image information detection method, detection device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107451508A (en) * 2017-09-20 2017-12-08 天津通信广播集团有限公司 A kind of self-defined Quick Response Code position and azimuth determining system and implementation method
CN107609619A (en) * 2017-07-31 2018-01-19 宁夏共享模具有限公司 The message identification structure and its casting mold loose piece and its core box of a kind of cast(ing) surface
CN108550176A (en) * 2018-04-19 2018-09-18 咪咕动漫有限公司 Image processing method, equipment and storage medium
CN110288069A (en) * 2019-06-26 2019-09-27 百度在线网络技术(北京)有限公司 Two dimensional code generates and method, apparatus, equipment and the readable storage medium storing program for executing of parsing

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100377173C (en) * 2006-03-17 2008-03-26 北京紫光捷通科技有限公司 Two-dimensional code construction based on hexadecimal coding
CN102880850B (en) * 2012-09-19 2015-08-19 腾讯科技(深圳)有限公司 A kind of method of Quick Response Code batch scanning and scanning device
US9865027B2 (en) * 2014-05-09 2018-01-09 Graphiclead LLC System and method for embedding of a two dimensional code with an image
CN106447001A (en) * 2016-09-19 2017-02-22 华南农业大学 Circular two-dimensional code, circular two-dimensional code coding method and application thereof
CN108282265B (en) * 2018-01-19 2020-11-03 广东工业大学 Error correction encoding method, apparatus, device and computer readable storage medium
CN110414644B (en) * 2018-04-27 2023-05-09 阿里巴巴集团控股有限公司 Two-dimensional code, encoding and decoding methods and devices thereof, storage medium and mobile terminal
CN110517052B (en) * 2019-08-26 2022-09-23 北京太和互邦科技有限公司 Two-dimensional code generation method, two-dimensional code identification method, two-dimensional code and equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107609619A (en) * 2017-07-31 2018-01-19 宁夏共享模具有限公司 The message identification structure and its casting mold loose piece and its core box of a kind of cast(ing) surface
CN107451508A (en) * 2017-09-20 2017-12-08 天津通信广播集团有限公司 A kind of self-defined Quick Response Code position and azimuth determining system and implementation method
CN108550176A (en) * 2018-04-19 2018-09-18 咪咕动漫有限公司 Image processing method, equipment and storage medium
CN110288069A (en) * 2019-06-26 2019-09-27 百度在线网络技术(北京)有限公司 Two dimensional code generates and method, apparatus, equipment and the readable storage medium storing program for executing of parsing

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112464687A (en) * 2020-11-19 2021-03-09 苏州摩比信通智能系统有限公司 Graphic code processing method and device and terminal equipment
CN113392669A (en) * 2021-05-31 2021-09-14 苏州中科华影健康科技有限公司 Image information detection method, detection device and storage medium
CN113392669B (en) * 2021-05-31 2022-09-23 苏州中科华影健康科技有限公司 Image information detection method, detection device and storage medium

Also Published As

Publication number Publication date
CN113435557B (en) 2023-04-25
CN111291846B (en) 2021-06-04
CN113435557A (en) 2021-09-24

Similar Documents

Publication Publication Date Title
CN110046529B (en) Two-dimensional code identification method, device and equipment
CN110659647B (en) Seal image identification method and device, intelligent invoice identification equipment and storage medium
CN111950318A (en) Two-dimensional code image identification method and device and storage medium
CN107111782B (en) Neural network structure and method thereof
CN109977718B (en) Method and equipment for identifying two-dimensional code
WO2022199471A1 (en) Quick response code generation method and apparatus, quick response code decoding method and apparatus, and device
CN111291846B (en) Two-dimensional code generation, decoding and identification method, device and equipment
CN110569683B (en) Bar code detection method and bar code detection system
CN110084172B (en) Character recognition method and device and electronic equipment
CN110598686A (en) Invoice identification method, system, electronic equipment and medium
CN113392669B (en) Image information detection method, detection device and storage medium
RU2729399C1 (en) Method for detection and recognition of visual markers of long range and high density
CN110991520A (en) Method and device for generating training sample
CN113205095A (en) Training model and character detection method and device
CN111460782A (en) Information processing method, device and equipment
CN113065374A (en) Two-dimensional code identification method, device and equipment
CN112163443A (en) Code scanning method, code scanning device and mobile terminal
CN115909378A (en) Document text detection model training method and document text detection method
CN108734164A (en) Card, identification card method, paint this reading machine people and storage device
CN109448013B (en) QR code image binarization processing method with local uneven illumination
Ajala Object Detection and Recognition Using YOLO: Detect and Recognize URL (s) in an Image Scene
CN110866578B (en) Two-dimensional texture code and encoding and decoding methods thereof
CN109190735B (en) Two-dimensional code generation method, system and device for cylindrical surface
CN112183650B (en) Digital detection and identification method under camera defocus condition
CN112733567B (en) Method and device for identifying two-dimension code of motor vehicle and computer readable storage medium

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
GR01 Patent grant
GR01 Patent grant